OpenWalnut
1.5.0dev
|
Class that depicts the whole Butterfly subdivision algorithm but nothing more as such. More...
#include <WButterflyFactory.h>
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... | |
WSubdivisionValidator * | getValidator () |
Returns the Butterfly subdivision validator. More... | |
std::shared_ptr< WTriangleMesh > | getSubdividedMesh (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< WTriangleMesh > | m_inputMesh |
Base triangle mesh used for calculations. More... | |
std::shared_ptr< WTriangleMesh > | m_outputMesh |
Triangle mesh that is set up by interpolation. More... | |
WVertexFactory * | m_verts |
Data set used for analyzation of the triangle mesh. More... | |
WSubdivisionValidator * | m_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< WProgressCombiner > | m_associatedProgressCombiner |
Progress combiner for changing the plugin status in the modules overview. More... | |
std::shared_ptr< WProgress > | m_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... | |
WButterflyCalculator * | m_butterflyCalculator |
Instance for interpolating new vertices. More... | |
Class that depicts the whole Butterfly subdivision algorithm but nothing more as such.
Definition at line 45 of file WButterflyFactory.h.
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.
|
virtual |
Destroys the Butterfly instance object and its substructures.
Definition at line 48 of file WButterflyFactory.cpp.
|
private |
Adds interpolated vertices and triangles to the output triangle mesh.
Definition at line 220 of file WButterflyFactory.cpp.
References butterfly::WNewVertex::getCoordinate(), WVertexProperty::getNewVerticesToHigherNeighborID(), butterfly::WVertexFactory::getProperty(), butterfly::WNewVertex::isValid(), butterfly::WVertexFactory::isValidTriangle(), m_inputMesh, m_maxTriangles, m_outputMesh, m_progressStatus, m_triCount, m_validator, m_vertCount, m_verts, butterfly::WNewVertex::setNewVertexID(), and butterfly::WSubdivisionValidator::subdivideTriangle().
Referenced by getSubdividedMesh().
|
private |
Applies triangle mesh preprocessing if vertex flip or triangle flip setting is not default.
iteration | Preprocessing 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().
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.
associatedProgressCombiner | Progress combiner to be associated. |
Definition at line 68 of file WButterflyFactory.cpp.
References m_associatedProgressCombiner.
|
private |
Attachs new vertices that are used for the subdivision.
The data sets are only assigned. The calculation itself will be applied afterwards.
Definition at line 99 of file WButterflyFactory.cpp.
References butterfly::WVertexFactory::attachNewVertex(), m_inputMesh, m_progressStatus, m_triCount, and m_verts.
Referenced by examineVertexNeighborhood().
|
private |
Examines Butterfly stencils of all vertices and stores data.
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().
|
private |
Examine The triangle mesh before Butterfly subdivision.
Following steps are included:
iteration | Consecutive 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().
std::shared_ptr< WTriangleMesh > butterfly::WButterflyFactory::getSubdividedMesh | ( | std::shared_ptr< WTriangleMesh > | edgedMmesh | ) |
Launch the Butterfly subdivision.
Afterwards the interpolated Triangle mesh is returned.
edgedMmesh | Triangle mesh to be interpolated. |
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().
WSubdivisionValidator * butterfly::WButterflyFactory::getValidator | ( | ) |
Returns the Butterfly subdivision validator.
Therefore settings can be changed externally.
Definition at line 81 of file WButterflyFactory.cpp.
References m_validator.
Referenced by WMButterfly::moduleMain().
|
private |
Calculates coordinates of the new vertices.
It uses multithreading.
Definition at line 188 of file WButterflyFactory.cpp.
References interpolateNewVerticesRange(), m_cpuThreadCount, m_cpuThreads, and m_inputMesh.
Referenced by getSubdividedMesh().
|
private |
Calculates coordinates of the new vertices.
The 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. |
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().
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.
butterflySettingW | The general butterfly subdivision parameter w. |
Definition at line 52 of file WButterflyFactory.cpp.
References m_butterflyCalculator, and butterfly::WButterflyCalculator::setButterflySettingW().
Referenced by WMButterfly::moduleMain().
void butterfly::WButterflyFactory::setCpuThreadCount | ( | size_t | cpuThreadCount | ) |
Sets the count of CPU threads to use.
cpuThreadCount | CPU thread count to use. |
Definition at line 61 of file WButterflyFactory.cpp.
References m_cpuThreadCount, and m_cpuThreads.
Referenced by WMButterfly::moduleMain().
void butterfly::WButterflyFactory::setIterationsSettings | ( | float | m_iterations, |
float | m_maxTriangles10n | ||
) |
Assign main butterfly subdivision iterations settings.
m_iterations | Count how many times the butterfly subdivision should be iteratedly applied. |
m_maxTriangles10n | Maximal 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().
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.
iteration | Butterfly iteration step. |
steps | Scale of the progress bar. |
Definition at line 72 of file WButterflyFactory.cpp.
References m_associatedProgressCombiner, and m_progressStatus.
Referenced by getSubdividedMesh().
|
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().
|
private |
Instance for interpolating new vertices.
Definition at line 235 of file WButterflyFactory.h.
Referenced by examineVertexNeighborhood(), interpolateNewVerticesRange(), setButterflySettingW(), and WButterflyFactory().
|
private |
CPU threads count for multithreading support.
Definition at line 225 of file WButterflyFactory.h.
Referenced by examineStencilAll(), interpolateNewVertices(), setCpuThreadCount(), and WButterflyFactory().
|
private |
CPU threads object for multithreading support.
Definition at line 230 of file WButterflyFactory.h.
Referenced by examineStencilAll(), interpolateNewVertices(), and setCpuThreadCount().
|
private |
Base triangle mesh used for calculations.
Definition at line 185 of file WButterflyFactory.h.
Referenced by addInterpolatedContent(), applyMeshPreprocessing(), attachUncalculatedNewVertices(), examineStencilAll(), examineVertexNeighborhood(), getSubdividedMesh(), and interpolateNewVertices().
|
private |
Iteration steps to apply iteratedly.
Definition at line 175 of file WButterflyFactory.h.
Referenced by getSubdividedMesh(), setIterationsSettings(), and WButterflyFactory().
|
private |
Maximal allowed triangle count applyable for subdivision.
Definition at line 180 of file WButterflyFactory.h.
Referenced by addInterpolatedContent(), getSubdividedMesh(), setIterationsSettings(), and WButterflyFactory().
|
private |
Triangle mesh that is set up by interpolation.
Definition at line 190 of file WButterflyFactory.h.
Referenced by addInterpolatedContent(), examineVertexNeighborhood(), and getSubdividedMesh().
|
private |
Current progress status.
Definition at line 220 of file WButterflyFactory.h.
Referenced by addInterpolatedContent(), attachUncalculatedNewVertices(), examineStencilAll(), examineVertexNeighborhood(), getSubdividedMesh(), interpolateNewVerticesRange(), and setProgressSettings().
|
private |
Total triangle count.
Definition at line 205 of file WButterflyFactory.h.
Referenced by addInterpolatedContent(), attachUncalculatedNewVertices(), examineVertexNeighborhood(), and WButterflyFactory().
|
private |
Triangle mesh validation instance.
Definition at line 200 of file WButterflyFactory.h.
Referenced by addInterpolatedContent(), applyMeshPreprocessing(), examineVertexNeighborhood(), getSubdividedMesh(), getValidator(), interpolateNewVerticesRange(), and WButterflyFactory().
|
private |
Current count of currently added vertices during interpolation.
Definition at line 210 of file WButterflyFactory.h.
Referenced by addInterpolatedContent(), getSubdividedMesh(), and WButterflyFactory().
|
private |
Data set used for analyzation of the triangle mesh.
Definition at line 195 of file WButterflyFactory.h.
Referenced by addInterpolatedContent(), applyMeshPreprocessing(), attachUncalculatedNewVertices(), examineStencilAll(), examineVertexNeighborhood(), getSubdividedMesh(), interpolateNewVerticesRange(), and WButterflyFactory().