OpenWalnut  1.5.0dev
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
butterfly::WVertexFactory Class Reference

Class that manages all vertex properties. More...

#include <WVertexFactory.h>

+ Collaboration diagram for butterfly::WVertexFactory:

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...
 
WVertexPropertygetProperty (size_t vertexID)
 Get properties of a vertex. More...
 
WNewVertexgetNewVertexProperty (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< WTriangleMeshm_triangleMesh
 Assigned Triangle mesh. More...
 
size_t m_vertexCount
 Vertex count of the property list. More...
 
size_t m_triangleCount
 Triangle count. More...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ WVertexFactory() [1/2]

butterfly::WVertexFactory::WVertexFactory ( std::shared_ptr< WTriangleMesh triangleMesh)
explicit

Creates a vertex factory object and assigns the triangle mesh that should be analyzed in future.

#

Parameters
triangleMeshAssociated triangle mesh that should be analyzed.

Definition at line 39 of file WVertexFactory.cpp.

References m_triangleCount, m_triangleMesh, and m_vertexCount.

◆ WVertexFactory() [2/2]

butterfly::WVertexFactory::WVertexFactory ( )

Creates a vertex factory object.

Definition at line 33 of file WVertexFactory.cpp.

References m_triangleCount, and m_vertexCount.

◆ ~WVertexFactory()

butterfly::WVertexFactory::~WVertexFactory ( )
virtual

Destroys the vertex factory object.

Definition at line 46 of file WVertexFactory.cpp.

References m_vertProp.

Referenced by butterfly::WButterflyFactory::getSubdividedMesh().

+ Here is the caller graph for this function:

Member Function Documentation

◆ add()

osg::Vec3 butterfly::WVertexFactory::add ( osg::Vec3  base,
osg::Vec3  sum,
float  factor 
)
static

Adding a sum multiplied by a factor to the base number.

Author
schwarzkopf
Parameters
baseThe base number to add the summand
sumSummand that is added to the base number
factorNumber that multiplies the summand
Returns
Base number + summand * factor

Definition at line 252 of file WVertexFactory.cpp.

Referenced by butterfly::WButterflyCalculator::calcNewVertex(), butterfly::WButterflyCalculator::getInterpolatedValue(), butterfly::WSubdivisionValidator::getValidatedSubdivision(), and butterfly::WSubdivisionValidator::joinNarrowVertices().

+ Here is the caller graph for this function:

◆ attachNewVertex()

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.

Author
schwarzkopf
Parameters
fromIDThe first neighbor vertex ID where the new vertex lies between.
toIDThe 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().

+ Here is the caller graph for this function:

◆ examineStencilRange()

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.

Author
schwarzkopf
Parameters
fromVertexFirst data set holding vertex property.
toVertexLast data set holding vertex property.
progressProgress 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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get3rdVertexID()

size_t butterfly::WVertexFactory::get3rdVertexID ( size_t  triangleID,
size_t  vertex1,
size_t  vertex2 
)

Returns the third vertex ID of a triangle.

Author
schwarzkopf
Parameters
triangleIDTriangle ID to examine.
vertex1First vertexID to exclude.
vertex2Second vertex ID to exclude.
Returns
Not excluded vertex ID.

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().

+ Here is the caller graph for this function:

◆ getAttachedTriangleIDs()

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.

Author
schwarzkopf
Parameters
excludedTriangleIDTriangle ID that should not be added to the returned list.
vertex1First vertex the triangle should lie on.
vertex2Second vertex the triangle should lie on.
Returns
All triangle IDs which lie on the two vertices but the triangleID.

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDistance()

float butterfly::WVertexFactory::getDistance ( osg::Vec3  point1,
osg::Vec3  point2 
)
static

◆ getNewVertexProperty()

WNewVertex * butterfly::WVertexFactory::getNewVertexProperty ( size_t  fromID,
size_t  toID 
)

Get properties of a new vertex which subdivides a line between two vertices.

Author
schwarzkopf
Parameters
fromIDThe first neighbor vertex ID where the new vertex lies between.
toIDThe second neighbor vertex ID where the new vertex lies between.
Returns
Pointer to the properties of the new vertex.

Definition at line 164 of file WVertexFactory.cpp.

References m_vertProp, and butterfly::WNewVertex::setValid().

Referenced by butterfly::WSubdivisionValidator::subdivideTriangle().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getProperty()

WVertexProperty * butterfly::WVertexFactory::getProperty ( size_t  vertexID)

◆ getVertexCount()

size_t butterfly::WVertexFactory::getVertexCount ( )

Returns the Property List's vertex count.

Returns
Vertex property count of the list.

Definition at line 84 of file WVertexFactory.cpp.

References m_vertexCount.

Referenced by butterfly::WButterflyFactory::examineVertexNeighborhood(), butterfly::WSubdivisionValidator::generateStatisticalInformation(), and butterfly::WButterflyFactory::getSubdividedMesh().

+ Here is the caller graph for this function:

◆ isValidTriangle()

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.

Parameters
triangleIDID of a triangle to examine.
Returns
Triangle is valid or not.

Definition at line 139 of file WVertexFactory.cpp.

References m_triangleMesh.

Referenced by butterfly::WButterflyFactory::addInterpolatedContent(), examineStencilRange(), and getAttachedTriangleIDs().

+ Here is the caller graph for this function:

◆ newVertexExists()

bool butterfly::WVertexFactory::newVertexExists ( size_t  fromID,
size_t  toID 
)

Returns whether properties of the subdividable new vertex between two vertices alreadey exists.

Author
schwarzkopf
Parameters
fromIDFirst connected vertex to the subdividable line.
toIDSecond connected vertex to the subdividable line.
Returns
Properties of a subdividable new vertex have been registered or not.

Definition at line 125 of file WVertexFactory.cpp.

References m_vertProp.

◆ registerTriangle()

void butterfly::WVertexFactory::registerTriangle ( size_t  vertexID,
size_t  triangleID 
)

Registers triangle to all its vertex IDs.

Author
schwarzkopf
Parameters
vertexIDThe triangle will be registered in the vertex of this ID.
triangleIDTriangle 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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resize()

void butterfly::WVertexFactory::resize ( size_t  count)

Resizes the Vertex property list to the wished size.

Author
schwarzkopf
Parameters
countRequired list size.

Definition at line 60 of file WVertexFactory.cpp.

References m_vertexCount, and m_vertProp.

Referenced by registerTriangle().

+ Here is the caller graph for this function:

◆ setTriangleMesh()

void butterfly::WVertexFactory::setTriangleMesh ( std::shared_ptr< WTriangleMesh triangleMesh)

Sets the WTriangleMesh.

It's necessary for the correct triangle mesh examination.

Author
schwarzkopf
Parameters
triangleMeshTriangle mesh to be registered.

Definition at line 55 of file WVertexFactory.cpp.

References m_triangleMesh.

Referenced by butterfly::WButterflyFactory::applyMeshPreprocessing().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_triangleCount

size_t butterfly::WVertexFactory::m_triangleCount
private

Triangle count.

Definition at line 211 of file WVertexFactory.h.

Referenced by getAttachedTriangleIDs(), registerTriangle(), and WVertexFactory().

◆ m_triangleMesh

std::shared_ptr< WTriangleMesh > butterfly::WVertexFactory::m_triangleMesh
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().

◆ m_vertexCount

size_t butterfly::WVertexFactory::m_vertexCount
private

Vertex count of the property list.

Definition at line 206 of file WVertexFactory.h.

Referenced by getVertexCount(), registerTriangle(), resize(), and WVertexFactory().

◆ m_vertProp

std::vector<WVertexProperty*> butterfly::WVertexFactory::m_vertProp
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().


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