G+Smo  23.12.0
Geometry + Simulation Modules
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gsHalfEdgeMesh< T >::Boundary Class Reference

Detailed Description

template<class T>
class gismo::gsHalfEdgeMesh< T >::Boundary

Class that maintains boundary of triangle mesh.

A Boundary class object is given by one or more chains of the boundary halfedges. The halfedges are ordered counter clockwise.

An object of the class can be constructed by a vector of all unordered halfedges of the mesh.

There are methods to get the number of halfedges, number of vertices, length, halfedge lengths, first and last halfedge, vertex indices, and distances between two vertices.

Public Member Functions

 Boundary ()
 Empty Constructor.
 
 Boundary (const std::vector< Halfedge > &halfedges)
 Constructor. More...
 
getDistanceBetween (const size_t &i, const size_t &j) const
 Get distance between vertices. More...
 
const std::vector< T > getHalfedgeLengths () const
 Get halfedge lengths. More...
 
getLength () const
 Get length. More...
 
size_t getNumberOfVertices () const
 Get number of vertices. More...
 
getShortestDistanceBetween (const size_t &i, const size_t &j, T precision) const
 Get distance between vertices. More...
 
const std::list< size_t > getVertexIndices () const
 Get list of vertex indices in the chain. More...
 
bool isVertexContained (const size_t &internVertexIndex) const
 Tells if vertex is contained in boundary chain. More...
 

Private Member Functions

const std::list< HalfedgefindNonTwinHalfedges (const std::vector< Halfedge > &allHalfedges)
 Finds halfedges without twin halfedge. More...
 

Private Attributes

std::vector< Chainm_boundary
 boundary chains
 

Constructor & Destructor Documentation

Boundary ( const std::vector< Halfedge > &  halfedges)

Constructor.

Boundary is constructed from given halfedges. First all halfedges that do not have a twin halfedge contained in the input vector are found. Then the first halfedge is added to the chain. Step by step the algorithm tries to append a halfedge, non-fitting ones are stored in a queue temporary, until a suitable halfedge is found. All halfedges are put back together and this procedure repeats until the chain is closed AND all halfedges are appended.

Otherwise a error message is printed, input is not suitable.

Parameters
[in]halfedgesvector of halfedges of the triangle mesh

Member Function Documentation

const std::list< typename gsHalfEdgeMesh< T >::Halfedge > findNonTwinHalfedges ( const std::vector< Halfedge > &  allHalfedges)
private

Finds halfedges without twin halfedge.

This private method takes a vector of unordered halfedges and finds the halfedges that do not have a twin halfedge contained in the same vector.

Parameters
[in]allHalfedgesconst std::vector<Halfedge>& - vector of all halfedges in the mesh
Returns
list of non-twin halfedges (boundary halfedges)
T getDistanceBetween ( const size_t &  i,
const size_t &  j 
) const
inline

Get distance between vertices.

The distance between i-th and j-th vertex of the boundary chain is returned. In case i > j the distance between j-th and i-th vertex is returned, provided a closed chain. Otherwise a warning is printed

Parameters
[in]inumber of the first vertex
[in]jnumber of the second vertex
Returns
(shortest) distance between i-th and j-th vertex
const std::vector<T> getHalfedgeLengths ( ) const
inline

Get halfedge lengths.

This function returns a vector of the ordered halfedge lengths, e. g. vector[i] = length of (i+1)-th halfedge

Returns
vector of halfedges
T getLength ( ) const
inline

Get length.

This function returns the length of the boundary, e.g. the sum of all the halfedge lengths.

Returns
length
size_t getNumberOfVertices ( ) const
inline

Get number of vertices.

This getter function returns the number of vertices of the triangle mesh.

Returns
number of vertices
T getShortestDistanceBetween ( const size_t &  i,
const size_t &  j,
precision 
) const
inline

Get distance between vertices.

The distance between i-th and j-th vertex of the boundary chain is returned. In case the chain is closed, it is checked wheter the distance in a clockwise or counterclockwise direction is shorter, and this one is returned.

Parameters
[in]inumber of the first vertex
[in]jnumber of the second vertex
[in]precisiontolerance
Returns
(shortest) distance between vertices
const std::list<size_t > getVertexIndices ( ) const
inline

Get list of vertex indices in the chain.

This method returns a list of all counter-clockwise ordered indices of the boundary.

Returns
list of vertex indices
bool isVertexContained ( const size_t &  internVertexIndex) const
inline

Tells if vertex is contained in boundary chain.

Parameters
[in]internVertexIndexindex of the searched point (from m_boundary)
Returns
TRUE if it is contained and FALSE otherwise