G+Smo
24.08.0
Geometry + Simulation Modules
|
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... | |
T | 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... | |
T | getLength () const |
Get length. More... | |
size_t | getNumberOfVertices () const |
Get number of vertices. More... | |
T | 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< Halfedge > | findNonTwinHalfedges (const std::vector< Halfedge > &allHalfedges) |
Finds halfedges without twin halfedge. More... | |
Private Attributes | |
std::vector< Chain > | m_boundary |
boundary chains | |
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.
[in] | halfedges | vector of halfedges of the triangle mesh |
|
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.
[in] | allHalfedges | const std::vector<Halfedge>& - vector of all halfedges in the mesh |
|
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
[in] | i | number of the first vertex |
[in] | j | number of the second vertex |
|
inline |
Get halfedge lengths.
This function returns a vector of the ordered halfedge lengths, e. g. vector[i] = length of (i+1)-th halfedge
|
inline |
Get length.
This function returns the length of the boundary, e.g. the sum of all the halfedge lengths.
|
inline |
Get number of vertices.
This getter function returns the number of vertices of the triangle mesh.
|
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.
[in] | i | number of the first vertex |
[in] | j | number of the second vertex |
[in] | precision | tolerance |
|
inline |
Get list of vertex indices in the chain.
This method returns a list of all counter-clockwise ordered indices of the boundary.
|
inline |
Tells if vertex is contained in boundary chain.
[in] | internVertexIndex | index of the searched point (from m_boundary) |