Developer Documentation

Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
ACG::PolyLineT< PointT > Class Template Reference

`#include <AC>`

## Classes
struct | CustomProperty

## Public Types
typedef PointT | Point
typedef Point::value_type | Scalar
typedef int | CustomPropertyHandle

## Public Member Functions
| PolyLineT (bool _closed=false)
| Constructor.
| PolyLineT (const PolyLineT &_line)
| Copy Constructor.
| ~PolyLineT ()
| Destructor.
bool | is_closed () const
| Check if the polyline is marked as closed. More...
void | set_closed (const bool _c)
| Set if the polyline should be closed and therefore forms a loop. More...
size_t | n_vertices () const
| Get number of vertices.
size_t | n_edges () const
| Get number of edges.
void | clear ()
| Clear the current polyline.
void | resize (unsigned int _n)
| Resize current polyline.
void | add_point (const Point &_p)
| Append a point to the polyline.
void | insert_point (int _idx, const Point &_p)
| insert _p at _idx into polyline More...
void | delete_point (int _idx)
| Delete point at _idx.
Point & | point (unsigned int _i)
| Get a point of the polyline.
const Point & | point (unsigned int _i) const
| Get a point of the polyline.
std::vector< Point > & | points ()
| Get all points of the polyline.
const std::vector< Point > & | points () const
| Get all points of the polyline.
Point & | front ()
| Get first point of the polyline ( no range check!!!)
const Point & | front () const
| Get first point of the polyline ( no range check!!!)
Point & | back ()
| Get last point of the polyline ( no range check!!!)
const Point & | back () const
| Get last point of the polyline ( no range check!!!)
Point | edge_vector (unsigned int _i) const
| get the i-th oriented edge vector
Scalar | length () const
| Compute the length of the polyline (in future cached method) More...
Point | position (const Scalar _t) const
| Provide linear paremterization of the polyline in [0,1]. More...
Point | position_arclength (const Scalar _t) const
| Same as position but with an arclength parameterization in [0,length()]. More...
void | resample_arclength_uniform (const unsigned int _n)
| Perform an uniform arclength resampling while maintaining the start and end point. More...
void | subdivide (Scalar _largest)
| Subdivide polyline. More...
void | collapse (Scalar _smallest)
| Collapse polyline. More...
void | invert ()
| Invert polyline that first vertex becomes last.
void | append (const PolyLineT< PointT > &_pl)
| Append second polyline _pl to this one.
void | prepend (const PolyLineT< PointT > &_pl)
| Prepend second polyline _pl to polyline.
void | split_closed (unsigned int _split_idx)
| Split closed polyline at vertex with index _split_idx. More...
void | split (unsigned int _split_idx, PolyLineT< PointT > &_new_pl)
| Split closed polyline at vertex with index _split_idx. More...
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 More...
void | smooth_uniform_laplace ()
| Laplacian smoothing.
void | smooth_uniform_laplace2 ()
| Squared laplacian smoothing.
void | smooth_uniform_laplace3 ()
| Cubic laplacian smoothing.
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
template<class MeshT , class SpatialSearchT >
void | project_to_mesh (const MeshT &_mesh, SpatialSearchT *_ssearch=0)
| Project polyline points to nearest surface points (use spatial search!!!) More...
template<class MeshT , class SpatialSearchT >
void | project_to_mesh (const std::vector< MeshT *> &_mesh, std::vector< SpatialSearchT *> *_ssearch=0)
| Project polyline points to nearest surface points (use spatial search!!!) More...
template<class MeshT , class SpatialSearchT >
bool | on_multiple_components (MeshT &_mesh, SpatialSearchT &_ssearch)
template<class MeshT , class SpatialSearchT >
void | split_into_one_per_component (MeshT &_mesh, SpatialSearchT &_ssearch, std::vector< PolyLineT > &out_polylines)
Scalar | total_gaussian_curvature ()
| compute total gaussian curvature of enclosed surface (via Gauss-Bonnet) More...
template<class LineNodeT >
LineNodeT * | get_line_node (LineNodeT *&_line_node, int _mode=0)
| Conversion PolyLine <-> LineNode. More...
template<class LineNodeT >
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. More...
void | print () const
| Print information string to cerr.
Scalar | vertex_radius () const
| get ball-radius of vertices
void | set_vertex_radius (const Scalar _r)
| set ball-radius of vertices
Scalar | edge_radius () const
| get cylinder-radius of edges
void | set_edge_radius (const Scalar _r)
| set cylinder-radius of edges
void | request_vertex_normals ()
void | request_vertex_binormals ()
void | request_vertex_colors ()
void | request_vertex_scalars ()
void | request_vertex_selections ()
void | request_vertex_vhandles ()
void | request_vertex_ehandles ()
void | request_vertex_fhandles ()
void | request_edge_normals ()
void | request_edge_colors ()
void | request_edge_scalars ()
void | request_edge_selections ()
void | request_preimage_directions ()
void | release_vertex_normals ()
void | release_vertex_binormals ()
void | release_vertex_colors ()
void | release_vertex_scalars ()
void | release_vertex_selections ()
void | release_vertex_vhandles ()
void | release_vertex_ehandles ()
void | release_vertex_fhandles ()
void | release_edge_normals ()
void | release_edge_colors ()
void | release_edge_scalars ()
void | release_edge_selections ()
void | release_preimage_directions ()
bool | vertex_normals_available () const
bool | vertex_binormals_available () const
bool | vertex_colors_available () const
bool | vertex_scalars_available () const
bool | vertex_selections_available () const
bool | vertex_vhandles_available () const
bool | vertex_ehandles_available () const
bool | vertex_fhandles_available () const
bool | edge_normals_available () const
bool | edge_colors_available () const
bool | edge_scalars_available () const
bool | edge_selections_available () const
bool | edge_preimage_directions_available () const
Point & | vertex_normal (unsigned int _i)
const Point & | vertex_normal (unsigned int _i) const
Point & | vertex_binormal (unsigned int _i)
const Point & | vertex_binormal (unsigned int _i) const
Point & | vertex_color (unsigned int _i)
const Point & | vertex_color (unsigned int _i) const
Scalar & | vertex_scalar (unsigned int _i)
const Scalar & | vertex_scalar (unsigned int _i) const
unsigned char & | vertex_selection (unsigned int _i)
const unsigned char & | vertex_selection (unsigned int _i) const
int & | vertex_vhandle (unsigned int _i)
const int & | vertex_vhandle (unsigned int _i) const
int & | vertex_ehandle (unsigned int _i)
const int & | vertex_ehandle (unsigned int _i) const
int & | vertex_fhandle (unsigned int _i)
const int & | vertex_fhandle (unsigned int _i) const
Point & | edge_normal (unsigned int _i)
const Point & | edge_normal (unsigned int _i) const
Point & | edge_color (unsigned int _i)
const Point & | edge_color (unsigned int _i) const
Scalar & | edge_scalar (unsigned int _i)
const Scalar & | edge_scalar (unsigned int _i) const
unsigned char & | edge_selection (unsigned int _i)
const unsigned char & | edge_selection (unsigned int _i) const
Point & | preimage_direction (unsigned int _i)
const Point & | preimage_direction (unsigned int _i) const
CustomPropertyHandle | request_custom_property (const std::string &_name, unsigned int _prop_size)
void | release_custom_property (const std::string &_name)
void | release_custom_property (CustomPropertyHandle _prop_handle)
bool | custom_property_available (CustomPropertyHandle _property_handle) const
bool | custom_property_available (const std::string &_name) const
void | set_custom_property (CustomPropertyHandle _property_handle, unsigned int _vertex, const void *_data)
void | get_custom_property (CustomPropertyHandle _property_handle, unsigned int _vertex, void *_dst) const
void | set_custom_property (const std::string &_name, unsigned int _vertex, const void *_data)
void | get_custom_property (const std::string &_name, unsigned int _vertex, void *_dst) const
void | bind_custom_property_to_shader (CustomPropertyHandle _property_handle, const std::string &_shader_input_name, unsigned int _datatype)
| Binding to vertex shader (optional) More...
bool | get_custom_property_shader_binding (CustomPropertyHandle _property_handle, unsigned int *_propsize, const char **_input_name, unsigned int *_datatype) const
| Get shader binding information. More...
CustomPropertyHandle | get_custom_property_handle (const std::string &_name) const
const std::string | get_custom_property_name (CustomPropertyHandle _property_handle) const
unsigned int | get_num_custom_properties () const
const void * | get_custom_property_buffer (CustomPropertyHandle _property_handle) const
CustomPropertyHandle | enumerate_custom_property_handles (unsigned int _i) const
bool | vertex_selected (unsigned int _i)
bool | edge_selected (unsigned int _i)
void | select_vertex (unsigned int _i)
void | select_edge (unsigned int _i)
void | deselect_vertex (unsigned int _i)
void | deselect_edge (unsigned int _i)
void | copy_vertex_complete (const PolyLineT< PointT > &_pl, unsigned int _i, unsigned int _j)
void | copy_edge_complete (const PolyLineT< PointT > &_pl, unsigned int _i, unsigned int _j)

