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

Class that depicts the whole Butterfly subdivision algorithm but nothing more as such. More...

#include <WButterflyFactory.h>

+ Collaboration diagram for butterfly::WButterflyFactory:

Public Member Functions

 WButterflyFactory ()
 Butterfly subdivision tool object creating instance. More...
 
virtual ~WButterflyFactory ()
 Destroys the Butterfly instance object and its substructures. More...
 
void setButterflySettingW (float butterflySettingW)
 Set the general Butterfly Subdivision setting w that affects the subdivision. More...
 
void setIterationsSettings (float m_iterations, float m_maxTriangles10n)
 Assign main butterfly subdivision iterations settings. More...
 
void setCpuThreadCount (size_t cpuThreadCount)
 Sets the count of CPU threads to use. More...
 
void assignProgressCombiner (std::shared_ptr< WProgressCombiner > associatedProgressCombiner)
 Assigns a ProbressCombiner to the Butterfly factory. More...
 
void setProgressSettings (size_t iteration, size_t steps)
 Sets progress which iteration step and kind of cumputing step is currently done. More...
 
WSubdivisionValidatorgetValidator ()
 Returns the Butterfly subdivision validator. More...
 
std::shared_ptr< WTriangleMeshgetSubdividedMesh (std::shared_ptr< WTriangleMesh > edgedMmesh)
 Launch the Butterfly subdivision. More...
 

Private Member Functions

void examineStencilAll ()
 Examines Butterfly stencils of all vertices and stores data. More...
 
void attachUncalculatedNewVertices ()
 Attachs new vertices that are used for the subdivision. More...
 
void applyMeshPreprocessing (size_t iteration)
 Applies triangle mesh preprocessing if vertex flip or triangle flip setting is not default. More...
 
void examineVertexNeighborhood (size_t iteration)
 Examine The triangle mesh before Butterfly subdivision. More...
 
void interpolateNewVertices ()
 Calculates coordinates of the new vertices. More...
 
void interpolateNewVerticesRange (size_t fromVertex, size_t toVertex)
 Calculates coordinates of the new vertices. More...
 
void addInterpolatedContent ()
 Adds interpolated vertices and triangles to the output triangle mesh. More...
 

Private Attributes

size_t m_iterations
 Iteration steps to apply iteratedly. More...
 
size_t m_maxTriangles
 Maximal allowed triangle count applyable for subdivision. More...
 
std::shared_ptr< WTriangleMeshm_inputMesh
 Base triangle mesh used for calculations. More...
 
std::shared_ptr< WTriangleMeshm_outputMesh
 Triangle mesh that is set up by interpolation. More...
 
WVertexFactorym_verts
 Data set used for analyzation of the triangle mesh. More...
 
WSubdivisionValidatorm_validator
 Triangle mesh validation instance. More...
 
size_t m_triCount
 Total triangle count. More...
 
size_t m_vertCount
 Current count of currently added vertices during interpolation. More...
 
std::shared_ptr< WProgressCombinerm_associatedProgressCombiner
 Progress combiner for changing the plugin status in the modules overview. More...
 
std::shared_ptr< WProgressm_progressStatus
 Current progress status. More...
 
size_t m_cpuThreadCount
 CPU threads count for multithreading support. More...
 
vector< boost::thread * > m_cpuThreads
 CPU threads object for multithreading support. More...
 
WButterflyCalculatorm_butterflyCalculator
 Instance for interpolating new vertices. More...
 

Detailed Description

Class that depicts the whole Butterfly subdivision algorithm but nothing more as such.

Definition at line 45 of file WButterflyFactory.h.

Constructor & Destructor Documentation

◆ WButterflyFactory()

butterfly::WButterflyFactory::WButterflyFactory ( )

Butterfly subdivision tool object creating instance.

Definition at line 36 of file WButterflyFactory.cpp.

References m_butterflyCalculator, m_cpuThreadCount, m_iterations, m_maxTriangles, m_triCount, m_validator, m_vertCount, and m_verts.

