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

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

#include <WButterflyCalculator.h>

+ Collaboration diagram for butterfly::WButterflyCalculator:

Public Member Functions

 WButterflyCalculator ()
 Butterfly subdivision tool object creating instance. More...
 
virtual ~WButterflyCalculator ()
 Destroys the Butterfly instance object and its substructures. More...
 
void assignInputMesh (std::shared_ptr< WTriangleMesh > inputMesh, WVertexFactory *vertexProperties)
 Assigns the input mesh andd its analyzed data that are required for the butterfly subdivision. More...
 
void setButterflySettingW (float butterflySettingW)
 Set the general Butterfly Subdivision setting w that affects the subdivision. More...
 
osg::Vec3 calcNewVertex (size_t vertID1, size_t vertID2)
 Calculate the subdivided new vertex between two vertices using the Butterfly Subdivision. More...
 

Private Member Functions

osg::Vec3 calcMean (size_t vertID1, size_t vertID2)
 Calculate a subdivided mit point between two vertices using the mean calculation. More...
 
Vec3 getInterpolatedValue (size_t stencilCenterVertID, size_t directedNeighbourVertID, bool isIrregular)
 Calculate the coordinates of a stencil half using the Butterfly subdivision algorithm. More...
 

Private Attributes

WVertexFactorym_verts
 Associated data set used for analyzation of the triangle mesh. More...
 
std::shared_ptr< WTriangleMeshm_inputMesh
 Base triangle mesh used for calculations. More...
 

Static Private Attributes

static float m_w = 0.0f
 The general Butterfly Subdivision setting w that affects the subdivision. More...
 
static float m_weights [4][7]
 Butterfly subdivision Weights for each neighbor which always are applied for valences 3 and 4. More...
 
static float m_weightCenterAtBorder = 9.0f / 16.0f
 Weight where both stencil centers lie on a border. More...
 
static float m_weightRimAtBorder = -1.0f / 16.0f
 Weight where both stencil centers lie on a border. More...
 

Detailed Description

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

Definition at line 53 of file WButterflyCalculator.h.

Constructor & Destructor Documentation

◆ WButterflyCalculator()

butterfly::WButterflyCalculator::WButterflyCalculator ( )

Butterfly subdivision tool object creating instance.

Definition at line 54 of file WButterflyCalculator.cpp.

References m_verts.

◆ ~WButterflyCalculator()

butterfly::WButterflyCalculator::~WButterflyCalculator ( )
virtual

Destroys the Butterfly instance object and its substructures.

Definition at line 59 of file WButterflyCalculator.cpp.

Member Function Documentation

◆ assignInputMesh()

void butterfly::WButterflyCalculator::assignInputMesh ( std::shared_ptr< WTriangleMesh inputMesh,
WVertexFactory vertexProperties 
)

Assigns the input mesh andd its analyzed data that are required for the butterfly subdivision.

Author
schwarzkopf
Parameters
inputMeshTriangle mesh that should be subdivided
vertexPropertiesThe analyzed data of the input triangle mesh

Definition at line 63 of file WButterflyCalculator.cpp.

References m_inputMesh, and m_verts.

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

+ Here is the caller graph for this function:

◆ calcMean()

Vec3 butterfly::WButterflyCalculator::calcMean ( size_t  vertID1,
size_t  vertID2 
)
private

Calculate a subdivided mit point between two vertices using the mean calculation.

Author
schwarzkopf
Parameters
vertID1First vertex to subdivide between.
vertID2Second vertex ID to subdivide between.
Returns
Mean between the two vertices.

Definition at line 127 of file WButterflyCalculator.cpp.

References m_inputMesh.

Referenced by calcNewVertex().

+ Here is the caller graph for this function:

◆ calcNewVertex()

osg::Vec3 butterfly::WButterflyCalculator::calcNewVertex ( size_t  vertID1,
size_t  vertID2 
)

Calculate the subdivided new vertex between two vertices using the Butterfly Subdivision.

algorithm.

Author
schwarzkopf
Parameters
vertID1First vertex to subdivide between.
vertID2Second vertex ID to subdivide between
Returns
Calculated coordinates.