## Private Types
typedef std::map< std::string, CustomProperty *> | CustomPropertyMap

## Private Member Functions
template<class MeshT , class SpatialSearchT >
Point | find_nearest_point (const MeshT &_mesh, const Point &_point, typename MeshT::FaceHandle &_fh, SpatialSearchT *_ssearch=0, double *_dbest=0)
template<class MeshT , class SpatialSearchT >
unsigned int | component_of (const OpenMesh::PropertyManager< OpenMesh::FPropHandleT< unsigned int >, MeshT > &component, const PointT &pt, SpatialSearchT &_ssearch)
template<class MeshT >
void | mark_components (OpenMesh::PropertyManager< OpenMesh::FPropHandleT< unsigned int >, MeshT > &component)
template<class PropT >
void | request_prop (unsigned int &_ref_count, PropT &_prop)
template<class PropT >
void | release_prop (unsigned int &_ref_count, PropT &_prop)
template<class IPoint >
bool | plane_line_intersection (const IPoint &_p_plane, const IPoint &_n_plane, const IPoint &_p0, const IPoint &_p1, IPoint &_p_int)
template<class MeshT >
void | edge_points_in_segment (const MeshT &_mesh, const Point &_p0, const Point &_p1, const typename MeshT::FaceHandle &_fh0, const typename MeshT::FaceHandle &_fh1, std::vector< Point > &_points, std::vector< typename MeshT::EdgeHandle > &_ehandles)
CustomProperty * | custom_prop (CustomPropertyHandle _handle)
const CustomProperty * | custom_prop (CustomPropertyHandle _handle) const
CustomPropertyHandle | custom_prop_handle (const CustomProperty *) const