◆ ~WButterflyFactory()

butterfly::WButterflyFactory::~WButterflyFactory ( )
virtual

Destroys the Butterfly instance object and its substructures.

Definition at line 48 of file WButterflyFactory.cpp.

Member Function Documentation

◆ addInterpolatedContent()

void butterfly::WButterflyFactory::addInterpolatedContent ( )
private

◆ applyMeshPreprocessing()

void butterfly::WButterflyFactory::applyMeshPreprocessing ( size_t  iteration)
private

Applies triangle mesh preprocessing if vertex flip or triangle flip setting is not default.

Author
schwarzkopf
Parameters
iterationPreprocessing is applied only before the first iteration

Definition at line 112 of file WButterflyFactory.cpp.

References butterfly::WSubdivisionValidator::flipTrianglesAtLowAngles(), butterfly::WSubdivisionValidator::joinNarrowVertices(), m_inputMesh, m_validator, m_verts, butterfly::WSubdivisionValidator::setTriangleMesh(), and butterfly::WVertexFactory::setTriangleMesh().

Referenced by examineVertexNeighborhood().

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

◆ assignProgressCombiner()

void butterfly::WButterflyFactory::assignProgressCombiner ( std::shared_ptr< WProgressCombiner associatedProgressCombiner)

Assigns a ProbressCombiner to the Butterfly factory.

After that the algorithm will be able to actualize the progress within the module overview.

Author
schwarzkopf
Parameters
associatedProgressCombinerProgress combiner to be associated.

Definition at line 68 of file WButterflyFactory.cpp.

References m_associatedProgressCombiner.

◆ attachUncalculatedNewVertices()

void butterfly::WButterflyFactory::attachUncalculatedNewVertices ( )
private

Attachs new vertices that are used for the subdivision.

The data sets are only assigned. The calculation itself will be applied afterwards.

Author
schwarzkopf

Definition at line 99 of file WButterflyFactory.cpp.

References butterfly::WVertexFactory::attachNewVertex(), m_inputMesh, m_progressStatus, m_triCount, and m_verts.

Referenced by examineVertexNeighborhood().

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

◆ examineStencilAll()

void butterfly::WButterflyFactory::examineStencilAll ( )
private

Examines Butterfly stencils of all vertices and stores data.

Author
schwarzkopf

Definition at line 85 of file WButterflyFactory.cpp.

References butterfly::WVertexFactory::examineStencilRange(), m_cpuThreadCount, m_cpuThreads, m_inputMesh, m_progressStatus, and m_verts.

Referenced by examineVertexNeighborhood().

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

◆ examineVertexNeighborhood()

void butterfly::WButterflyFactory::examineVertexNeighborhood ( size_t  iteration)
private

Examine The triangle mesh before Butterfly subdivision.

Following steps are included:

  • Register all triangles to corresponding vertices
  • Optionally preprocess Triangle mesh.
  • Examine Butterfly stencils (Vertex neighbours only) and valence of all vertices
  • Collect statistical information required for validation of subdividable new vertices. Currently it includes maximal and averate neighbour distance from each vertex.
    Author
    schwarzkopf
    Parameters
    iterationConsecutive Iteration step of the Butterfly subdivision.

Definition at line 124 of file WButterflyFactory.cpp.

References applyMeshPreprocessing(), butterfly::WButterflyCalculator::assignInputMesh(), attachUncalculatedNewVertices(), examineStencilAll(), butterfly::WSubdivisionValidator::generateStatisticalInformation(), butterfly::WVertexFactory::getVertexCount(), m_butterflyCalculator, m_inputMesh, m_outputMesh, m_progressStatus, m_triCount, m_validator, m_verts, butterfly::WVertexFactory::registerTriangle(), and butterfly::WSubdivisionValidator::setTriangleMesh().

Referenced by getSubdividedMesh().

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

◆ getSubdividedMesh()

std::shared_ptr< WTriangleMesh > butterfly::WButterflyFactory::getSubdividedMesh ( std::shared_ptr< WTriangleMesh edgedMmesh)