Definition at line 80 of file WButterflyCalculator.cpp.

References butterfly::WVertexFactory::add(), calcMean(), WVertexProperty::getBoundClass(), getInterpolatedValue(), butterfly::WVertexFactory::getProperty(), WVertexProperty::getStencilNeighbourID(), WVertexProperty::getStencilNeighbourIndex(), WVertexProperty::getValence(), m_inputMesh, m_verts, m_weightCenterAtBorder, and m_weightRimAtBorder.

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

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

◆ getInterpolatedValue()

Vec3 butterfly::WButterflyCalculator::getInterpolatedValue ( size_t  stencilCenterVertID,
size_t  directedNeighbourVertID,
bool  isIrregular 
)
private

Calculate the coordinates of a stencil half using the Butterfly subdivision algorithm.

Parameters
stencilCenterVertIDVertex ID of the stencil center. Coordinates are calculated for that value.
directedNeighbourVertIDVertex ID of the other half of the whole butterfly stencil.
isIrregularCalculate stencil half as an irregular. False is set calculating a Stencil where both valences are 6.
Returns
Interpolated coordinates.

Definition at line 136 of file WButterflyCalculator.cpp.

References butterfly::WVertexFactory::add(), butterfly::WVertexFactory::getProperty(), WVertexProperty::getStencilNeighbourIndex(), m_inputMesh, m_verts, and m_weights.

Referenced by calcNewVertex().

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

◆ setButterflySettingW()

void butterfly::WButterflyCalculator::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 69 of file WButterflyCalculator.cpp.

References m_w, and m_weights.

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

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_inputMesh

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

Base triangle mesh used for calculations.

Definition at line 150 of file WButterflyCalculator.h.

Referenced by assignInputMesh(), calcMean(), calcNewVertex(), and getInterpolatedValue().

◆ m_verts

WVertexFactory* butterfly::WButterflyCalculator::m_verts
private

Associated data set used for analyzation of the triangle mesh.

Definition at line 145 of file WButterflyCalculator.h.

Referenced by assignInputMesh(), calcNewVertex(), getInterpolatedValue(), and WButterflyCalculator().

◆ m_w

float butterfly::WButterflyCalculator::m_w = 0.0f
staticprivate

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.

Definition at line 101 of file WButterflyCalculator.h.

Referenced by setButterflySettingW().

◆ m_weightCenterAtBorder

float butterfly::WButterflyCalculator::m_weightCenterAtBorder = 9.0f / 16.0f
staticprivate

Weight where both stencil centers lie on a border.

This weight is for a stencil center.

Definition at line 114 of file WButterflyCalculator.h.

Referenced by calcNewVertex().

◆ m_weightRimAtBorder

float butterfly::WButterflyCalculator::m_weightRimAtBorder = -1.0f / 16.0f
staticprivate

Weight where both stencil centers lie on a border.

This weight is beside the stencil centers.

Definition at line 120 of file WButterflyCalculator.h.

Referenced by calcNewVertex().

◆ m_weights

float butterfly::WButterflyCalculator::m_weights
staticprivate
Initial value:
=
{{0.75f, 5.0f / 12.0f, -1.0f / 12.0f, -1.0f / 12.0f, 0.0f, 0.0f, 0.0f},
{0.875f, 3.0f / 8.0f, -1.0f / 8.0f, 0.0f, -1.0f / 8.0f, 0.0f, 0.0f},
{0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f},
{0.5f - m_w, 0.0f, 0.0625f + m_w, -0.0625f - m_w, m_w, -0.0625f - m_w, 0.0625f + m_w}}
static float m_w
The general Butterfly Subdivision setting w that affects the subdivision.

Butterfly subdivision Weights for each neighbor which always are applied for valences 3 and 4.

Valence 6 is applied for Butterfly stencils where both valences are 6. The first row starts with valence 6. The first column starts with the center vertex weight. Then comes the Neighbor vertex connected to the other stencil center vertex.

Definition at line 109 of file WButterflyCalculator.h.

Referenced by getInterpolatedValue(), and setButterflySettingW().


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