## Private Attributes
std::vector< Point > | points_
| List of points in the polyline.
bool | closed_
| Connect first and last point?
Scalar | vertex_radius_
| ball-radius of vertices
Scalar | edge_radius_
| cylinder-radius of edges
std::vector< Point > | vnormals_
std::vector< Point > | vbinormals_
std::vector< Point > | vcolors_
std::vector< Scalar > | vscalars_
std::vector< unsigned char > | vselections_
std::vector< int > | vvhandles_
std::vector< int > | vehandles_
std::vector< int > | vfhandles_
std::vector< Point > | enormals_
std::vector< Point > | ecolors_
std::vector< Scalar > | escalars_
std::vector< unsigned char > | eselections_
std::vector< Point > | epreimage_direction_
unsigned int | ref_count_vnormals_
unsigned int | ref_count_vbinormals_
unsigned int | ref_count_vcolors_
unsigned int | ref_count_vscalars_
unsigned int | ref_count_vselections_
unsigned int | ref_count_vvhandles_
unsigned int | ref_count_vehandles_
unsigned int | ref_count_vfhandles_
unsigned int | ref_count_enormals_
unsigned int | ref_count_ecolors_
unsigned int | ref_count_escalars_
unsigned int | ref_count_eselections_
unsigned int | ref_count_epreimage_direction_
CustomPropertyMap | custom_properties
std::vector< CustomProperty * > | cprop_enum