Launch the Butterfly subdivision.

Afterwards the interpolated Triangle mesh is returned.

Parameters
edgedMmeshTriangle mesh to be interpolated.
Returns
Interpolated triangle mesh.

Definition at line 151 of file WButterflyFactory.cpp.

References addInterpolatedContent(), examineVertexNeighborhood(), butterfly::WSubdivisionValidator::getMinSubdividedLineLength(), butterfly::WSubdivisionValidator::getMinSubdividedLineLengthMultiplierPerIteration(), butterfly::WVertexFactory::getVertexCount(), interpolateNewVertices(), m_inputMesh, m_iterations, m_maxTriangles, m_outputMesh, m_progressStatus, m_validator, m_vertCount, m_verts, butterfly::WSubdivisionValidator::setMinSubdividedLineLength(), setProgressSettings(), and butterfly::WVertexFactory::~WVertexFactory().

Referenced by WMButterfly::moduleMain().

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

◆ getValidator()

WSubdivisionValidator * butterfly::WButterflyFactory::getValidator ( )

Returns the Butterfly subdivision validator.

Therefore settings can be changed externally.

Author
schwarzkopf
Returns
Subdivision validator pointer.

Definition at line 81 of file WButterflyFactory.cpp.

References m_validator.

Referenced by WMButterfly::moduleMain().

+ Here is the caller graph for this function:

◆ interpolateNewVertices()

void butterfly::WButterflyFactory::interpolateNewVertices ( )
private

Calculates coordinates of the new vertices.

It uses multithreading.

Author
schwarzkopf

Definition at line 188 of file WButterflyFactory.cpp.

References interpolateNewVerticesRange(), m_cpuThreadCount, m_cpuThreads, and m_inputMesh.

Referenced by getSubdividedMesh().

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

◆ interpolateNewVerticesRange()

void butterfly::WButterflyFactory::interpolateNewVerticesRange ( size_t  fromVertex,
size_t  toVertex 
)
private

Calculates coordinates of the new vertices.

The 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.

Definition at line 202 of file WButterflyFactory.cpp.

References butterfly::WButterflyCalculator::calcNewVertex(), WVertexProperty::getNewVerticesToHigherNeighborID(), butterfly::WVertexFactory::getProperty(), butterfly::WNewVertex::getToID(), butterfly::WSubdivisionValidator::getValidatedSubdivision(), butterfly::WSubdivisionValidator::isValidSubdivision(), m_butterflyCalculator, m_progressStatus, m_validator, m_verts, butterfly::WNewVertex::setCoordinate(), and butterfly::WNewVertex::setValid().

Referenced by interpolateNewVertices().

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

◆ setButterflySettingW()

void butterfly::WButterflyFactory::setButterflySettingW ( float  butterflySettingW)

Set the general Butterfly Subdivision setting w that affects the subdivision.

See the algorithm documentation for the exact meaning. It's usually chosen substantially small. The original authors used 0.0f.

Author
schwarzkopf
Parameters
butterflySettingWThe general butterfly subdivision parameter w.

Definition at line 52 of file WButterflyFactory.cpp.

References m_butterflyCalculator, and butterfly::WButterflyCalculator::setButterflySettingW().

Referenced by WMButterfly::moduleMain().

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

◆ setCpuThreadCount()

void butterfly::WButterflyFactory::setCpuThreadCount ( size_t  cpuThreadCount)

Sets the count of CPU threads to use.

Author
schwarzkopf
Parameters
cpuThreadCountCPU thread count to use.

Definition at line 61 of file WButterflyFactory.cpp.

References m_cpuThreadCount, and m_cpuThreads.

Referenced by WMButterfly::moduleMain().

+ Here is the caller graph for this function:

◆ setIterationsSettings()

void butterfly::WButterflyFactory::setIterationsSettings ( float  m_iterations,
float  m_maxTriangles10n 
)

Assign main butterfly subdivision iterations settings.

