OpenWalnut
1.5.0dev
|
Class that manages all vertex properties. More...
#include <WVertexFactory.h>
Public Member Functions | |
WVertexFactory (std::shared_ptr< WTriangleMesh > triangleMesh) | |
Creates a vertex factory object and assigns the triangle mesh that should be analyzed in future. More... | |
WVertexFactory () | |
Creates a vertex factory object. More... | |
virtual | ~WVertexFactory () |
Destroys the vertex factory object. More... | |
void | setTriangleMesh (std::shared_ptr< WTriangleMesh > triangleMesh) |
Sets the WTriangleMesh. More... | |
void | resize (size_t count) |
Resizes the Vertex property list to the wished size. More... | |
void | registerTriangle (size_t vertexID, size_t triangleID) |
Registers triangle to all its vertex IDs. More... | |
vector< size_t > | getAttachedTriangleIDs (size_t excludedTriangleID, size_t vertex1, size_t vertex2) |
Returns all Triangle IDs but the excluded attached to two particular vertices. More... | |
size_t | get3rdVertexID (size_t triangleID, size_t vertex1, size_t vertex2) |
Returns the third vertex ID of a triangle. More... | |
size_t | getVertexCount () |
Returns the Property List's vertex count. More... | |
bool | newVertexExists (size_t fromID, size_t toID) |
Returns whether properties of the subdividable new vertex between two vertices alreadey exists. More... | |
bool | isValidTriangle (size_t triangleID) |
Examine triangle by its ID for validity. More... | |
void | attachNewVertex (size_t fromID, size_t toID) |
Registering a subdividable new vertex of an ID between two vertices. More... | |
WVertexProperty * | getProperty (size_t vertexID) |
Get properties of a vertex. More... | |
WNewVertex * | getNewVertexProperty (size_t fromID, size_t toID) |
Get properties of a new vertex which subdivides a line between two vertices. More... | |
void | examineStencilRange (size_t fromVertex, size_t toVertex, std::shared_ptr< WProgress > progress) |
Examines Butterfly stencils of all vertices and applies settings data to the vertex. More... | |
Static Public Member Functions | |
static float | getDistance (osg::Vec3 point1, osg::Vec3 point2) |
Calculate distance between two vertices. More... | |
static osg::Vec3 | add (osg::Vec3 base, osg::Vec3 sum, float factor) |
Adding a sum multiplied by a factor to the base number. More... | |
Private Attributes | |
std::vector< WVertexProperty * > | m_vertProp |
Vertex properties data. More... | |
std::shared_ptr< WTriangleMesh > | m_triangleMesh |
Assigned Triangle mesh. More... | |
size_t | m_vertexCount |
Vertex count of the property list. More... | |
size_t | m_triangleCount |
Triangle count. More... | |
Class that manages all vertex properties.
It depicts the outer object that manages the entire set of the triangle mesh that is not possible to analyze using a triangle mesh only.
Definition at line 44 of file WVertexFactory.h.
|
explicit |
Creates a vertex factory object and assigns the triangle mesh that should be analyzed in future.
#
triangleMesh | Associated triangle mesh that should be analyzed. |
Definition at line 39 of file WVertexFactory.cpp.
References m_triangleCount, m_triangleMesh, and m_vertexCount.
butterfly::WVertexFactory::WVertexFactory | ( | ) |
Creates a vertex factory object.
Definition at line 33 of file WVertexFactory.cpp.
References m_triangleCount, and m_vertexCount.
|
virtual |
Destroys the vertex factory object.
Definition at line 46 of file WVertexFactory.cpp.
References m_vertProp.
Referenced by butterfly::WButterflyFactory::getSubdividedMesh().
|
static |
Adding a sum multiplied by a factor to the base number.
base | The base number to add the summand |
sum | Summand that is added to the base number |
factor | Number that multiplies the summand |
Definition at line 252 of file WVertexFactory.cpp.
Referenced by butterfly::WButterflyCalculator::calcNewVertex(), butterfly::WButterflyCalculator::getInterpolatedValue(), butterfly::WSubdivisionValidator::getValidatedSubdivision(), and butterfly::WSubdivisionValidator::joinNarrowVertices().
void butterfly::WVertexFactory::attachNewVertex | ( | size_t | fromID, |
size_t | toID | ||
) |
Registering a subdividable new vertex of an ID between two vertices.
Invalid subdividable new vertices are also registered. But there are market to be invalid afterwards.
fromID | The first neighbor vertex ID where the new vertex lies between. |
toID | The second neighbor vertex ID where the new vertex lies between. |
Definition at line 146 of file WVertexFactory.cpp.
References m_vertProp.
Referenced by butterfly::WButterflyFactory::attachUncalculatedNewVertices().
void butterfly::WVertexFactory::examineStencilRange | ( | size_t | fromVertex, |
size_t | toVertex, | ||
std::shared_ptr< WProgress > | progress | ||
) |
Examines Butterfly stencils of all vertices and applies settings data to the vertex.
properties. Due to this basically all neighbor vertices are sorted and stored into the butterfly stencil neighbor vertex ID array. The sort order is circular by each vertex. The neighbor vertex count is stored as valence.
The first two parameters are to select the vertices to calculated. It's useful for multithreading.
fromVertex | First data set holding vertex property. |
toVertex | Last data set holding vertex property. |
progress | Progress which is actualized during the calculation. |
Definition at line 180 of file WVertexFactory.cpp.
References get3rdVertexID(), getAttachedTriangleIDs(), isValidTriangle(), m_triangleMesh, and m_vertProp.
Referenced by butterfly::WButterflyFactory::examineStencilAll().
size_t butterfly::WVertexFactory::get3rdVertexID | ( | size_t | triangleID, |
size_t | vertex1, | ||
size_t | vertex2 | ||
) |
Returns the third vertex ID of a triangle.
triangleID | Triangle ID to examine. |
vertex1 | First vertexID to exclude. |
vertex2 | Second vertex ID to exclude. |
Definition at line 112 of file WVertexFactory.cpp.
References m_triangleMesh.
Referenced by examineStencilRange(), butterfly::WSubdivisionValidator::flipTrianglesAtLowAngles(), getAttachedTriangleIDs(), butterfly::WSubdivisionValidator::getMinTrianglesAngle(), and butterfly::WSubdivisionValidator::isValidMaxNeighbourTriangleAngle().
vector< size_t > butterfly::WVertexFactory::getAttachedTriangleIDs | ( | size_t | excludedTriangleID, |
size_t | vertex1, | ||
size_t | vertex2 | ||
) |
Returns all Triangle IDs but the excluded attached to two particular vertices.
excludedTriangleID | Triangle ID that should not be added to the returned list. |
vertex1 | First vertex the triangle should lie on. |
vertex2 | Second vertex the triangle should lie on. |
Definition at line 89 of file WVertexFactory.cpp.
References get3rdVertexID(), isValidTriangle(), m_triangleCount, and m_vertProp.
Referenced by examineStencilRange(), butterfly::WSubdivisionValidator::flipTrianglesAtLowAngles(), butterfly::WSubdivisionValidator::getMinTrianglesAngle(), and butterfly::WSubdivisionValidator::isValidMaxNeighbourTriangleAngle().
|
static |
Calculate distance between two vertices.
point1 | Vertex 1. |
point2 | Vertex 2. |
Definition at line 245 of file WVertexFactory.cpp.
Referenced by butterfly::WSubdivisionValidator::flipTrianglesAtLowAngles(), butterfly::WSubdivisionValidator::generateStatisticalInformation(), butterfly::WSubdivisionValidator::getMinTrianglesAngle(), butterfly::WSubdivisionValidator::isValidMaxNeighbourTriangleAngle(), butterfly::WSubdivisionValidator::isValidSubdivision(), butterfly::WSubdivisionValidator::joinNarrowVertices(), and butterfly::WSubdivisionValidator::subdivideTriangleValidSum2().
WNewVertex * butterfly::WVertexFactory::getNewVertexProperty | ( | size_t | fromID, |
size_t | toID | ||
) |
Get properties of a new vertex which subdivides a line between two vertices.
fromID | The first neighbor vertex ID where the new vertex lies between. |
toID | The second neighbor vertex ID where the new vertex lies between. |
Definition at line 164 of file WVertexFactory.cpp.
References m_vertProp, and butterfly::WNewVertex::setValid().
Referenced by butterfly::WSubdivisionValidator::subdivideTriangle().
WVertexProperty * butterfly::WVertexFactory::getProperty | ( | size_t | vertexID | ) |
Get properties of a vertex.
vertexID | Vertex ID to get properties from. |
Definition at line 160 of file WVertexFactory.cpp.
References m_vertProp.
Referenced by butterfly::WButterflyFactory::addInterpolatedContent(), butterfly::WButterflyCalculator::calcNewVertex(), butterfly::WSubdivisionValidator::flipTrianglesAtLowAngles(), butterfly::WSubdivisionValidator::generateStatisticalInformation(), butterfly::WButterflyCalculator::getInterpolatedValue(), butterfly::WButterflyFactory::interpolateNewVerticesRange(), butterfly::WSubdivisionValidator::isValidMinAmountOfAverage(), butterfly::WSubdivisionValidator::isValidMinAmountOfMax(), and butterfly::WSubdivisionValidator::joinNarrowVertices().
size_t butterfly::WVertexFactory::getVertexCount | ( | ) |
Returns the Property List's vertex count.
Definition at line 84 of file WVertexFactory.cpp.
References m_vertexCount.
Referenced by butterfly::WButterflyFactory::examineVertexNeighborhood(), butterfly::WSubdivisionValidator::generateStatisticalInformation(), and butterfly::WButterflyFactory::getSubdividedMesh().
bool butterfly::WVertexFactory::isValidTriangle | ( | size_t | triangleID | ) |
Examine triangle by its ID for validity.
Currently it basically checks whether all vertex Ds are used once.
triangleID | ID of a triangle to examine. |
Definition at line 139 of file WVertexFactory.cpp.
References m_triangleMesh.
Referenced by butterfly::WButterflyFactory::addInterpolatedContent(), examineStencilRange(), and getAttachedTriangleIDs().
bool butterfly::WVertexFactory::newVertexExists | ( | size_t | fromID, |
size_t | toID | ||
) |
Returns whether properties of the subdividable new vertex between two vertices alreadey exists.
fromID | First connected vertex to the subdividable line. |
toID | Second connected vertex to the subdividable line. |
Definition at line 125 of file WVertexFactory.cpp.
References m_vertProp.
void butterfly::WVertexFactory::registerTriangle | ( | size_t | vertexID, |
size_t | triangleID | ||
) |
Registers triangle to all its vertex IDs.
vertexID | The triangle will be registered in the vertex of this ID. |
triangleID | Triangle ID to be registered. |
Definition at line 74 of file WVertexFactory.cpp.
References m_triangleCount, m_vertexCount, m_vertProp, and resize().
Referenced by butterfly::WButterflyFactory::examineVertexNeighborhood().
void butterfly::WVertexFactory::resize | ( | size_t | count | ) |
Resizes the Vertex property list to the wished size.
count | Required list size. |
Definition at line 60 of file WVertexFactory.cpp.
References m_vertexCount, and m_vertProp.
Referenced by registerTriangle().
void butterfly::WVertexFactory::setTriangleMesh | ( | std::shared_ptr< WTriangleMesh > | triangleMesh | ) |
Sets the WTriangleMesh.
It's necessary for the correct triangle mesh examination.
triangleMesh | Triangle mesh to be registered. |
Definition at line 55 of file WVertexFactory.cpp.
References m_triangleMesh.
Referenced by butterfly::WButterflyFactory::applyMeshPreprocessing().
|
private |
Triangle count.
Definition at line 211 of file WVertexFactory.h.
Referenced by getAttachedTriangleIDs(), registerTriangle(), and WVertexFactory().
|
private |
Assigned Triangle mesh.
It's necessary for the proper examination.
Definition at line 201 of file WVertexFactory.h.
Referenced by examineStencilRange(), get3rdVertexID(), isValidTriangle(), setTriangleMesh(), and WVertexFactory().
|
private |
Vertex count of the property list.
Definition at line 206 of file WVertexFactory.h.
Referenced by getVertexCount(), registerTriangle(), resize(), and WVertexFactory().
|
private |
Vertex properties data.
The valid size is not the actual vector size but vertexCount. It's been taken in order not to resize the whole array after each adding what would be a big performance drawback.
Definition at line 196 of file WVertexFactory.h.
Referenced by attachNewVertex(), examineStencilRange(), getAttachedTriangleIDs(), getNewVertexProperty(), getProperty(), newVertexExists(), registerTriangle(), resize(), and ~WVertexFactory().