## Detailed Description

### template<class PointT>
class ACG::PolyLineT< PointT >

/.../PolyLineT.hh>

Brief Description.

A more elaborate description follows.

Definition at line 84 of file PolyLineT.hh.

## Member Function Documentation

## ◆ bind_custom_property_to_shader()

template<class PointT >

void ACG::PolyLineT< PointT >::bind_custom_property_to_shader | ( | CustomPropertyHandle | _property_handle,
|  | const std::string & | _shader_input_name,
|  | unsigned int | _datatype
| ) |  |

Binding to vertex shader (optional)

Bind custom vertex properties to input names in vertex shaders. The number of coordinates of a property is assumed to be _prop_size / bytesize(_datatype), so the property size provided via request_custom_property has to be a multiple of bytesize(_datatype).

Parameters

  _property_handle | handle of property
  _shader_input_name | name id of input data in the vertex shader
  _datatype | type of one property data coordinate, ie GL_FLOAT, GL_UNSIGNED_BYTE ...

Definition at line 2321 of file PolyLineT_impl.hh.

## ◆ collapse()

template<class PointT >

void ACG::PolyLineT< PointT >::collapse | ( | Scalar | _smallest | ) |

Collapse polyline.

Collapses segments until the smallest interval in the line is larger than the given value

Parameters

  _smallest | smallest interval length after collapsing

Definition at line 667 of file PolyLineT_impl.hh.

## ◆ component_of()

template<class PointT>
template<class MeshT , class SpatialSearchT >

unsigned int ACG::PolyLineT< PointT >::component_of | ( | const OpenMesh::PropertyManager< OpenMesh::FPropHandleT< unsigned int >, MeshT > & | component,
|  | const PointT & | pt,
|  | SpatialSearchT & | _ssearch
| ) |  |
| private

Assuming component is a property manager that has been initialized using mark_components(), return the number of the component of the face pt gets projected to using _ssearch.

Definition at line 1982 of file PolyLineT_impl.hh.

## ◆ find_nearest_point()

template<class PointT >
template<class MeshT , class SpatialSearchT >

PolyLineT< PointT >::Point ACG::PolyLineT< PointT >::find_nearest_point | ( | const MeshT & | _mesh,
|  | const Point & | _point,
|  | typename MeshT::FaceHandle & | _fh,
|  | SpatialSearchT * | _ssearch = `0`,
|  | double * | _dbest = `0`
| ) |  |
| private

Compute the closest point on a mesh

Parameters

  _mesh | The corresponding mesh
  _point | Point that should be checked
  _fh | Returns closest face to the given point
  _ssearch | Spatial search structure to speedup search
  _dbest | Returns the distance

Returns
  The closest point on the mesh (Not necessarily a vertex in the mesh!)

Definition at line 1001 of file PolyLineT_impl.hh.

## ◆ get_custom_property_shader_binding()

template<class PointT >

bool ACG::PolyLineT< PointT >::get_custom_property_shader_binding | ( | CustomPropertyHandle | _property_handle,
|  | unsigned int * | _propsize,
|  | const char ** | _input_name,
|  | unsigned int * | _datatype
| ) |  | const

Get shader binding information.

The property has to be bound via bind_custom_property_to_shader before.

Parameters

  _property_handle | handle of property
  _propsize | [out] receives size in bytes of one property element
  _input_name | [out] receives pointer to name id of input data in the vertex shader
  _datatype | [out] receives type of property coordinates

Returns
  true if property shader binding has been specified, false otherwise

Definition at line 2337 of file PolyLineT_impl.hh.

## ◆ get_line_node()

template<class PointT >
template<class LineNodeT >

LineNodeT * ACG::PolyLineT< PointT >::get_line_node | ( | LineNodeT *& | _line_node,
|  | int | _mode = `0`
| ) |  |

Conversion PolyLine <-> LineNode.

Creates a line node out of the polylline

Parameters

  _line_node | The newly created line node
  _mode | 0 : LineSegments mode, 1: polygon mode

