G+Smo
24.08.0
Geometry + Simulation Modules
|
Class that maintains the local neighbourhood properties.
As the Floater Algorithm needs some information concerning neighbourhood properties, the LocalNeighbourhood class extracts these information from the triangle mesh. The idea is to have a class object for every inner vertex of the mesh, such that the lambdas appearing in LocalParametrization can be calculated with the information stored in that object. The needed informations are the vertex index, the neighbours given by a chain, the angles between the neighbours and the lengths of the halfedges connecting the vertex index with its neighbours.
A local neighbourhood can be constructed be default and by using a MeshInfo object and the vertex index of the local neighbourhood.
There are comparison operators == and !=. With the getter functions the vertex index, number of neighbours, vertex indices of neighbours, angles and neighbour distances can be obtained. In case the vertex is a boundary vertex, which is indicated by setting the bool value to FALSE in the constructor, the inner angle can be calculated, too. By inner angle, the sum of angles between neighbours is meant.
A local neighbourhood can be printed.
Public Member Functions | |
const std::list< T > & | getAngles () const |
Get angles. More... | |
T | getInnerAngle () const |
Get inner angle. More... | |
std::list< T > | getNeighbourDistances () const |
Get neighbour distances. More... | |
size_t | getNumberOfNeighbours () const |
Get number of neighbours. More... | |
size_t | getVertexIndex () const |
Get vertex index. More... | |
const std::list< size_t > | getVertexIndicesOfNeighbours () const |
Get vertex indices of neighbours. More... | |
LocalNeighbourhood (const gsHalfEdgeMesh< T > &meshInfo, const size_t vertexIndex, const bool innerVertex=1) | |
Constructor. More... | |
Private Attributes | |
std::list< T > | m_angles |
list of angles between neighbours | |
std::list< T > | m_neighbourDistances |
list of distances to neighbours | |
gsHalfEdgeMesh< T >::Chain | m_neighbours |
chain of neighbours | |
size_t | m_vertexIndex |
vertex index | |
LocalNeighbourhood | ( | const gsHalfEdgeMesh< T > & | meshInfo, |
const size_t | vertexIndex, | ||
const bool | innerVertex = 1 |
||
) |
Constructor.
This constructor needs a MeshInfo object and a vertex index as an input. Optional a bool value can be set to 0, which indicates that the vertex is a boundary vertex. With this it should be ensured, that a local neighbourhood is not accidentally constructed for a boundary vertex.
It is tested whether vertexIndex > 1 and, vertexIndex < n (inner vertex) or the input innerVertex == 0. Otherwise an error message is printed.
For construction of m_neighbours all opposite halfedges are found, chained and angles between origin of the current halfedge, vertex and end of the halfedge are calculated. The neighbour distances are given by the lengths of the halfedges connecting vertex index with its neighbours.
A LocalNeighbourhood object can be printed.
[in] | meshInfo | const MeshInfo& - mesh information |
[in] | vertexIndex | const int - vertex index |
[in] | innerVertex | const bool - optional bool value that indicates if vertex is inner vertex or not |
const std::list< T > & getAngles | ( | ) | const |
Get angles.
This method returns a list of the angles between the vector from the vertex to a neighbour and the vector from the vertex to the next neighbour. The angles are stored in m_angles and were calculated when constructing the object.
T getInnerAngle | ( | ) | const |
Get inner angle.
This method is used for boundary values, meaning the neighbours chain is not closed. It returns the sum of all angles stored in m_angles.
std::list< T > getNeighbourDistances | ( | ) | const |
Get neighbour distances.
This method returns a list of T values representing the lengths of the halfedges connecting the vertex with its neighbours stored in m_neighbourDistances.
size_t getNumberOfNeighbours | ( | ) | const |
Get number of neighbours.
This method returns the number of neighbours, which is given by the number of vertices of the chain m_neighbours. For that getNumberOfVertices() of the Chain class is used.
size_t getVertexIndex | ( | ) | const |
Get vertex index.
const std::list< size_t > getVertexIndicesOfNeighbours | ( | ) | const |
Get vertex indices of neighbours.
This method returns a list of the indices of the neighbours, which is given by the indices of the chain m_neighbours. For that getVertexIndices() of the Chain class is used.