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
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
69 namespace ACG {
70
71 //== CLASS DEFINITION =========================================================
72
73
74
75
83 template <class PointT>
84 class PolyLineT
85 {
86 public:
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() {clear();}
100
107 bool is_closed() const { return closed_;}
108
113 void set_closed(const bool _c) { closed_ = _c;}
114
116 size_t n_vertices() const { return points_.size(); }
117
119 size_t n_edges() const;
120
122 void clear();
123
125 void resize( unsigned int _n);
126
128 void add_point(const Point& _p);
129
135 void insert_point(int _idx, const Point& _p);
136
138 void delete_point(int _idx);
139
140
142 Point& point(unsigned int _i) { return points_[_i];}
143
145 const Point& point(unsigned int _i) const { return points_[_i];}
146
148 std::vector<Point>& points() { return points_;}
149
151 const std::vector<Point>& points() const { return points_;}
152
154 Point& front() { return points_.front();}
155
157 const Point& front() const { return points_.front();}
158
160 Point& back() { return points_.back();}
161
163 const Point& back() const { return points_.back();}
164
166 Point edge_vector(unsigned int _i) const
167 { return(point((_i+1)%n_vertices())-point(_i));}
168
173 Scalar length() const;
174
181 Point position(const Scalar _t) const;
182
191 Point position_arclength(const Scalar _t) const;
192
200 void resample_arclength_uniform(const unsigned int _n);
201
208 void subdivide( Scalar _largest );
209
216 void collapse ( Scalar _smallest );
217
219 void invert();
220
222 void append(const PolyLineT<PointT>& _pl);
223
225 void prepend(const PolyLineT<PointT>& _pl);
226
231 void split_closed( unsigned int _split_idx);
232
238 void split( unsigned int _split_idx, PolyLineT<PointT>& _new_pl);
239
245 void remove_subsequent_identical_points( const bool _keep_edge_vertices = false, const double _epsilon = 1e-6 );
246
248 void smooth_uniform_laplace();
249
251 void smooth_uniform_laplace2();
252
254 void smooth_uniform_laplace3();
255
256
258 void set_to_circle(const PointT _center, const PointT _normal, double _radius, unsigned int _n_samples = 100);
259
267 template <class MeshT, class SpatialSearchT>
268 void project_to_mesh( const MeshT& _mesh,
269 SpatialSearchT* _ssearch = 0);
270
281 template <class MeshT, class SpatialSearchT>
282 void project_to_mesh( const std::vector<MeshT*>& _mesh,
283 std::vector<SpatialSearchT*>* _ssearch = 0);
284
289 template <class MeshT, class SpatialSearchT>
290 bool on_multiple_components(MeshT &_mesh,
291 SpatialSearchT &_ssearch);
292
299 template <class MeshT, class SpatialSearchT>
300 void split_into_one_per_component(MeshT &_mesh,
301 SpatialSearchT &_ssearch,
302 std::vector<PolyLineT> &out_polylines);
303
304 // This Block is used to pull in extended PolyLine features such as integration of
305 // a PolyLine into a Mesh. Currently this code is not included in the free version.
306 #ifdef EXTENDED_POLY_LINE
307 #include <libs/MeshIntegration/PolyLineIntegrationT.hh>
308 #endif
309
310
317 Scalar total_gaussian_curvature();
318
327 template <class LineNodeT>
328 LineNodeT* get_line_node( LineNodeT*& _line_node, int _mode = 0);
329
335 template <class LineNodeT>
336 void set_line_node( LineNodeT*& _line_node, int _mode = 0);
337
339 void print() const;
340
342 Scalar vertex_radius() const { return vertex_radius_;}
343
345 void set_vertex_radius(const Scalar _r) { vertex_radius_ = _r;}
346
348 Scalar edge_radius() const { return edge_radius_;}
349
351 void set_edge_radius(const Scalar _r) { edge_radius_ = _r;}
352
353
354 // ############################### Standard Property Handling #############################
355
356 // request properties
357 void request_vertex_normals() { request_prop( ref_count_vnormals_ , vnormals_);}
358 void request_vertex_binormals() { request_prop( ref_count_vbinormals_ , vbinormals_);}
359 void request_vertex_colors() { request_prop( ref_count_vcolors_ , vcolors_ );}
360 void request_vertex_scalars() { request_prop( ref_count_vscalars_ , vscalars_);}
361 void request_vertex_selections() { request_prop( ref_count_vselections_, vselections_);}
362 void request_vertex_vhandles() { request_prop( ref_count_vvhandles_ , vvhandles_);}
363 void request_vertex_ehandles() { request_prop( ref_count_vehandles_ , vehandles_);}
364 void request_vertex_fhandles() { request_prop( ref_count_vfhandles_ , vfhandles_);}
365
366 void request_edge_normals() { request_prop( ref_count_enormals_ , enormals_);}
367 void request_edge_colors() { request_prop( ref_count_ecolors_ , ecolors_ );}
368 void request_edge_scalars() { request_prop( ref_count_escalars_ , escalars_);}
369 void request_edge_selections() { request_prop( ref_count_eselections_, eselections_);}
370 void request_preimage_directions() { request_prop( ref_count_epreimage_direction_, epreimage_direction_);}
371
372 // release properties
373 void release_vertex_normals() { release_prop( ref_count_vnormals_ , vnormals_);}
374 void release_vertex_binormals() { release_prop( ref_count_vbinormals_ , vbinormals_);}
375 void release_vertex_colors() { release_prop( ref_count_vcolors_ , vcolors_ );}
376 void release_vertex_scalars() { release_prop( ref_count_vscalars_ , vscalars_);}
377 void release_vertex_selections() { release_prop( ref_count_vselections_, vselections_);}
378 void release_vertex_vhandles() { release_prop( ref_count_vvhandles_ , vvhandles_);}
379 void release_vertex_ehandles() { release_prop( ref_count_vehandles_ , vehandles_);}
380 void release_vertex_fhandles() { release_prop( ref_count_vfhandles_ , vfhandles_);}
381
382 void release_edge_normals() { release_prop( ref_count_enormals_ , enormals_);}
383 void release_edge_colors() { release_prop( ref_count_ecolors_ , ecolors_ );}
384 void release_edge_scalars() { release_prop( ref_count_escalars_ , escalars_);}
385 void release_edge_selections() { release_prop( ref_count_eselections_, eselections_);}
386 void release_preimage_directions() { release_prop( ref_count_epreimage_direction_, epreimage_direction_);}
387
388 // property availability
389 bool vertex_normals_available() const {return (ref_count_vnormals_ != 0 ); }
390 bool vertex_binormals_available() const {return (ref_count_vbinormals_ != 0 ); }
391 bool vertex_colors_available() const {return (ref_count_vcolors_ != 0 ); }
392 bool vertex_scalars_available() const {return (ref_count_vscalars_ != 0 ); }
393 bool vertex_selections_available() const {return (ref_count_vselections_ != 0 ); }
394 bool vertex_vhandles_available() const {return (ref_count_vvhandles_ != 0 ); }
395 bool vertex_ehandles_available() const {return (ref_count_vehandles_ != 0 ); }
396 bool vertex_fhandles_available() const {return (ref_count_vfhandles_ != 0 ); }
397
398 bool edge_normals_available() const {return (ref_count_enormals_ != 0 ); }
399 bool edge_colors_available() const {return (ref_count_ecolors_ != 0 ); }
400 bool edge_scalars_available() const {return (ref_count_escalars_ != 0 ); }
401 bool edge_selections_available() const {return (ref_count_eselections_ != 0 ); }
402 bool edge_preimage_directions_available() const {return (ref_count_epreimage_direction_ != 0 ); }
403
404 // property access ( no range or availability check! )
405 Point& vertex_normal(unsigned int _i) { return vnormals_[_i];}
406 const Point& vertex_normal(unsigned int _i) const { return vnormals_[_i];}
407
408 Point& vertex_binormal(unsigned int _i) { return vbinormals_[_i];}
409 const Point& vertex_binormal(unsigned int _i) const { return vbinormals_[_i];}
410
411 Point & vertex_color(unsigned int _i) { return vcolors_[_i];}
412 const Point & vertex_color(unsigned int _i) const { return vcolors_[_i];}
413
414 Scalar& vertex_scalar(unsigned int _i) { return vscalars_[_i];}
415 const Scalar& vertex_scalar(unsigned int _i) const { return vscalars_[_i];}
416
417 unsigned char& vertex_selection(unsigned int _i) {return vselections_[_i];}
418 const unsigned char& vertex_selection(unsigned int _i) const {return vselections_[_i];}
419
420 int& vertex_vhandle(unsigned int _i) {return vvhandles_[_i];}
421 const int& vertex_vhandle(unsigned int _i) const {return vvhandles_[_i];}
422
423 int& vertex_ehandle(unsigned int _i) {return vehandles_[_i];}
424 const int& vertex_ehandle(unsigned int _i) const {return vehandles_[_i];}
425
426 int& vertex_fhandle(unsigned int _i) {return vfhandles_[_i];}
427 const int& vertex_fhandle(unsigned int _i) const {return vfhandles_[_i];}
428
429 Point& edge_normal(unsigned int _i) { return enormals_[_i];}
430 const Point& edge_normal(unsigned int _i) const { return enormals_[_i];}
431
432 Point & edge_color(unsigned int _i) { return ecolors_[_i];}
433 const Point & edge_color(unsigned int _i) const { return ecolors_[_i];}
434
435 Scalar& edge_scalar(unsigned int _i) { return escalars_[_i];}
436 const Scalar& edge_scalar(unsigned int _i) const { return escalars_[_i];}
437
438 unsigned char& edge_selection(unsigned int _i) {return eselections_[_i];}
439 const unsigned char& edge_selection(unsigned int _i) const {return eselections_[_i];}
440
441 Point & preimage_direction(unsigned int _i) { return epreimage_direction_[_i];}
442 const Point & preimage_direction(unsigned int _i) const { return epreimage_direction_[_i];}
443
444
445 // ############################### Custom Property Handling #############################
446
447 /*
448 A custom property is identified by its name and requires the size in bytes of one property element (example: float3 prop has size 12).
449 PolyLine allocates an internal buffer for properties, so no buffer management is required.
450 On resize/add_point, custom properties of the newly inserted vertices are filled with 0.
451 Optionally, it is possible to use properties in vertex shaders by defining a shader binding.
452 If rendered via PolyLineNode, these properties are then automatically available in vertex shaders (no additional management required).
453 However, it is still necessary to trigger a vbo update function whenever data of properties is changed.
454
455
456 Example: add float3 data to each vertex and use these in a vertex shader
457
458 // request new property with name "myCustomData", that stores 3 * sizeof(float) = 12 bytes
459 PolyLine::CustomPropertyHandle myPropHandle = line->request_custom_property("myCustomData", 12);
460
461 // bind property to a vertex shader as input id "a2v_UserData" with coordinates of type GL_FLOAT
462 line->bind_custom_property_to_shader(myPropHandle, "a2v_UserData", GL_FLOAT);
463
464 // set property data
465 for each vertex i:
466 Vec3f x = computeCustomData(i);
467
468 line->set_custom_property(myPropHandle, x.data());
469
470 // trigger vbo update in rendering node of the polyline (ie. PolyLineNode)
471 lineNode->update();
472
473
474
475 these vertex properties are then available in any vertex shader used to render the polyline:
476
477 in vec3 a2v_UserData;
478
479 void main()
480 {
481 ...
482 }
483 */
484
485 typedef int CustomPropertyHandle;
486
487 // request properties, returns handle of custom property
488 CustomPropertyHandle request_custom_property(const std::string& _name, unsigned int _prop_size);
489
490 // release properties
491 void release_custom_property(const std::string& _name);
492 void release_custom_property(CustomPropertyHandle _prop_handle);
493
494 // property availability
495 bool custom_property_available(CustomPropertyHandle _property_handle) const;
496 bool custom_property_available(const std::string& _name) const;
497
498 // property access by handle (byte-wise)
499 void set_custom_property(CustomPropertyHandle _property_handle, unsigned int _vertex, const void* _data);
500 void get_custom_property(CustomPropertyHandle _property_handle, unsigned int _vertex, void* _dst) const;
501
502 // property access by name (byte-wise), (slower than by handle)
503 void set_custom_property(const std::string& _name, unsigned int _vertex, const void* _data);
504 void get_custom_property(const std::string& _name, unsigned int _vertex, void* _dst) const;
505
506
517 void bind_custom_property_to_shader(CustomPropertyHandle _property_handle, const std::string& _shader_input_name, unsigned int _datatype);
518
529 bool get_custom_property_shader_binding(CustomPropertyHandle _property_handle, unsigned int* _propsize, const char** _input_name, unsigned int* _datatype) const;
530
531 // helper functions:
532
533 // get property handle by name, returns 0 if unavailable
534 CustomPropertyHandle get_custom_property_handle(const std::string& _name) const;
535
536 // get name of property by handle
537 const std::string get_custom_property_name(CustomPropertyHandle _property_handle) const;
538
539 // get number of custom properties
540 unsigned int get_num_custom_properties() const;
541
542 // get pointer to buffer that stores property data for all vertices
543 const void* get_custom_property_buffer(CustomPropertyHandle _property_handle) const;
544
545
546 // enumerate custom property handles via indices in range [0, get_num_custom_properties() - 1]
547 CustomPropertyHandle enumerate_custom_property_handles(unsigned int _i) const;
548
549
550 // ############################### SelectionWrappers ############################
551
552 bool vertex_selected(unsigned int _i) { return (_i < vselections_.size() ? vertex_selection(_i) == 1 : false); }
553 bool edge_selected(unsigned int _i) { return (_i < eselections_.size() ? edge_selection(_i) == 1 : false); }
554
555 void select_vertex(unsigned int _i) { if(_i < vselections_.size()) vertex_selection(_i) = 1; }
556 void select_edge(unsigned int _i) { if(_i < eselections_.size()) edge_selection(_i) = 1; }
557
558 void deselect_vertex(unsigned int _i) { if(_i < vselections_.size()) vertex_selection(_i) = 0; }
559 void deselect_edge(unsigned int _i) { if(_i < eselections_.size()) edge_selection(_i) = 0; }
560
561
562 // ############################### Helper Functions #############################
563
564 // copy this[_j] = _pl[_i] WITH all vertex properties
565 void copy_vertex_complete(const PolyLineT<PointT>& _pl, unsigned int _i, unsigned int _j);
566
567
568 // copy this[_j] = _pl[_i] WITH all edge properties
569 void copy_edge_complete(const PolyLineT<PointT>& _pl, unsigned int _i, unsigned int _j);
570
571 private:
572
582 template <class MeshT, class SpatialSearchT>
583 Point find_nearest_point( const MeshT& _mesh,
584 const Point& _point,
585 typename MeshT::FaceHandle &_fh,
586 SpatialSearchT * _ssearch = 0,
587 double* _dbest = 0);
588
594 template<class MeshT, class SpatialSearchT>
595 unsigned int component_of(
596 const OpenMesh::PropertyManager<
597 OpenMesh::FPropHandleT<unsigned int>,
598 MeshT> &component,
599 const PointT &pt,
600 SpatialSearchT &_ssearch);
601
606 template <class MeshT>
607 void mark_components(
608 OpenMesh::PropertyManager<
609 OpenMesh::FPropHandleT<unsigned int>,
610 MeshT> &component);
611
612
613 template <class PropT>
614 void request_prop( unsigned int& _ref_count, PropT& _prop);
615 template <class PropT>
616 void release_prop( unsigned int& _ref_count, PropT& _prop);
617
627 template <class IPoint>
628 bool plane_line_intersection( const IPoint& _p_plane,
629 const IPoint& _n_plane,
630 const IPoint& _p0,
631 const IPoint& _p1,
632 IPoint& _p_int);
633
634 template<class MeshT>
635 void edge_points_in_segment( const MeshT& _mesh,
636 const Point& _p0,
637 const Point& _p1,
638 const typename MeshT::FaceHandle& _fh0,
639 const typename MeshT::FaceHandle& _fh1,
640 std::vector<Point> & _points,
641 std::vector<typename MeshT::EdgeHandle>& _ehandles );
642
643
644 private:
645
647 std::vector<Point> points_;
648
650 bool closed_;
651
653 Scalar vertex_radius_;
654
656 Scalar edge_radius_;
657
658 // ############################### Standard Property Handling #############################
659
660 // list of vertex properties
661 std::vector<Point> vnormals_;
662 std::vector<Point> vbinormals_;
663 std::vector<Point> vcolors_;
664 std::vector<Scalar> vscalars_;
665 std::vector<unsigned char> vselections_;
666 std::vector<int> vvhandles_;
667 std::vector<int> vehandles_;
668 std::vector<int> vfhandles_;
669
670 std::vector<Point> enormals_;
671 std::vector<Point> ecolors_;
672 std::vector<Scalar> escalars_;
673 std::vector<unsigned char> eselections_;
674 std::vector<Point> epreimage_direction_;
675
676
677 // property reference counter
678 unsigned int ref_count_vnormals_;
679 unsigned int ref_count_vbinormals_;
680 unsigned int ref_count_vcolors_;
681 unsigned int ref_count_vscalars_;
682 unsigned int ref_count_vselections_;
683 unsigned int ref_count_vvhandles_;
684 unsigned int ref_count_vehandles_;
685 unsigned int ref_count_vfhandles_;
686
687 unsigned int ref_count_enormals_;
688 unsigned int ref_count_ecolors_;
689 unsigned int ref_count_escalars_;
690 unsigned int ref_count_eselections_;
691 unsigned int ref_count_epreimage_direction_;
692
693
694 // ############################### Custom Property Handling #############################
695
696 struct CustomProperty
697 {
698 std::string name;
699 int ref_count;
700
701 // size in bytes of one property element
702 unsigned int prop_size;
703
704 // property data in byte array
705 std::vector<char> prop_data;
706
707 // data type (GL_FLOAT, GL_DOUBLE, GL_UNSIGNED_BYTE...)
708 unsigned int datatype;
709
710 // input name in vertex shader
711 std::string shader_binding;
712
713 char* buffer() {return prop_data.empty() ? 0 : &prop_data[0];}
714 const char* buffer() const {return prop_data.empty() ? 0 : &prop_data[0];}
715 };
716
717 typedef std::map< std::string, CustomProperty* > CustomPropertyMap;
718
719 CustomProperty* custom_prop(CustomPropertyHandle _handle);
720 const CustomProperty* custom_prop(CustomPropertyHandle _handle) const;
721
722 CustomPropertyHandle custom_prop_handle(const CustomProperty*) const;
723
724 // map from property name to property data
725 CustomPropertyMap custom_properties;
726
727 // vector of all properties for easier enumeration
728 std::vector<CustomProperty*> cprop_enum;
729 };
730
731
732 //=============================================================================
733 } // namespace ACG
734 //=============================================================================
735 #if defined(INCLUDE_TEMPLATES) && !defined(ACG_POLYLINET_C)
736 #define ACG_POLYLINET_TEMPLATES
737 #include "PolyLineT_impl.hh"
738 #endif
739
740 #ifdef EXTENDED_POLY_LINE
741 #if defined(INCLUDE_TEMPLATES) && !defined(ACG_POLYLINE_INTEGRATIONT_C)
742 #define ACG_POLYLINE_INTEGRATIONT_TEMPLATES
743 #include <libs/MeshIntegration/PolyLineIntegrationT.cc>
744 #endif
745 #endif
746
747
748 //=============================================================================
749 #endif // ACG_POLYLINET_HH defined
750 //=============================================================================
751
ACG::PolyLineT::back
const Point & back() const
Get last point of the polyline ( no range check!!!)
Definition: PolyLineT.hh:163
ACG::PolyLineT::point
const Point & point(unsigned int _i) const
Get a point of the polyline.
Definition: PolyLineT.hh:145
ACG::PolyLineT::points_
std::vector< Point > points_
List of points in the polyline.
Definition: PolyLineT.hh:647
ACG::PolyLineT::split_closed
void split_closed(unsigned int _split_idx)
Split closed polyline at vertex with index _split_idx.
Definition: PolyLineT_impl.hh:1426
ACG::PolyLineT::print
void print() const
Print information string to cerr.
Definition: PolyLineT_impl.hh:1188
ACG::PolyLineT::back
Point & back()
Get last point of the polyline ( no range check!!!)
Definition: PolyLineT.hh:160
ACG::PolyLineT::collapse
void collapse(Scalar _smallest)
Collapse polyline.
Definition: PolyLineT_impl.hh:667
ACG::PolyLineT::resize
void resize(unsigned int _n)
Resize current polyline.
Definition: PolyLineT_impl.hh:226
ACG::PolyLineT::smooth_uniform_laplace
void smooth_uniform_laplace()
Laplacian smoothing.
Definition: PolyLineT_impl.hh:733
ACG::PolyLineT::points
std::vector< Point > & points()
Get all points of the polyline.
Definition: PolyLineT.hh:148
ACG
Namespace providing different geometric functions concerning angles.
Definition: BaseObjectData.hh:68
ACG::PolyLineT::set_edge_radius
void set_edge_radius(const Scalar _r)
set cylinder-radius of edges
Definition: PolyLineT.hh:351
ACG::PolyLineT::add_point
void add_point(const Point &_p)
Append a point to the polyline.
Definition: PolyLineT_impl.hh:283
ACG::PolyLineT::resample_arclength_uniform
void resample_arclength_uniform(const unsigned int _n)
Perform an uniform arclength resampling while maintaining the start and end point.
Definition: PolyLineT_impl.hh:575
ACG::PolyLineT::append
void append(const PolyLineT< PointT > &_pl)
Append second polyline _pl to this one.
Definition: PolyLineT_impl.hh:1382
ACG::PolyLineT::front
const Point & front() const
Get first point of the polyline ( no range check!!!)
Definition: PolyLineT.hh:157
ACG::PolyLineT::split
void split(unsigned int _split_idx, PolyLineT< PointT > &_new_pl)
Split closed polyline at vertex with index _split_idx.
Definition: PolyLineT_impl.hh:1458
ACG::PolyLineT::find_nearest_point
Point find_nearest_point(const MeshT &_mesh, const Point &_point, typename MeshT::FaceHandle &_fh, SpatialSearchT *_ssearch=0, double *_dbest=0)
Definition: PolyLineT_impl.hh:1001
ACG::PolyLineT::smooth_uniform_laplace2
void smooth_uniform_laplace2()
Squared laplacian smoothing.
Definition: PolyLineT_impl.hh:787
ACG::PolyLineT::edge_radius_
Scalar edge_radius_
cylinder-radius of edges
Definition: PolyLineT.hh:656
ACG::PolyLineT::smooth_uniform_laplace3
void smooth_uniform_laplace3()
Cubic laplacian smoothing.
Definition: PolyLineT_impl.hh:844
ACG::PolyLineT::PolyLineT
PolyLineT(bool _closed=false)
Constructor.
Definition: PolyLineT_impl.hh:91
ACG::PolyLineT::points
const std::vector< Point > & points() const
Get all points of the polyline.
Definition: PolyLineT.hh:151
ACG::PolyLineT::length
Scalar length() const
Compute the length of the polyline (in future cached method)
Definition: PolyLineT_impl.hh:479
ACG::PolyLineT::on_multiple_components
bool on_multiple_components(MeshT &_mesh, SpatialSearchT &_ssearch)
Definition: PolyLineT_impl.hh:2000
ACG::PolyLineT::edge_vector
Point edge_vector(unsigned int _i) const
get the i-th oriented edge vector
Definition: PolyLineT.hh:166
ACG::PolyLineT::subdivide
void subdivide(Scalar _largest)
Subdivide polyline.
Definition: PolyLineT_impl.hh:614
ACG::PolyLineT::plane_line_intersection
bool plane_line_intersection(const IPoint &_p_plane, const IPoint &_n_plane, const IPoint &_p0, const IPoint &_p1, IPoint &_p_int)
Definition: PolyLineT_impl.hh:1488
ACG::PolyLineT::insert_point
void insert_point(int _idx, const Point &_p)
insert _p at _idx into polyline
Definition: PolyLineT_impl.hh:347
ACG::PolyLineT::set_vertex_radius
void set_vertex_radius(const Scalar _r)
set ball-radius of vertices
Definition: PolyLineT.hh:345
ACG::PolyLineT::set_to_circle
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_impl.hh:906
ACG::PolyLineT::position_arclength
Point position_arclength(const Scalar _t) const
Same as position but with an arclength parameterization in [0,length()].
Definition: PolyLineT_impl.hh:523
ACG::PolyLineT::bind_custom_property_to_shader
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_impl.hh:2321
ACG::PolyLineT::vertex_radius
Scalar vertex_radius() const
get ball-radius of vertices
Definition: PolyLineT.hh:342
ACG::PolyLineT::front
Point & front()
Get first point of the polyline ( no range check!!!)
Definition: PolyLineT.hh:154
ACG::PolyLineT::point
Point & point(unsigned int _i)
Get a point of the polyline.
Definition: PolyLineT.hh:142
ACG::PolyLineT::position
Point position(const Scalar _t) const
Provide linear paremterization of the polyline in [0,1].
Definition: PolyLineT_impl.hh:510
ACG::PolyLineT::split_into_one_per_component
void split_into_one_per_component(MeshT &_mesh, SpatialSearchT &_ssearch, std::vector< PolyLineT > &out_polylines)
Definition: PolyLineT_impl.hh:2029
ACG::PolyLineT::vertex_radius_
Scalar vertex_radius_
ball-radius of vertices
Definition: PolyLineT.hh:653
ACG::PolyLineT::delete_point
void delete_point(int _idx)
Delete point at _idx.
Definition: PolyLineT_impl.hh:412
ACG::PolyLineT::invert
void invert()
Invert polyline that first vertex becomes last.
Definition: PolyLineT_impl.hh:1352
ACG::PolyLineT::get_custom_property_shader_binding
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_impl.hh:2337
ACG::PolyLineT::n_vertices
size_t n_vertices() const
Get number of vertices.
Definition: PolyLineT.hh:116
OpenMesh::PropertyManager
Definition: PropertyManager.hh:80
ACG::PolyLineT::set_line_node
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_impl.hh:1138
ACG::PolyLineT::closed_
bool closed_
Connect first and last point?
Definition: PolyLineT.hh:650
ACG::PolyLineT::set_closed
void set_closed(const bool _c)
Set if the polyline should be closed and therefore forms a loop.
Definition: PolyLineT.hh:113
ACG::PolyLineT::mark_components
void mark_components(OpenMesh::PropertyManager< OpenMesh::FPropHandleT< unsigned int >, MeshT > &component)
Definition: PolyLineT_impl.hh:1930
ACG::PolyLineT::clear
void clear()
Clear the current polyline.
Definition: PolyLineT_impl.hh:182
ACG::PolyLineT::is_closed
bool is_closed() const
Check if the polyline is marked as closed.
Definition: PolyLineT.hh:107
ACG::PolyLineT::n_edges
size_t n_edges() const
Get number of edges.
Definition: PolyLineT_impl.hh:211
ACG::PolyLineT::project_to_mesh
void project_to_mesh(const MeshT &_mesh, SpatialSearchT *_ssearch=0)
Project polyline points to nearest surface points (use spatial search!!!)
Definition: PolyLineT_impl.hh:932
OpenMesh::FPropHandleT< unsigned int >
ACG::PolyLineT::edge_radius
Scalar edge_radius() const
get cylinder-radius of edges
Definition: PolyLineT.hh:348
ACG::PolyLineT::remove_subsequent_identical_points
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_impl.hh:1754
ACG::PolyLineT
Definition: PolyLineT.hh:84
ACG::PolyLineT::prepend
void prepend(const PolyLineT< PointT > &_pl)
Prepend second polyline _pl to polyline.
Definition: PolyLineT_impl.hh:1411
ACG::PolyLineT::total_gaussian_curvature
Scalar total_gaussian_curvature()
compute total gaussian curvature of enclosed surface (via Gauss-Bonnet)
Definition: PolyLineT_impl.hh:1836
ACG::PolyLineT::CustomProperty
Definition: PolyLineT.hh:696
ACG::PolyLineT::get_line_node
LineNodeT * get_line_node(LineNodeT *&_line_node, int _mode=0)
Conversion PolyLine <-> LineNode.
Definition: PolyLineT_impl.hh:1075
ACG::PolyLineT::component_of
unsigned int component_of(const OpenMesh::PropertyManager< OpenMesh::FPropHandleT< unsigned int >, MeshT > &component, const PointT &pt, SpatialSearchT &_ssearch)
Definition: PolyLineT_impl.hh:1982
ACG::PolyLineT::~PolyLineT
~PolyLineT()
Destructor.
Definition: PolyLineT.hh:99