Returns

Definition at line 1075 of file PolyLineT_impl.hh.

## ◆ insert_point()

template<class PointT >

void ACG::PolyLineT< PointT >::insert_point | ( | int | _idx,
|  | const Point & | _p
| ) |  |

insert _p at _idx into polyline

Parameters

  _idx | Where to insert
  _p | New point

Definition at line 347 of file PolyLineT_impl.hh.

## ◆ is_closed()

template<class PointT>

bool ACG::PolyLineT< PointT >::is_closed | ( |  | ) | const
| inline

Check if the polyline is marked as closed.

If the polyline is closed, the end vertices are connected.

Returns
  Closed polyline

Definition at line 107 of file PolyLineT.hh.

## ◆ length()

template<class PointT >

PolyLineT< PointT >::Scalar ACG::PolyLineT< PointT >::length | ( |  | ) | const

Compute the length of the polyline (in future cached method)

Returns
  Length of the polyline

Definition at line 479 of file PolyLineT_impl.hh.

## ◆ mark_components()

template<class PointT >
template<class MeshT >

void ACG::PolyLineT< PointT >::mark_components | ( | OpenMesh::PropertyManager< OpenMesh::FPropHandleT< unsigned int >, MeshT > & | component | ) |
| private

Enumerate connected components of the property manager's mesh and assign each face its component's number using the property manager.

Definition at line 1930 of file PolyLineT_impl.hh.

## ◆ on_multiple_components()

template<class PointT >
template<class MeshT , class SpatialSearchT >

bool ACG::PolyLineT< PointT >::on_multiple_components | ( | MeshT & | _mesh,
|  | SpatialSearchT & | _ssearch
| ) |  |

Indicates whether the entire poly line lies on the same connected component of the supplied mesh.

Definition at line 2000 of file PolyLineT_impl.hh.

## ◆ plane_line_intersection()

template<class PointT >
template<class IPoint >

bool ACG::PolyLineT< PointT >::plane_line_intersection | ( | const IPoint & | _p_plane,
|  | const IPoint & | _n_plane,
|  | const IPoint & | _p0,
|  | const IPoint & | _p1,
|  | IPoint & | _p_int
| ) |  |
| private

Intersect point with line

Parameters

  _p_plane | Plane point
  _n_plane | Plane normal
  _p0 | Startpoint of line
  _p1 | Endpoint of line
  _p_int | Intersection point

Returns
  Intersecting?

Definition at line 1488 of file PolyLineT_impl.hh.

## ◆ position()

template<class PointT >

PolyLineT< PointT >::Point ACG::PolyLineT< PointT >::position | ( | const Scalar | _t | ) | const

Provide linear paremterization of the polyline in [0,1].

Parameters

  _t | parameter value in [0,1]

Returns
  point positioned at parameter value _t

Definition at line 510 of file PolyLineT_impl.hh.

## ◆ position_arclength()

template<class PointT >

PolyLineT< PointT >::Point ACG::PolyLineT< PointT >::position_arclength | ( | const Scalar | _t | ) | const

Same as position but with an arclength parameterization in [0,length()].

Note
  invalid parameter positions are projected to [0,length()]

Parameters

  _t | parameter value in [0,length()]

Returns
  point positioned at parameter value _t

Definition at line 523 of file PolyLineT_impl.hh.

## ◆ project_to_mesh() [1/2]

template<class PointT >
template<class MeshT , class SpatialSearchT >

void ACG::PolyLineT< PointT >::project_to_mesh | ( | const MeshT & | _mesh,
|  | SpatialSearchT * | _ssearch = `0`
| ) |  |

Project polyline points to nearest surface points (use spatial search!!!)

Note
  The points of the polyline are updated in place!

Parameters

  _mesh | The mesh to project to
  _ssearch | A spatial search to improve speed

Definition at line 932 of file PolyLineT_impl.hh.

## ◆ project_to_mesh() [2/2]

template<class PointT >
template<class MeshT , class SpatialSearchT >

