Developer Documentation
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  * $Revision$ *
45  * $Author$ *
46  * $Date$ *
47  * *
48 \*===========================================================================*/
49 
50 
51 //=============================================================================
52 //
53 // CLASS PolyLineT
54 //
55 // Author: David Bommes <bommes@cs.rwth-aachen.de>
56 //
57 //=============================================================================
58 
59 
60 #ifndef ACG_POLYLINET_HH
61 #define ACG_POLYLINET_HH
62 
63 
64 //== INCLUDES =================================================================
65 #include <vector>
66 #include <iostream>
67 #include <ACG/Config/ACGDefines.hh>
68 #include <OpenMesh/Core/Utils/PropertyManager.hh>
69 #include <OpenMesh/Core/Utils/Property.hh>
70 
71 //== FORWARDDECLARATIONS ======================================================
72 
73 //== NAMESPACES ===============================================================
74 
75 namespace ACG {
76 
77 //== CLASS DEFINITION =========================================================
78 
79 
80 
81 
89 template <class PointT>
90 class PolyLineT
91 {
92 public:
93 
94  // internal relevant Types
95  typedef PointT Point;
96  typedef typename Point::value_type Scalar;
97 
99  PolyLineT(bool _closed = false );
100 
102  PolyLineT(const PolyLineT& _line);
103 
106 
113  bool is_closed() const { return closed_;}
114 
119  void set_closed(const bool _c) { closed_ = _c;}
120 
122  size_t n_vertices() const { return points_.size(); }
123 
125  size_t n_edges() const;
126 
128  void clear();
129 
131  void resize( unsigned int _n);
132 
134  void add_point(const Point& _p);
135 
141  void insert_point(int _idx, const Point& _p);
142 
144  void delete_point(int _idx);
145 
146 
148  Point& point(unsigned int _i) { return points_[_i];}
149 
151  const Point& point(unsigned int _i) const { return points_[_i];}
152 
154  std::vector<Point>& points() { return points_;}
155 
157  const std::vector<Point>& points() const { return points_;}
158 
160  Point& front() { return points_.front();}
161 
163  const Point& front() const { return points_.front();}
164 
166  Point& back() { return points_.back();}
167 
169  const Point& back() const { return points_.back();}
170 
172  Point edge_vector(unsigned int _i) const
173  { return(point((_i+1)%n_vertices())-point(_i));}
174 
179  Scalar length() const;
180 
187  Point position(const Scalar _t) const;
188 
197  Point position_arclength(const Scalar _t) const;
198 
206  void resample_arclength_uniform(const unsigned int _n);
207 
214  void subdivide( Scalar _largest );
215 
222  void collapse ( Scalar _smallest );
223 
225  void invert();
226 
228  void append(const PolyLineT<PointT>& _pl);
229 
231  void prepend(const PolyLineT<PointT>& _pl);
232 
237  void split_closed( unsigned int _split_idx);
238 
244  void split( unsigned int _split_idx, PolyLineT<PointT>& _new_pl);
245 
251  void remove_subsequent_identical_points( const bool _keep_edge_vertices = false, const double _epsilon = 1e-6 );
252 
254  void smooth_uniform_laplace();
255 
258 
261 
262 
264  void set_to_circle(const PointT _center, const PointT _normal, double _radius, unsigned int _n_samples = 100);
265 
273  template <class MeshT, class SpatialSearchT>
274  void project_to_mesh( const MeshT& _mesh,
275  SpatialSearchT* _ssearch = 0);
276 
287  template <class MeshT, class SpatialSearchT>
288  void project_to_mesh( const std::vector<MeshT*>& _mesh,
289  std::vector<SpatialSearchT*>* _ssearch = 0);
290 
295  template <class MeshT, class SpatialSearchT>
296  bool on_multiple_components(MeshT &_mesh,
297  SpatialSearchT &_ssearch);
298 
305  template <class MeshT, class SpatialSearchT>
306  void split_into_one_per_component(MeshT &_mesh,
307  SpatialSearchT &_ssearch,
308  std::vector<PolyLineT> &out_polylines);
309 
310  // This Block is used to pull in extended PolyLine features such as integration of
311  // a PolyLine into a Mesh. Currently this code is not included in the free version.
312  #ifdef EXTENDED_POLY_LINE
313  #include <libs/MeshIntegration/PolyLineIntegrationT.hh>
314  #endif
315 
316 
323  Scalar total_gaussian_curvature();
324 
333  template <class LineNodeT>
334  LineNodeT* get_line_node( LineNodeT*& _line_node, int _mode = 0);
335 
341  template <class LineNodeT>
342  void set_line_node( LineNodeT*& _line_node, int _mode = 0);
343 
345  void print() const;
346 
348  Scalar vertex_radius() const { return vertex_radius_;}
349 
351  void set_vertex_radius(const Scalar _r) { vertex_radius_ = _r;}
352 
354  Scalar edge_radius() const { return edge_radius_;}
355 
357  void set_edge_radius(const Scalar _r) { edge_radius_ = _r;}
358 
359 
360  // ############################### Standard Property Handling #############################
361 
362  // request properties
363  void request_vertex_normals() { request_prop( ref_count_vnormals_ , vnormals_);}
364  void request_vertex_binormals() { request_prop( ref_count_vbinormals_ , vbinormals_);}
365  void request_vertex_colors() { request_prop( ref_count_vcolors_ , vcolors_ );}
366  void request_vertex_scalars() { request_prop( ref_count_vscalars_ , vscalars_);}
367  void request_vertex_selections() { request_prop( ref_count_vselections_, vselections_);}
368  void request_vertex_vhandles() { request_prop( ref_count_vvhandles_ , vvhandles_);}
369  void request_vertex_ehandles() { request_prop( ref_count_vehandles_ , vehandles_);}
370  void request_vertex_fhandles() { request_prop( ref_count_vfhandles_ , vfhandles_);}
371 
372  void request_edge_normals() { request_prop( ref_count_enormals_ , enormals_);}
373  void request_edge_colors() { request_prop( ref_count_ecolors_ , ecolors_ );}
374  void request_edge_scalars() { request_prop( ref_count_escalars_ , escalars_);}
375  void request_edge_selections() { request_prop( ref_count_eselections_, eselections_);}
376  void request_preimage_directions() { request_prop( ref_count_epreimage_direction_, epreimage_direction_);}
377 
378  // release properties
379  void release_vertex_normals() { release_prop( ref_count_vnormals_ , vnormals_);}
380  void release_vertex_binormals() { release_prop( ref_count_vbinormals_ , vbinormals_);}
381  void release_vertex_colors() { release_prop( ref_count_vcolors_ , vcolors_ );}
382  void release_vertex_scalars() { release_prop( ref_count_vscalars_ , vscalars_);}
383  void release_vertex_selections() { release_prop( ref_count_vselections_, vselections_);}
384  void release_vertex_vhandles() { release_prop( ref_count_vvhandles_ , vvhandles_);}
385  void release_vertex_ehandles() { release_prop( ref_count_vehandles_ , vehandles_);}
386  void release_vertex_fhandles() { release_prop( ref_count_vfhandles_ , vfhandles_);}
387 
388  void release_edge_normals() { release_prop( ref_count_enormals_ , enormals_);}
389  void release_edge_colors() { release_prop( ref_count_ecolors_ , ecolors_ );}
390  void release_edge_scalars() { release_prop( ref_count_escalars_ , escalars_);}
391  void release_edge_selections() { release_prop( ref_count_eselections_, eselections_);}
392  void release_preimage_directions() { release_prop( ref_count_epreimage_direction_, epreimage_direction_);}
393 
394  // property availability
395  bool vertex_normals_available() const {return (ref_count_vnormals_ != 0 ); }
396  bool vertex_binormals_available() const {return (ref_count_vbinormals_ != 0 ); }
397  bool vertex_colors_available() const {return (ref_count_vcolors_ != 0 ); }
398  bool vertex_scalars_available() const {return (ref_count_vscalars_ != 0 ); }
399  bool vertex_selections_available() const {return (ref_count_vselections_ != 0 ); }
400  bool vertex_vhandles_available() const {return (ref_count_vvhandles_ != 0 ); }
401  bool vertex_ehandles_available() const {return (ref_count_vehandles_ != 0 ); }
402  bool vertex_fhandles_available() const {return (ref_count_vfhandles_ != 0 ); }
403 
404  bool edge_normals_available() const {return (ref_count_enormals_ != 0 ); }
405  bool edge_colors_available() const {return (ref_count_ecolors_ != 0 ); }
406  bool edge_scalars_available() const {return (ref_count_escalars_ != 0 ); }
407  bool edge_selections_available() const {return (ref_count_eselections_ != 0 ); }
408  bool edge_preimage_directions_available() const {return (ref_count_epreimage_direction_ != 0 ); }
409 
410  // property access ( no range or availability check! )
411  Point& vertex_normal(unsigned int _i) { return vnormals_[_i];}
412  const Point& vertex_normal(unsigned int _i) const { return vnormals_[_i];}
413 
414  Point& vertex_binormal(unsigned int _i) { return vbinormals_[_i];}
415  const Point& vertex_binormal(unsigned int _i) const { return vbinormals_[_i];}
416 
417  Point & vertex_color(unsigned int _i) { return vcolors_[_i];}
418  const Point & vertex_color(unsigned int _i) const { return vcolors_[_i];}
419 
420  Scalar& vertex_scalar(unsigned int _i) { return vscalars_[_i];}
421  const Scalar& vertex_scalar(unsigned int _i) const { return vscalars_[_i];}
422 
423  unsigned char& vertex_selection(unsigned int _i) {return vselections_[_i];}
424  const unsigned char& vertex_selection(unsigned int _i) const {return vselections_[_i];}
425 
426  int& vertex_vhandle(unsigned int _i) {return vvhandles_[_i];}
427  const int& vertex_vhandle(unsigned int _i) const {return vvhandles_[_i];}
428 
429  int& vertex_ehandle(unsigned int _i) {return vehandles_[_i];}
430  const int& vertex_ehandle(unsigned int _i) const {return vehandles_[_i];}
431 
432  int& vertex_fhandle(unsigned int _i) {return vfhandles_[_i];}
433  const int& vertex_fhandle(unsigned int _i) const {return vfhandles_[_i];}
434 
435  Point& edge_normal(unsigned int _i) { return enormals_[_i];}
436  const Point& edge_normal(unsigned int _i) const { return enormals_[_i];}
437 
438  Point & edge_color(unsigned int _i) { return ecolors_[_i];}
439  const Point & edge_color(unsigned int _i) const { return ecolors_[_i];}
440 
441  Scalar& edge_scalar(unsigned int _i) { return escalars_[_i];}
442  const Scalar& edge_scalar(unsigned int _i) const { return escalars_[_i];}
443 
444  unsigned char& edge_selection(unsigned int _i) {return eselections_[_i];}
445  const unsigned char& edge_selection(unsigned int _i) const {return eselections_[_i];}
446 
447  Point & preimage_direction(unsigned int _i) { return epreimage_direction_[_i];}
448  const Point & preimage_direction(unsigned int _i) const { return epreimage_direction_[_i];}
449 
450 
451  // ############################### Custom Property Handling #############################
452 
453  /*
454  A custom property is identified by its name and requires the size in bytes of one property element (example: float3 prop has size 12).
455  PolyLine allocates an internal buffer for properties, so no buffer management is required.
456  On resize/add_point, custom properties of the newly inserted vertices are filled with 0.
457  Optionally, it is possible to use properties in vertex shaders by defining a shader binding.
458  If rendered via PolyLineNode, these properties are then automatically available in vertex shaders (no additional management required).
459  However, it is still necessary to trigger a vbo update function whenever data of properties is changed.
460 
461 
462  Example: add float3 data to each vertex and use these in a vertex shader
463 
464  // request new property with name "myCustomData", that stores 3 * sizeof(float) = 12 bytes
465  PolyLine::CustomPropertyHandle myPropHandle = line->request_custom_property("myCustomData", 12);
466 
467  // bind property to a vertex shader as input id "a2v_UserData" with coordinates of type GL_FLOAT
468  line->bind_custom_property_to_shader(myPropHandle, "a2v_UserData", GL_FLOAT);
469 
470  // set property data
471  for each vertex i:
472  Vec3f x = computeCustomData(i);
473 
474  line->set_custom_property(myPropHandle, x.data());
475 
476  // trigger vbo update in rendering node of the polyline (ie. PolyLineNode)
477  lineNode->update();
478 
479 
480 
481  these vertex properties are then available in any vertex shader used to render the polyline:
482 
483  in vec3 a2v_UserData;
484 
485  void main()
486  {
487  ...
488  }
489  */
490 
491  typedef int CustomPropertyHandle;
492 
493  // request properties, returns handle of custom property
494  CustomPropertyHandle request_custom_property(const std::string& _name, unsigned int _prop_size);
495 
496  // release properties
497  void release_custom_property(const std::string& _name);
498  void release_custom_property(CustomPropertyHandle _prop_handle);
499 
500  // property availability
501  bool custom_property_available(CustomPropertyHandle _property_handle) const;
502  bool custom_property_available(const std::string& _name) const;
503 
504  // property access by handle (byte-wise)
505  void set_custom_property(CustomPropertyHandle _property_handle, unsigned int _vertex, const void* _data);
506  void get_custom_property(CustomPropertyHandle _property_handle, unsigned int _vertex, void* _dst) const;
507 
508  // property access by name (byte-wise), (slower than by handle)
509  void set_custom_property(const std::string& _name, unsigned int _vertex, const void* _data);
510  void get_custom_property(const std::string& _name, unsigned int _vertex, void* _dst) const;
511 
512 
523  void bind_custom_property_to_shader(CustomPropertyHandle _property_handle, const std::string& _shader_input_name, unsigned int _datatype);
524 
535  bool get_custom_property_shader_binding(CustomPropertyHandle _property_handle, unsigned int* _propsize, const char** _input_name, unsigned int* _datatype) const;
536 
537  // helper functions:
538 
539  // get property handle by name, returns 0 if unavailable
540  CustomPropertyHandle get_custom_property_handle(const std::string& _name) const;
541 
542  // get name of property by handle
543  const std::string get_custom_property_name(CustomPropertyHandle _property_handle) const;
544 
545  // get number of custom properties
546  unsigned int get_num_custom_properties() const;
547 
548  // get pointer to buffer that stores property data for all vertices
549  const void* get_custom_property_buffer(CustomPropertyHandle _property_handle) const;
550 
551 
552  // enumerate custom property handles via indices in range [0, get_num_custom_properties() - 1]
553  CustomPropertyHandle enumerate_custom_property_handles(unsigned int _i) const;
554 
555 
556  // ############################### SelectionWrappers ############################
557 
558  bool vertex_selected(unsigned int _i) { return (_i < vselections_.size() ? vertex_selection(_i) == 1 : false); }
559  bool edge_selected(unsigned int _i) { return (_i < eselections_.size() ? edge_selection(_i) == 1 : false); }
560 
561  void select_vertex(unsigned int _i) { if(_i < vselections_.size()) vertex_selection(_i) = 1; }
562  void select_edge(unsigned int _i) { if(_i < eselections_.size()) edge_selection(_i) = 1; }
563 
564  void deselect_vertex(unsigned int _i) { if(_i < vselections_.size()) vertex_selection(_i) = 0; }
565  void deselect_edge(unsigned int _i) { if(_i < eselections_.size()) edge_selection(_i) = 0; }
566 
567 
568  // ############################### Helper Functions #############################
569 
570  // copy this[_j] = _pl[_i] WITH all vertex properties
571  void copy_vertex_complete(const PolyLineT<PointT>& _pl, unsigned int _i, unsigned int _j);
572 
573 
574  // copy this[_j] = _pl[_i] WITH all edge properties
575  void copy_edge_complete(const PolyLineT<PointT>& _pl, unsigned int _i, unsigned int _j);
576 
577 private:
578 
588  template <class MeshT, class SpatialSearchT>
589  Point find_nearest_point( const MeshT& _mesh,
590  const Point& _point,
591  typename MeshT::FaceHandle &_fh,
592  SpatialSearchT * _ssearch = 0,
593  double* _dbest = 0);
594 
600  template<class MeshT, class SpatialSearchT>
601  unsigned int component_of(
604  MeshT> &component,
605  const PointT &pt,
606  SpatialSearchT &_ssearch);
607 
612  template <class MeshT>
613  void mark_components(
616  MeshT> &component);
617 
618 
619  template <class PropT>
620  void request_prop( unsigned int& _ref_count, PropT& _prop);
621  template <class PropT>
622  void release_prop( unsigned int& _ref_count, PropT& _prop);
623 
633  template <class IPoint>
634  bool plane_line_intersection( const IPoint& _p_plane,
635  const IPoint& _n_plane,
636  const IPoint& _p0,
637  const IPoint& _p1,
638  IPoint& _p_int);
639 
640  template<class MeshT>
641  void edge_points_in_segment( const MeshT& _mesh,
642  const Point& _p0,
643  const Point& _p1,
644  const typename MeshT::FaceHandle _fh0,
645  const typename MeshT::FaceHandle _fh1,
646  std::vector<Point> & _points,
647  std::vector<typename MeshT::EdgeHandle>& _ehandles );
648 
649 
650 private:
651 
653  std::vector<Point> points_;
654 
656  bool closed_;
657 
660 
662  Scalar edge_radius_;
663 
664  // ############################### Standard Property Handling #############################
665 
666  // list of vertex properties
667  std::vector<Point> vnormals_;
668  std::vector<Point> vbinormals_;
669  std::vector<Point> vcolors_;
670  std::vector<Scalar> vscalars_;
671  std::vector<unsigned char> vselections_;
672  std::vector<int> vvhandles_;
673  std::vector<int> vehandles_;
674  std::vector<int> vfhandles_;
675 
676  std::vector<Point> enormals_;
677  std::vector<Point> ecolors_;
678  std::vector<Scalar> escalars_;
679  std::vector<unsigned char> eselections_;
680  std::vector<Point> epreimage_direction_;
681 
682 
683  // property reference counter
684  unsigned int ref_count_vnormals_;
685  unsigned int ref_count_vbinormals_;
686  unsigned int ref_count_vcolors_;
687  unsigned int ref_count_vscalars_;
688  unsigned int ref_count_vselections_;
689  unsigned int ref_count_vvhandles_;
690  unsigned int ref_count_vehandles_;
691  unsigned int ref_count_vfhandles_;
692 
693  unsigned int ref_count_enormals_;
694  unsigned int ref_count_ecolors_;
695  unsigned int ref_count_escalars_;
696  unsigned int ref_count_eselections_;
697  unsigned int ref_count_epreimage_direction_;
698 
699 
700  // ############################### Custom Property Handling #############################
701 
703  {
704  std::string name;
705  int ref_count;
706 
707  // size in bytes of one property element
708  unsigned int prop_size;
709 
710  // property data in byte array
711  std::vector<char> prop_data;
712 
713  // data type (GL_FLOAT, GL_DOUBLE, GL_UNSIGNED_BYTE...)
714  unsigned int datatype;
715 
716  // input name in vertex shader
717  std::string shader_binding;
718 
719  char* buffer() {return prop_data.empty() ? 0 : &prop_data[0];}
720  const char* buffer() const {return prop_data.empty() ? 0 : &prop_data[0];}
721  };
722 
723  typedef std::map< std::string, CustomProperty* > CustomPropertyMap;
724 
725  CustomProperty* custom_prop(CustomPropertyHandle _handle);
726  const CustomProperty* custom_prop(CustomPropertyHandle _handle) const;
727 
728  CustomPropertyHandle custom_prop_handle(const CustomProperty*) const;
729 
730  // map from property name to property data
731  CustomPropertyMap custom_properties;
732 
733  // vector of all properties for easier enumeration
734  std::vector<CustomProperty*> cprop_enum;
735 };
736 
737 
738 //=============================================================================
739 } // namespace ACG
740 //=============================================================================
741 #if defined(INCLUDE_TEMPLATES) && !defined(ACG_POLYLINET_C)
742 #define ACG_POLYLINET_TEMPLATES
743 #include "PolyLineT.cc"
744 #endif
745 
746 #ifdef EXTENDED_POLY_LINE
747  #if defined(INCLUDE_TEMPLATES) && !defined(ACG_POLYLINE_INTEGRATIONT_C)
748  #define ACG_POLYLINE_INTEGRATIONT_TEMPLATES
749  #include <libs/MeshIntegration/PolyLineIntegrationT.cc>
750  #endif
751 #endif
752 
753 
754 //=============================================================================
755 #endif // ACG_POLYLINET_HH defined
756 //=============================================================================
757 
bool plane_line_intersection(const IPoint &_p_plane, const IPoint &_n_plane, const IPoint &_p0, const IPoint &_p1, IPoint &_p_int)
Definition: PolyLineT.cc:1493
void mark_components(OpenMesh::PropertyManager< OpenMesh::FPropHandleT< unsigned int >, MeshT > &component)
Definition: PolyLineT.cc:1935
Point find_nearest_point(const MeshT &_mesh, const Point &_point, typename MeshT::FaceHandle &_fh, SpatialSearchT *_ssearch=0, double *_dbest=0)
Definition: PolyLineT.cc:1006
size_t n_edges() const
Get number of edges.
Definition: PolyLineT.cc:216
const Point & front() const
Get first point of the polyline ( no range check!!!)
Definition: PolyLineT.hh:163
LineNodeT * get_line_node(LineNodeT *&_line_node, int _mode=0)
Conversion PolyLine <-> LineNode.
Definition: PolyLineT.cc:1080
void append(const PolyLineT< PointT > &_pl)
Append second polyline _pl to this one.
Definition: PolyLineT.cc:1387
bool on_multiple_components(MeshT &_mesh, SpatialSearchT &_ssearch)
Definition: PolyLineT.cc:2005
void project_to_mesh(const MeshT &_mesh, SpatialSearchT *_ssearch=0)
Project polyline points to nearest surface points (use spatial search!!!)
Definition: PolyLineT.cc:937
void collapse(Scalar _smallest)
Collapse polyline.
Definition: PolyLineT.cc:672
void delete_point(int _idx)
Delete point at _idx.
Definition: PolyLineT.cc:417
Scalar vertex_radius() const
get ball-radius of vertices
Definition: PolyLineT.hh:348
void smooth_uniform_laplace2()
Squared laplacian smoothing.
Definition: PolyLineT.cc:792
PolyLineT(bool _closed=false)
Constructor.
Definition: PolyLineT.cc:97
void resample_arclength_uniform(const unsigned int _n)
Perform an uniform arclength resampling while maintaining the start and end point.
Definition: PolyLineT.cc:580
const Point & back() const
Get last point of the polyline ( no range check!!!)
Definition: PolyLineT.hh:169
Point & back()
Get last point of the polyline ( no range check!!!)
Definition: PolyLineT.hh:166
Scalar total_gaussian_curvature()
compute total gaussian curvature of enclosed surface (via Gauss-Bonnet)
Definition: PolyLineT.cc:1841
void invert()
Invert polyline that first vertex becomes last.
Definition: PolyLineT.cc:1357
bool closed_
Connect first and last point?
Definition: PolyLineT.hh:656
bool is_closed() const
Check if the polyline is marked as closed.
Definition: PolyLineT.hh:113
void set_closed(const bool _c)
Set if the polyline should be closed and therefore forms a loop.
Definition: PolyLineT.hh:119
~PolyLineT()
Destructor.
Definition: PolyLineT.hh:105
void clear()
Clear the current polyline.
Definition: PolyLineT.cc:187
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 ...
Definition: PolyLineT.cc:911
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. ...
Definition: PolyLineT.cc:1143
void set_vertex_radius(const Scalar _r)
set ball-radius of vertices
Definition: PolyLineT.hh:351
void resize(unsigned int _n)
Resize current polyline.
Definition: PolyLineT.cc:231
void prepend(const PolyLineT< PointT > &_pl)
Prepend second polyline _pl to polyline.
Definition: PolyLineT.cc:1416
void print() const
Print information string to cerr.
Definition: PolyLineT.cc:1193
void set_edge_radius(const Scalar _r)
set cylinder-radius of edges
Definition: PolyLineT.hh:357
void bind_custom_property_to_shader(CustomPropertyHandle _property_handle, const std::string &_shader_input_name, unsigned int _datatype)
Binding to vertex shader (optional)
Definition: PolyLineT.cc:2326
std::vector< Point > & points()
Get all points of the polyline.
Definition: PolyLineT.hh:154
void insert_point(int _idx, const Point &_p)
insert _p at _idx into polyline
Definition: PolyLineT.cc:352
void smooth_uniform_laplace3()
Cubic laplacian smoothing.
Definition: PolyLineT.cc:849
Point edge_vector(unsigned int _i) const
get the i-th oriented edge vector
Definition: PolyLineT.hh:172
Scalar edge_radius() const
get cylinder-radius of edges
Definition: PolyLineT.hh:354
void subdivide(Scalar _largest)
Subdivide polyline.
Definition: PolyLineT.cc:619
void split(unsigned int _split_idx, PolyLineT< PointT > &_new_pl)
Split closed polyline at vertex with index _split_idx.
Definition: PolyLineT.cc:1463
Point & point(unsigned int _i)
Get a point of the polyline.
Definition: PolyLineT.hh:148
std::vector< Point > points_
List of points in the polyline.
Definition: PolyLineT.hh:653
Namespace providing different geometric functions concerning angles.
Definition: DBSCANT.cc:51
Scalar length() const
Compute the length of the polyline (in future cached method)
Definition: PolyLineT.cc:484
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
Definition: PolyLineT.cc:1759
void add_point(const Point &_p)
Append a point to the polyline.
Definition: PolyLineT.cc:288
bool get_custom_property_shader_binding(CustomPropertyHandle _property_handle, unsigned int *_propsize, const char **_input_name, unsigned int *_datatype) const
Get shader binding information.
Definition: PolyLineT.cc:2342
unsigned int component_of(const OpenMesh::PropertyManager< OpenMesh::FPropHandleT< unsigned int >, MeshT > &component, const PointT &pt, SpatialSearchT &_ssearch)
Definition: PolyLineT.cc:1987
Scalar vertex_radius_
ball-radius of vertices
Definition: PolyLineT.hh:659
Point & front()
Get first point of the polyline ( no range check!!!)
Definition: PolyLineT.hh:160
Scalar edge_radius_
cylinder-radius of edges
Definition: PolyLineT.hh:662
void smooth_uniform_laplace()
Laplacian smoothing.
Definition: PolyLineT.cc:738
const Point & point(unsigned int _i) const
Get a point of the polyline.
Definition: PolyLineT.hh:151
Point position(const Scalar _t) const
Provide linear paremterization of the polyline in [0,1].
Definition: PolyLineT.cc:515
void split_into_one_per_component(MeshT &_mesh, SpatialSearchT &_ssearch, std::vector< PolyLineT > &out_polylines)
Definition: PolyLineT.cc:2034
size_t n_vertices() const
Get number of vertices.
Definition: PolyLineT.hh:122
Point position_arclength(const Scalar _t) const
Same as position but with an arclength parameterization in [0,length()].
Definition: PolyLineT.cc:528
void split_closed(unsigned int _split_idx)
Split closed polyline at vertex with index _split_idx.
Definition: PolyLineT.cc:1431
const std::vector< Point > & points() const
Get all points of the polyline.
Definition: PolyLineT.hh:157