Developer Documentation
Loading...
Searching...
No Matches
PolyLineT.hh
1/*===========================================================================*\
2 * *
3 * OpenFlipper *
4 * Copyright (c) 2001-2015, RWTH-Aachen University *
5 * Department of Computer Graphics and Multimedia *
6 * All rights reserved. *
7 * www.openflipper.org *
8 * *
9 *---------------------------------------------------------------------------*
10 * This file is part of OpenFlipper. *
11 *---------------------------------------------------------------------------*
12 * *
13 * Redistribution and use in source and binary forms, with or without *
14 * modification, are permitted provided that the following conditions *
15 * are met: *
16 * *
17 * 1. Redistributions of source code must retain the above copyright notice, *
18 * this list of conditions and the following disclaimer. *
19 * *
20 * 2. Redistributions in binary form must reproduce the above copyright *
21 * notice, this list of conditions and the following disclaimer in the *
22 * documentation and/or other materials provided with the distribution. *
23 * *
24 * 3. Neither the name of the copyright holder nor the names of its *
25 * contributors may be used to endorse or promote products derived from *
26 * this software without specific prior written permission. *
27 * *
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39 * *
40\*===========================================================================*/
41
42
43
44
45//=============================================================================
46//
47// CLASS PolyLineT
48//
49// Author: David Bommes <bommes@cs.rwth-aachen.de>
50//
51//=============================================================================
52
53
54#ifndef ACG_POLYLINET_HH
55#define ACG_POLYLINET_HH
56
57
58//== INCLUDES =================================================================
59#include <vector>
60#include <iostream>
61#include <ACG/Config/ACGDefines.hh>
62#include <OpenMesh/Core/Utils/PropertyManager.hh>
63#include <OpenMesh/Core/Utils/Property.hh>
64
65//== FORWARDDECLARATIONS ======================================================
66
67//== NAMESPACES ===============================================================
68
69namespace ACG {
70
71//== CLASS DEFINITION =========================================================
72
73
74
75
83template <class PointT>
85{
86public:
87
88 // internal relevant Types
89 typedef PointT Point;
90 typedef typename Point::value_type Scalar;
91
93 explicit PolyLineT(bool _closed = false );
94
96 PolyLineT(const PolyLineT& _line);
97
99 PolyLineT& operator= ( const PolyLineT & ) = default;
100
103
110 bool is_closed() const { return closed_;}
111
116 void set_closed(const bool _c) { closed_ = _c;}
117
119 size_t n_vertices() const { return points_.size(); }
120
122 size_t n_edges() const;
123
125 void clear();
126
128 void resize( unsigned int _n);
129
131 void add_point(const Point& _p);
132
138 void insert_point(int _idx, const Point& _p);
139
141 void delete_point(int _idx);
142
143
145 Point& point(unsigned int _i) { return points_[_i];}
146
148 const Point& point(unsigned int _i) const { return points_[_i];}
149
151 std::vector<Point>& points() { return points_;}
152
154 const std::vector<Point>& points() const { return points_;}
155
157 Point& front() { return points_.front();}
158
160 const Point& front() const { return points_.front();}
161
163 Point& back() { return points_.back();}
164
166 const Point& back() const { return points_.back();}
167
169 Point edge_vector(unsigned int _i) const
170 { return(point((_i+1)%n_vertices())-point(_i));}
171
176 Scalar length() const;
177
184 Point position(const Scalar _t) const;
185
194 Point position_arclength(const Scalar _t) const;
195
203 void resample_arclength_uniform(const unsigned int _n);
204
211 void subdivide( Scalar _largest );
212
219 void collapse ( Scalar _smallest );
220
222 void invert();
223
225 void append(const PolyLineT<PointT>& _pl);
226
228 void prepend(const PolyLineT<PointT>& _pl);
229
234 void split_closed( unsigned int _split_idx);
235
241 void split( unsigned int _split_idx, PolyLineT<PointT>& _new_pl);
242
248 void remove_subsequent_identical_points( const bool _keep_edge_vertices = false, const double _epsilon = 1e-6 );
249
252
255
258
259
261 void set_to_circle(const PointT _center, const PointT _normal, double _radius, unsigned int _n_samples = 100);
262
270 template <class MeshT, class SpatialSearchT>
271 void project_to_mesh( const MeshT& _mesh,
272 SpatialSearchT* _ssearch = 0);
273
284 template <class MeshT, class SpatialSearchT>
285 void project_to_mesh( const std::vector<MeshT*>& _mesh,
286 std::vector<SpatialSearchT*>* _ssearch = 0);
287
292 template <class MeshT, class SpatialSearchT>
293 bool on_multiple_components(MeshT &_mesh,
294 SpatialSearchT &_ssearch);
295
302 template <class MeshT, class SpatialSearchT>
304 SpatialSearchT &_ssearch,
305 std::vector<PolyLineT> &out_polylines);
306
307 // This Block is used to pull in extended PolyLine features such as integration of
308 // a PolyLine into a Mesh. Currently this code is not included in the free version.
309 #ifdef EXTENDED_POLY_LINE
310 #include <libs/MeshIntegration/PolyLineIntegrationT.hh>
311 #endif
312
313
321
330 template <class LineNodeT>
331 LineNodeT* get_line_node( LineNodeT*& _line_node, int _mode = 0);
332
338 template <class LineNodeT>
339 void set_line_node( LineNodeT*& _line_node, int _mode = 0);
340
342 void print() const;
343
345 Scalar vertex_radius() const { return vertex_radius_;}
346
348 void set_vertex_radius(const Scalar _r) { vertex_radius_ = _r;}
349
351 Scalar edge_radius() const { return edge_radius_;}
352
354 void set_edge_radius(const Scalar _r) { edge_radius_ = _r;}
355
356
357 // ############################### Standard Property Handling #############################
358
359 // request properties
360 void request_vertex_normals() { request_prop( ref_count_vnormals_ , vnormals_);}
361 void request_vertex_binormals() { request_prop( ref_count_vbinormals_ , vbinormals_);}
362 void request_vertex_colors() { request_prop( ref_count_vcolors_ , vcolors_ );}
363 void request_vertex_scalars() { request_prop( ref_count_vscalars_ , vscalars_);}
364 void request_vertex_selections() { request_prop( ref_count_vselections_, vselections_);}
365 void request_vertex_vhandles() { request_prop( ref_count_vvhandles_ , vvhandles_);}
366 void request_vertex_ehandles() { request_prop( ref_count_vehandles_ , vehandles_);}
367 void request_vertex_fhandles() { request_prop( ref_count_vfhandles_ , vfhandles_);}
368
369 void request_edge_normals() { request_prop( ref_count_enormals_ , enormals_);}
370 void request_edge_colors() { request_prop( ref_count_ecolors_ , ecolors_ );}
371 void request_edge_scalars() { request_prop( ref_count_escalars_ , escalars_);}
372 void request_edge_selections() { request_prop( ref_count_eselections_, eselections_);}
373 void request_preimage_directions() { request_prop( ref_count_epreimage_direction_, epreimage_direction_);}
374
375 // release properties
376 void release_vertex_normals() { release_prop( ref_count_vnormals_ , vnormals_);}
377 void release_vertex_binormals() { release_prop( ref_count_vbinormals_ , vbinormals_);}
378 void release_vertex_colors() { release_prop( ref_count_vcolors_ , vcolors_ );}
379 void release_vertex_scalars() { release_prop( ref_count_vscalars_ , vscalars_);}
380 void release_vertex_selections() { release_prop( ref_count_vselections_, vselections_);}
381 void release_vertex_vhandles() { release_prop( ref_count_vvhandles_ , vvhandles_);}
382 void release_vertex_ehandles() { release_prop( ref_count_vehandles_ , vehandles_);}
383 void release_vertex_fhandles() { release_prop( ref_count_vfhandles_ , vfhandles_);}
384
385 void release_edge_normals() { release_prop( ref_count_enormals_ , enormals_);}
386 void release_edge_colors() { release_prop( ref_count_ecolors_ , ecolors_ );}
387 void release_edge_scalars() { release_prop( ref_count_escalars_ , escalars_);}
388 void release_edge_selections() { release_prop( ref_count_eselections_, eselections_);}
389 void release_preimage_directions() { release_prop( ref_count_epreimage_direction_, epreimage_direction_);}
390
391 // property availability
392 bool vertex_normals_available() const {return (ref_count_vnormals_ != 0 ); }
393 bool vertex_binormals_available() const {return (ref_count_vbinormals_ != 0 ); }
394 bool vertex_colors_available() const {return (ref_count_vcolors_ != 0 ); }
395 bool vertex_scalars_available() const {return (ref_count_vscalars_ != 0 ); }
396 bool vertex_selections_available() const {return (ref_count_vselections_ != 0 ); }
397 bool vertex_vhandles_available() const {return (ref_count_vvhandles_ != 0 ); }
398 bool vertex_ehandles_available() const {return (ref_count_vehandles_ != 0 ); }
399 bool vertex_fhandles_available() const {return (ref_count_vfhandles_ != 0 ); }
400
401 bool edge_normals_available() const {return (ref_count_enormals_ != 0 ); }
402 bool edge_colors_available() const {return (ref_count_ecolors_ != 0 ); }
403 bool edge_scalars_available() const {return (ref_count_escalars_ != 0 ); }
404 bool edge_selections_available() const {return (ref_count_eselections_ != 0 ); }
405 bool edge_preimage_directions_available() const {return (ref_count_epreimage_direction_ != 0 ); }
406
407 // property access ( no range or availability check! )
408 Point& vertex_normal(unsigned int _i) { return vnormals_[_i];}
409 const Point& vertex_normal(unsigned int _i) const { return vnormals_[_i];}
410
411 Point& vertex_binormal(unsigned int _i) { return vbinormals_[_i];}
412 const Point& vertex_binormal(unsigned int _i) const { return vbinormals_[_i];}
413
414 Point & vertex_color(unsigned int _i) { return vcolors_[_i];}
415 const Point & vertex_color(unsigned int _i) const { return vcolors_[_i];}
416
417 Scalar& vertex_scalar(unsigned int _i) { return vscalars_[_i];}
418 const Scalar& vertex_scalar(unsigned int _i) const { return vscalars_[_i];}
419
420 unsigned char& vertex_selection(unsigned int _i) {return vselections_[_i];}
421 const unsigned char& vertex_selection(unsigned int _i) const {return vselections_[_i];}
422
423 int& vertex_vhandle(unsigned int _i) {return vvhandles_[_i];}
424 const int& vertex_vhandle(unsigned int _i) const {return vvhandles_[_i];}
425
426 int& vertex_ehandle(unsigned int _i) {return vehandles_[_i];}
427 const int& vertex_ehandle(unsigned int _i) const {return vehandles_[_i];}
428
429 int& vertex_fhandle(unsigned int _i) {return vfhandles_[_i];}
430 const int& vertex_fhandle(unsigned int _i) const {return vfhandles_[_i];}
431
432 Point& edge_normal(unsigned int _i) { return enormals_[_i];}
433 const Point& edge_normal(unsigned int _i) const { return enormals_[_i];}
434
435 Point & edge_color(unsigned int _i) { return ecolors_[_i];}
436 const Point & edge_color(unsigned int _i) const { return ecolors_[_i];}
437
438 Scalar& edge_scalar(unsigned int _i) { return escalars_[_i];}
439 const Scalar& edge_scalar(unsigned int _i) const { return escalars_[_i];}
440
441 unsigned char& edge_selection(unsigned int _i) {return eselections_[_i];}
442 const unsigned char& edge_selection(unsigned int _i) const {return eselections_[_i];}
443
444 Point & preimage_direction(unsigned int _i) { return epreimage_direction_[_i];}
445 const Point & preimage_direction(unsigned int _i) const { return epreimage_direction_[_i];}
446
447
448 // ############################### Custom Property Handling #############################
449
450 /*
451 A custom property is identified by its name and requires the size in bytes of one property element (example: float3 prop has size 12).
452 PolyLine allocates an internal buffer for properties, so no buffer management is required.
453 On resize/add_point, custom properties of the newly inserted vertices are filled with 0.
454 Optionally, it is possible to use properties in vertex shaders by defining a shader binding.
455 If rendered via PolyLineNode, these properties are then automatically available in vertex shaders (no additional management required).
456 However, it is still necessary to trigger a vbo update function whenever data of properties is changed.
457
458
459 Example: add float3 data to each vertex and use these in a vertex shader
460
461 // request new property with name "myCustomData", that stores 3 * sizeof(float) = 12 bytes
462 PolyLine::CustomPropertyHandle myPropHandle = line->request_custom_property("myCustomData", 12);
463
464 // bind property to a vertex shader as input id "a2v_UserData" with coordinates of type GL_FLOAT
465 line->bind_custom_property_to_shader(myPropHandle, "a2v_UserData", GL_FLOAT);
466
467 // set property data
468 for each vertex i:
469 Vec3f x = computeCustomData(i);
470
471 line->set_custom_property(myPropHandle, x.data());
472
473 // trigger vbo update in rendering node of the polyline (ie. PolyLineNode)
474 lineNode->update();
475
476
477
478 these vertex properties are then available in any vertex shader used to render the polyline:
479
480 in vec3 a2v_UserData;
481
482 void main()
483 {
484 ...
485 }
486 */
487
488 typedef int CustomPropertyHandle;
489
490 // request properties, returns handle of custom property
491 CustomPropertyHandle request_custom_property(const std::string& _name, unsigned int _prop_size);
492
493 // release properties
494 void release_custom_property(const std::string& _name);
495 void release_custom_property(CustomPropertyHandle _prop_handle);
496
497 // property availability
498 bool custom_property_available(CustomPropertyHandle _property_handle) const;
499 bool custom_property_available(const std::string& _name) const;
500
501 // property access by handle (byte-wise)
502 void set_custom_property(CustomPropertyHandle _property_handle, unsigned int _vertex, const void* _data);
503 void get_custom_property(CustomPropertyHandle _property_handle, unsigned int _vertex, void* _dst) const;
504
505 // property access by name (byte-wise), (slower than by handle)
506 void set_custom_property(const std::string& _name, unsigned int _vertex, const void* _data);
507 void get_custom_property(const std::string& _name, unsigned int _vertex, void* _dst) const;
508
509
520 void bind_custom_property_to_shader(CustomPropertyHandle _property_handle, const std::string& _shader_input_name, unsigned int _datatype);
521
532 bool get_custom_property_shader_binding(CustomPropertyHandle _property_handle, unsigned int* _propsize, const char** _input_name, unsigned int* _datatype) const;
533
534 // helper functions:
535
536 // get property handle by name, returns 0 if unavailable
537 CustomPropertyHandle get_custom_property_handle(const std::string& _name) const;
538
539 // get name of property by handle
540 const std::string get_custom_property_name(CustomPropertyHandle _property_handle) const;
541
542 // get number of custom properties
543 unsigned int get_num_custom_properties() const;
544
545 // get pointer to buffer that stores property data for all vertices
546 const void* get_custom_property_buffer(CustomPropertyHandle _property_handle) const;
547
548
549 // enumerate custom property handles via indices in range [0, get_num_custom_properties() - 1]
550 CustomPropertyHandle enumerate_custom_property_handles(unsigned int _i) const;
551
552
553 // ############################### SelectionWrappers ############################
554
555 bool vertex_selected(unsigned int _i) { return (_i < vselections_.size() ? vertex_selection(_i) == 1 : false); }
556 bool edge_selected(unsigned int _i) { return (_i < eselections_.size() ? edge_selection(_i) == 1 : false); }
557
558 void select_vertex(unsigned int _i) { if(_i < vselections_.size()) vertex_selection(_i) = 1; }
559 void select_edge(unsigned int _i) { if(_i < eselections_.size()) edge_selection(_i) = 1; }
560
561 void deselect_vertex(unsigned int _i) { if(_i < vselections_.size()) vertex_selection(_i) = 0; }
562 void deselect_edge(unsigned int _i) { if(_i < eselections_.size()) edge_selection(_i) = 0; }
563
564
565 // ############################### Helper Functions #############################
566
567 // copy this[_j] = _pl[_i] WITH all vertex properties
568 void copy_vertex_complete(const PolyLineT<PointT>& _pl, unsigned int _i, unsigned int _j);
569
570
571 // copy this[_j] = _pl[_i] WITH all edge properties
572 void copy_edge_complete(const PolyLineT<PointT>& _pl, unsigned int _i, unsigned int _j);
573
574private:
575
585 template <class MeshT, class SpatialSearchT>
586 Point find_nearest_point( const MeshT& _mesh,
587 const Point& _point,
588 typename MeshT::FaceHandle &_fh,
589 SpatialSearchT * _ssearch = 0,
590 double* _dbest = 0);
591
597 template<class MeshT, class SpatialSearchT>
598 unsigned int component_of(
601 MeshT> &component,
602 const PointT &pt,
603 SpatialSearchT &_ssearch);
604
609 template <class MeshT>
610 void mark_components(
613 MeshT> &component);
614
615
616 template <class PropT>
617 void request_prop( unsigned int& _ref_count, PropT& _prop);
618 template <class PropT>
619 void release_prop( unsigned int& _ref_count, PropT& _prop);
620
630 template <class IPoint>
631 bool plane_line_intersection( const IPoint& _p_plane,
632 const IPoint& _n_plane,
633 const IPoint& _p0,
634 const IPoint& _p1,
635 IPoint& _p_int);
636
637 template<class MeshT>
638 void edge_points_in_segment( const MeshT& _mesh,
639 const Point& _p0,
640 const Point& _p1,
641 const typename MeshT::FaceHandle& _fh0,
642 const typename MeshT::FaceHandle& _fh1,
643 std::vector<Point> & _points,
644 std::vector<typename MeshT::EdgeHandle>& _ehandles );
645
646
647private:
648
650 std::vector<Point> points_;
651
654
657
660
661 // ############################### Standard Property Handling #############################
662
663 // list of vertex properties
664 std::vector<Point> vnormals_;
665 std::vector<Point> vbinormals_;
666 std::vector<Point> vcolors_;
667 std::vector<Scalar> vscalars_;
668 std::vector<unsigned char> vselections_;
669 std::vector<int> vvhandles_;
670 std::vector<int> vehandles_;
671 std::vector<int> vfhandles_;
672
673 std::vector<Point> enormals_;
674 std::vector<Point> ecolors_;
675 std::vector<Scalar> escalars_;
676 std::vector<unsigned char> eselections_;
677 std::vector<Point> epreimage_direction_;
678
679
680 // property reference counter
681 unsigned int ref_count_vnormals_;
682 unsigned int ref_count_vbinormals_;
683 unsigned int ref_count_vcolors_;
684 unsigned int ref_count_vscalars_;
685 unsigned int ref_count_vselections_;
686 unsigned int ref_count_vvhandles_;
687 unsigned int ref_count_vehandles_;
688 unsigned int ref_count_vfhandles_;
689
690 unsigned int ref_count_enormals_;
691 unsigned int ref_count_ecolors_;
692 unsigned int ref_count_escalars_;
693 unsigned int ref_count_eselections_;
694 unsigned int ref_count_epreimage_direction_;
695
696
697 // ############################### Custom Property Handling #############################
698
700 {
701 std::string name;
702 int ref_count;
703
704 // size in bytes of one property element
705 unsigned int prop_size;
706
707 // property data in byte array
708 std::vector<char> prop_data;
709
710 // data type (GL_FLOAT, GL_DOUBLE, GL_UNSIGNED_BYTE...)
711 unsigned int datatype;
712
713 // input name in vertex shader
714 std::string shader_binding;
715
716 char* buffer() {return prop_data.empty() ? 0 : &prop_data[0];}
717 const char* buffer() const {return prop_data.empty() ? 0 : &prop_data[0];}
718 };
719
720 typedef std::map< std::string, CustomProperty* > CustomPropertyMap;
721
722 CustomProperty* custom_prop(CustomPropertyHandle _handle);
723 const CustomProperty* custom_prop(CustomPropertyHandle _handle) const;
724
725 CustomPropertyHandle custom_prop_handle(const CustomProperty*) const;
726
727 // map from property name to property data
728 CustomPropertyMap custom_properties;
729
730 // vector of all properties for easier enumeration
731 std::vector<CustomProperty*> cprop_enum;
732};
733
734
735//=============================================================================
736} // namespace ACG
737//=============================================================================
738#if defined(INCLUDE_TEMPLATES) && !defined(ACG_POLYLINET_C)
739#define ACG_POLYLINET_TEMPLATES
740#include "PolyLineT_impl.hh"
741#endif
742
743#ifdef EXTENDED_POLY_LINE
744 #if defined(INCLUDE_TEMPLATES) && !defined(ACG_POLYLINE_INTEGRATIONT_C)
745 #define ACG_POLYLINE_INTEGRATIONT_TEMPLATES
746 #include <libs/MeshIntegration/PolyLineIntegrationT.cc>
747 #endif
748#endif
749
750
751//=============================================================================
752#endif // ACG_POLYLINET_HH defined
753//=============================================================================
754
size_t n_vertices() const
Get number of vertices.
Definition PolyLineT.hh:119
void split_closed(unsigned int _split_idx)
Split closed polyline at vertex with index _split_idx.
Scalar edge_radius_
cylinder-radius of edges
Definition PolyLineT.hh:659
void smooth_uniform_laplace()
Laplacian smoothing.
void insert_point(int _idx, const Point &_p)
insert _p at _idx into polyline
bool on_multiple_components(MeshT &_mesh, SpatialSearchT &_ssearch)
Point edge_vector(unsigned int _i) const
get the i-th oriented edge vector
Definition PolyLineT.hh:169
void set_closed(const bool _c)
Set if the polyline should be closed and therefore forms a loop.
Definition PolyLineT.hh:116
void bind_custom_property_to_shader(CustomPropertyHandle _property_handle, const std::string &_shader_input_name, unsigned int _datatype)
Binding to vertex shader (optional)
void print() const
Print information string to cerr.
void mark_components(OpenMesh::PropertyManager< OpenMesh::FPropHandleT< unsigned int >, MeshT > &component)
Point position_arclength(const Scalar _t) const
Same as position but with an arclength parameterization in [0,length()].
LineNodeT * get_line_node(LineNodeT *&_line_node, int _mode=0)
Conversion PolyLine <-> LineNode.
Point & front()
Get first point of the polyline ( no range check!!!)
Definition PolyLineT.hh:157
void remove_subsequent_identical_points(const bool _keep_edge_vertices=false, const double _epsilon=1e-6)
remove points which are subsequent and lie at the same position
Point & point(unsigned int _i)
Get a point of the polyline.
Definition PolyLineT.hh:145
Point find_nearest_point(const MeshT &_mesh, const Point &_point, typename MeshT::FaceHandle &_fh, SpatialSearchT *_ssearch=0, double *_dbest=0)
unsigned int component_of(const OpenMesh::PropertyManager< OpenMesh::FPropHandleT< unsigned int >, MeshT > &component, const PointT &pt, SpatialSearchT &_ssearch)
bool get_custom_property_shader_binding(CustomPropertyHandle _property_handle, unsigned int *_propsize, const char **_input_name, unsigned int *_datatype) const
Get shader binding information.
Scalar vertex_radius() const
get ball-radius of vertices
Definition PolyLineT.hh:345
Point position(const Scalar _t) const
Provide linear paremterization of the polyline in [0,1].
std::vector< Point > & points()
Get all points of the polyline.
Definition PolyLineT.hh:151
size_t n_edges() const
Get number of edges.
void set_vertex_radius(const Scalar _r)
set ball-radius of vertices
Definition PolyLineT.hh:348
Scalar edge_radius() const
get cylinder-radius of edges
Definition PolyLineT.hh:351
void resample_arclength_uniform(const unsigned int _n)
Perform an uniform arclength resampling while maintaining the start and end point.
~PolyLineT()
Destructor.
Definition PolyLineT.hh:102
PolyLineT & operator=(const PolyLineT &)=default
Use the default = operator.
const Point & front() const
Get first point of the polyline ( no range check!!!)
Definition PolyLineT.hh:160
void delete_point(int _idx)
Delete point at _idx.
void resize(unsigned int _n)
Resize current polyline.
void collapse(Scalar _smallest)
Collapse polyline.
void set_edge_radius(const Scalar _r)
set cylinder-radius of edges
Definition PolyLineT.hh:354
void smooth_uniform_laplace2()
Squared laplacian smoothing.
void prepend(const PolyLineT< PointT > &_pl)
Prepend second polyline _pl to polyline.
void invert()
Invert polyline that first vertex becomes last.
void project_to_mesh(const MeshT &_mesh, SpatialSearchT *_ssearch=0)
Project polyline points to nearest surface points (use spatial search!!!)
bool closed_
Connect first and last point?
Definition PolyLineT.hh:653
const Point & back() const
Get last point of the polyline ( no range check!!!)
Definition PolyLineT.hh:166
void smooth_uniform_laplace3()
Cubic laplacian smoothing.
const std::vector< Point > & points() const
Get all points of the polyline.
Definition PolyLineT.hh:154
void subdivide(Scalar _largest)
Subdivide polyline.
bool is_closed() const
Check if the polyline is marked as closed.
Definition PolyLineT.hh:110
void split(unsigned int _split_idx, PolyLineT< PointT > &_new_pl)
Split closed polyline at vertex with index _split_idx.
const Point & point(unsigned int _i) const
Get a point of the polyline.
Definition PolyLineT.hh:148
Scalar length() const
Compute the length of the polyline (in future cached method)
void clear()
Clear the current polyline.
void set_line_node(LineNodeT *&_line_node, int _mode=0)
Takes a line node and sets the points of this polyline to the points of the node.
std::vector< Point > points_
List of points in the polyline.
Definition PolyLineT.hh:650
Scalar vertex_radius_
ball-radius of vertices
Definition PolyLineT.hh:656
void set_to_circle(const PointT _center, const PointT _normal, double _radius, unsigned int _n_samples=100)
creating a circle with center _center and radius _radius lying in tangent plane specified by _normal
void add_point(const Point &_p)
Append a point to the polyline.
bool plane_line_intersection(const IPoint &_p_plane, const IPoint &_n_plane, const IPoint &_p0, const IPoint &_p1, IPoint &_p_int)
Scalar total_gaussian_curvature()
compute total gaussian curvature of enclosed surface (via Gauss-Bonnet)
void append(const PolyLineT< PointT > &_pl)
Append second polyline _pl to this one.
void split_into_one_per_component(MeshT &_mesh, SpatialSearchT &_ssearch, std::vector< PolyLineT > &out_polylines)
Point & back()
Get last point of the polyline ( no range check!!!)
Definition PolyLineT.hh:163
Namespace providing different geometric functions concerning angles.