void ACG::PolyLineT< PointT >::project_to_mesh | ( | const std::vector< MeshT *> & | _mesh,
|  | std::vector< SpatialSearchT *> * | _ssearch = `0`
| ) |  |

Project polyline points to nearest surface points (use spatial search!!!)

This function projects the polyline points to the closest of the given meshes.

Note
  The points of the polyline are updated in place!

Parameters

  _mesh | vector of meshes that should be used
  _ssearch | A spatial search to improve speed

Definition at line 953 of file PolyLineT_impl.hh.

## ◆ remove_subsequent_identical_points()

template<class PointT >

void ACG::PolyLineT< PointT >::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

Parameters

  _keep_edge_vertices | Keep the corresponding edge vertices
  _epsilon | Vertices which are closer than this distance are considered at same position

Definition at line 1754 of file PolyLineT_impl.hh.

## ◆ resample_arclength_uniform()

template<class PointT >

void ACG::PolyLineT< PointT >::resample_arclength_uniform | ( | const unsigned int | _n | ) |

Perform an uniform arclength resampling while maintaining the start and end point.

Note
  invalid number of samples are projected by n = max(2,n)

Parameters

  _n | number of sample points in [2,infinity]

Definition at line 575 of file PolyLineT_impl.hh.

## ◆ set_closed()

template<class PointT>

void ACG::PolyLineT< PointT >::set_closed | ( | const bool | _c | ) |
| inline

Set if the polyline should be closed and therefore forms a loop.

Parameters

  _c | Set polyline closed or not?

Definition at line 113 of file PolyLineT.hh.

## ◆ set_line_node()

template<class PointT >
template<class LineNodeT >

void ACG::PolyLineT< PointT >::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.

Parameters

  _line_node | The line node with the data
  _mode | 0 : LineSegments mode, 1: polygon mode

Definition at line 1138 of file PolyLineT_impl.hh.

## ◆ split()

template<class PointT>

void ACG::PolyLineT< PointT >::split | ( | unsigned int | _split_idx,
|  | PolyLineT< PointT > & | _new_pl
| ) |  |

Split closed polyline at vertex with index _split_idx.

Parameters

  _split_idx | Where to split
  _new_pl | The new polyline is returned in this variable

Definition at line 1458 of file PolyLineT_impl.hh.

## ◆ split_closed()

template<class PointT >

void ACG::PolyLineT< PointT >::split_closed | ( | unsigned int | _split_idx | ) |

Split closed polyline at vertex with index _split_idx.

Parameters

  _split_idx | Where to split

Definition at line 1426 of file PolyLineT_impl.hh.

## ◆ split_into_one_per_component()

template<class PointT >
template<class MeshT , class SpatialSearchT >

void ACG::PolyLineT< PointT >::split_into_one_per_component | ( | MeshT & | _mesh,
|  | SpatialSearchT & | _ssearch,
|  | std::vector< PolyLineT< PointT > > & | out_polylines
| ) |  |

Splits the poly line up into multiple poly lines each of which lie entirely on one connected component of the supplied mesh. There will be small gap between the new poly lines.

Definition at line 2029 of file PolyLineT_impl.hh.

## ◆ subdivide()

template<class PointT >

void ACG::PolyLineT< PointT >::subdivide | ( | Scalar | _largest | ) |

Subdivide polyline.

Subdivides segments until the longest interval in the line is smaller than the given value

Parameters

  _largest | largest interval length after subdivision

Definition at line 614 of file PolyLineT_impl.hh.

## ◆ total_gaussian_curvature()

template<class PointT >

PolyLineT< PointT >::Scalar ACG::PolyLineT< PointT >::total_gaussian_curvature | ( |  | ) |

compute total gaussian curvature of enclosed surface (via Gauss-Bonnet)

The enclosed surface is defined to be on the left side of the curve given through N x E This function requires Edge-Normals!!!

Definition at line 1836 of file PolyLineT_impl.hh.

The documentation for this class was generated from the following files:

- Type-PolyLine/ObjectTypes/PolyLine/PolyLineT.hh
- Type-PolyLine/ObjectTypes/PolyLine/PolyLineT_impl.hh