Author
schwarzkopf
Parameters
m_iterationsCount how many times the butterfly subdivision should be iteratedly applied.
m_maxTriangles10nMaximal triangle count. If there are more triangles then the subdivision will be stop.

Definition at line 56 of file WButterflyFactory.cpp.

References m_iterations, and m_maxTriangles.

Referenced by WMButterfly::moduleMain().

+ Here is the caller graph for this function:

◆ setProgressSettings()

void butterfly::WButterflyFactory::setProgressSettings ( size_t  iteration,
size_t  steps 
)

Sets progress which iteration step and kind of cumputing step is currently done.

The scale of the computing step is also set.

Author
schwarzkopf
Parameters
iterationButterfly iteration step.
stepsScale of the progress bar.

Definition at line 72 of file WButterflyFactory.cpp.

References m_associatedProgressCombiner, and m_progressStatus.

Referenced by getSubdividedMesh().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_associatedProgressCombiner

std::shared_ptr< WProgressCombiner > butterfly::WButterflyFactory::m_associatedProgressCombiner
private

Progress combiner for changing the plugin status in the modules overview.

Definition at line 215 of file WButterflyFactory.h.

Referenced by assignProgressCombiner(), and setProgressSettings().

◆ m_butterflyCalculator

WButterflyCalculator* butterfly::WButterflyFactory::m_butterflyCalculator
private

Instance for interpolating new vertices.

Definition at line 235 of file WButterflyFactory.h.

Referenced by examineVertexNeighborhood(), interpolateNewVerticesRange(), setButterflySettingW(), and WButterflyFactory().

◆ m_cpuThreadCount

size_t butterfly::WButterflyFactory::m_cpuThreadCount
private

CPU threads count for multithreading support.

Definition at line 225 of file WButterflyFactory.h.

Referenced by examineStencilAll(), interpolateNewVertices(), setCpuThreadCount(), and WButterflyFactory().

◆ m_cpuThreads

vector<boost::thread*> butterfly::WButterflyFactory::m_cpuThreads
private

CPU threads object for multithreading support.

Definition at line 230 of file WButterflyFactory.h.

Referenced by examineStencilAll(), interpolateNewVertices(), and setCpuThreadCount().

◆ m_inputMesh

std::shared_ptr< WTriangleMesh > butterfly::WButterflyFactory::m_inputMesh
private

◆ m_iterations

size_t butterfly::WButterflyFactory::m_iterations
private

Iteration steps to apply iteratedly.

Definition at line 175 of file WButterflyFactory.h.

Referenced by getSubdividedMesh(), setIterationsSettings(), and WButterflyFactory().

◆ m_maxTriangles

size_t butterfly::WButterflyFactory::m_maxTriangles
private

Maximal allowed triangle count applyable for subdivision.

Definition at line 180 of file WButterflyFactory.h.

Referenced by addInterpolatedContent(), getSubdividedMesh(), setIterationsSettings(), and WButterflyFactory().

◆ m_outputMesh

std::shared_ptr< WTriangleMesh > butterfly::WButterflyFactory::m_outputMesh
private

Triangle mesh that is set up by interpolation.

Definition at line 190 of file WButterflyFactory.h.

Referenced by addInterpolatedContent(), examineVertexNeighborhood(), and getSubdividedMesh().

◆ m_progressStatus

std::shared_ptr< WProgress > butterfly::WButterflyFactory::m_progressStatus
private

◆ m_triCount

size_t butterfly::WButterflyFactory::m_triCount
private

◆ m_validator

WSubdivisionValidator* butterfly::WButterflyFactory::m_validator
private

◆ m_vertCount

size_t butterfly::WButterflyFactory::m_vertCount
private

Current count of currently added vertices during interpolation.

Definition at line 210 of file WButterflyFactory.h.

Referenced by addInterpolatedContent(), getSubdividedMesh(), and WButterflyFactory().

◆ m_verts

WVertexFactory* butterfly::WButterflyFactory::m_verts
private

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