OpenWalnut  1.5.0dev
Public Types | Public Member Functions | Static Public Member Functions | Static Protected Attributes | Private Member Functions | Private Attributes | Friends | List of all members
WTriangleMesh Class Reference

Triangle mesh data structure allowing for convenient access of the elements. More...

#include <WTriangleMesh.h>

+ Inheritance diagram for WTriangleMesh:
+ Collaboration diagram for WTriangleMesh:

Public Types

typedef std::shared_ptr< WTriangleMeshSPtr
 Shared pointer. More...
 
typedef std::shared_ptr< const WTriangleMeshConstSPtr
 Const shared pointer. More...
 

Public Member Functions

 WTriangleMesh (size_t vertNum, size_t triangleNum)
 constructor that already reserves space for a given number of triangles and vertexes More...
 
 WTriangleMesh (osg::ref_ptr< osg::Vec3Array > vertices, const std::vector< size_t > &triangles)
 Constructs a new mesh out of the given vertices and triangles. More...
 
virtual ~WTriangleMesh ()
 destructor More...
 
virtual const std::string getName () const
 Gets the name of this prototype. More...
 
virtual const std::string getDescription () const
 Gets the description for this prototype. More...
 
size_t addVertex (osg::Vec3 vert)
 adds a vertex position to the mesh More...
 
size_t addVertex (float x, float y, float z)
 adds a vertex position to the mesh More...
 
size_t addVertex (WPosition vert)
 adds a vertex position to the mesh More...
 
void addTextureCoordinate (osg::Vec3 texCoord)
 Adds a texture coordinate for the vertex. More...
 
void addTextureCoordinate (float x, float y, float z)
 Adds a texture coordinate for the vertex. More...
 
void addTriangle (size_t vert0, size_t vert1, size_t vert2)
 adds a tringle to the mesh More...
 
void addTriangle (osg::Vec3 vert0, osg::Vec3 vert1, osg::Vec3 vert2)
 adds a tringle and its 3 vertexes to the mesh More...
 
void setVertex (size_t index, osg::Vec3 vert)
 sets a vertex to a new position More...
 
void setVertexNormal (size_t index, osg::Vec3 normal)
 sets the normal for a given vertex More...
 
void setVertexNormal (size_t index, float x, float y, float z)
 sets the normal for a given vertex More...
 
void setVertexNormal (size_t index, WPosition normal)
 sets the normal for a given vertex More...
 
void setVertexColor (size_t index, osg::Vec4 color)
 sets the color for a given vertex More...
 
void setTriangleColor (size_t index, osg::Vec4 color)
 sets the color for a given triangle More...
 
void setTextureCoord (std::size_t index, osg::Vec3 texCoord)
 Set a texture coordinate. More...
 
osg::ref_ptr< osg::Vec4Array > getTriangleColors () const
 Return triangle colors. More...
 
osg::ref_ptr< osg::Vec3Array > getVertexArray ()
 getter More...
 
osg::ref_ptr< const osg::Vec3Array > getVertexArray () const
 Returns a const reference pointer to the vertex array. More...
 
osg::ref_ptr< osg::Vec3Array > getTextureCoordinateArray ()
 Returns a reference pointer to the texture coordinate array. More...
 
osg::ref_ptr< const osg::Vec3Array > getTextureCoordinateArray () const
 Returns a const reference pointer to the texture coordinate array. More...
 
osg::ref_ptr< osg::Vec3Array > getVertexNormalArray (bool forceRecalc=false)
 Get normal array containing smooth normals for each vertex. More...
 
osg::ref_ptr< osg::Vec3Array > getVertexFlatNormalArray (bool forceRecalc=false)
 Get the normal array with flat normals for each vertex. More...
 
osg::ref_ptr< osg::Vec4Array > getVertexColorArray ()
 Color array with a color for each vertex. More...
 
const std::vector< size_t > & getTriangles () const
 Returns a const reference to the vertex ids of the triangles. More...
 
osg::ref_ptr< osg::Vec3Array > getTriangleNormalArray (bool forceRecalc=false)
 Normal per triangle. More...
 
osg::Vec3 getVertex (size_t index) const
 getter More...
 
osg::Vec4 getVertColor (size_t index) const
 getter More...
 
osg::Vec3 getTriVert (size_t triId, size_t vertNum)
 getter More...
 
WVector3d getNormal (size_t index)
 getter More...
 
size_t vertSize () const
 getter More...
 
size_t triangleSize () const
 getter More...
 
void doLoopSubD ()
 performs a loop subdivision on the triangle mesh More...
 
size_t getTriVertId0 (size_t triId) const
 returns the id of the first vertex of a triangle More...
 
size_t getTriVertId1 (size_t triId) const
 returns the id of the second vertex of a triangle More...
 
size_t getTriVertId2 (size_t triId) const
 return the id of the third vertex of a triangle More...
 
void addMesh (std::shared_ptr< WTriangleMesh > mesh, float xOff=0., float yOff=0., float zOff=0.)
 adds a mesh to the existing, no check for duplicate vertexes is performed, an additional vector may be specified to move the mesh to add More...
 
void translateMesh (float xOff, float yOff, float zOff)
 moves the entire mesh to a new postion More...
 
void zoomMesh (float zoom)
 multiplies the vertex vectors of the mesh with a given number More...
 
bool operator== (const WTriangleMesh &rhs) const
 Checks if two meshes are exactly the same. More...
 
void rescaleVertexColors ()
 Rescale the vertex colors so that the maximum of all r, g and b values is 1. More...
 
void performFeaturePreservingSmoothing (float sigmaDistance, float sigmaInfluence)
 Implements the feature-preserving mesh smoothing algorithm of Jones et al. More...
 
void estimateCurvature ()
 Estimates the normal curvatures and their principal directions for every vertex using the algorithm of: More...
 
double getMainCurvature (std::size_t vtxId) const
 Retreive the main (maximum) curvature of a vertex. More...
 
double getSecondaryCurvature (std::size_t vtxId) const
 Retreive the secondary (minimum) curvature of a vertex. More...
 
std::shared_ptr< std::vector< float > > const & getMainCurvatures () const
 Get the vector of main curvature values. More...
 
std::shared_ptr< std::vector< float > > const & getSecondaryCurvatures () const
 Get the vector of secondary curvature values. More...
 
osg::Vec3 getCurvatureMainPrincipalDirection (std::size_t vtxId) const
 Retreive the 3d principal direction of curvature of a vertex. More...
 
osg::Vec3 getCurvatureSecondaryPrincipalDirection (std::size_t vtxId) const
 Retreive the 3d principal direction of curvature for the minimum normal curvature of a vertex. More...
 
osg::ref_ptr< osg::Vec3Array > getMainPrincipalCurvatureDirectionArray ()
 Retreive the array of principal directions e.g. More...
 
osg::ref_ptr< osg::Vec3Array > getSecondaryPrincipalCurvatureDirectionArray ()
 Retreive the array of principal directions e.g. More...
 
void recalcVertNormals ()
 recalculates the vertex normals More...
 
void setAutoRecalcNormals (bool autoRecalc=true)
 Set this to true to force automatic normal calculation. More...
 
- Public Member Functions inherited from WTransferable
 WTransferable ()
 Default constructor. More...
 
virtual ~WTransferable ()
 Destructor. More...
 
- Public Member Functions inherited from WPrototyped
 WPrototyped ()
 Default constructor. More...
 
virtual ~WPrototyped ()
 Destructor. More...
 
template<typename T >
bool isA ()
 Checks whether the actual prototype has the specified runtime type. More...
 

Static Public Member Functions

static std::shared_ptr< WPrototypedgetPrototype ()
 Returns a prototype instantiated with the true type of the deriving class. More...
 

Static Protected Attributes

static std::shared_ptr< WPrototypedm_prototype = std::shared_ptr< WPrototyped >()
 The prototype as singleton. More...
 

Private Member Functions

 WTriangleMesh ()
 we don't allow the standard constructor More...
 
void removeVertex (size_t index)
 removes a vertex from the vertex array, if any triangles still index that vertex they will be removed if forceRemoveTriangle is true More...
 
void removeTriangle (size_t index)
 removes a triangle from the mesh More...
 
osg::Vec3 calcTriangleNormal (size_t triangle)
 calculates a normal from the 3 points in space defining a triangle More...
 
osg::Vec3 calcNormal (osg::Vec3 vert0, osg::Vec3 vert1, osg::Vec3 vert2)
 calculates a normal from the 3 points in space More...
 
void updateVertsInTriangles ()
 updates the list for which vertexes appear in which triangle More...
 
void calcNeighbors ()
 calculates neighbor information for triangles More...
 
size_t getNeighbor (const size_t coVert1, const size_t coVert2, const size_t triangleNum)
 returns the triangle index of a triangle neighboring a given edge of a vertex More...
 
void setTriVert0 (size_t triId, size_t vertId)
 higher level access function to the triangle vector, sets the first vertex of a triangle to a given vertex id More...
 
void setTriVert1 (size_t triId, size_t vertId)
 higher level access function to the triangle vector, sets the second vertex of a triangle to a given vertex id More...
 
void setTriVert2 (size_t triId, size_t vertId)
 higher level access function to the triangle vector, sets the third vertex of a triangle to a given vertex id More...
 
void loopSetTriangle (size_t triId, size_t vertId1, size_t vertId2, size_t vertId3)
 changes the vertex ids of a triangle More...
 
void loopEraseTriangleFromVertex (size_t triId, size_t vertId)
 erases a triangle from the vertexe's list of triangles it is part of More...
 
osg::Vec3 loopCalcNewPosition (size_t vertId)
 calculates the new position of a vertex depending on it's location in the grid and number of neighbors More...
 
void loopInsertCenterTriangle (size_t triId)
 inserts the center triangle in a given triangle, More...
 
void loopInsertCornerTriangles (size_t triId)
 inserts the 3 corner triangles in a given triangle More...
 
size_t loopCalcEdgeVert (size_t triId, size_t edgeV1, size_t edgeV2, size_t V3)
 calculates the vertex id for a given edge, inserts a new vertex of none exists yet More...
 
double loopGetAlpha (int n)
 loop helper function More...
 
size_t loopGetNextVertex (size_t triNum, size_t vertNum)
 returns the id of the next vertex int he triangle More...
 
size_t loopGetThirdVert (size_t coVert1, size_t coVert2, size_t triangleNum)
 returns the id of the third vertex of a triangle for two given vertexes More...
 
void performFeaturePreservingSmoothingMollificationPass (float sigmaDistance, float sigmaInfluence)
 Performs the first pass of the feature-preserving smoothing, only changing the triangle normals. More...
 
void performFeaturePreservingSmoothingVertexPass (float sigmaDistance, float sigmaInfluence)
 Performs the second pass of the feature-preserving smoothing. More...
 
osg::Vec3 estimateSmoothedVertexPosition (std::size_t vtx, float sigmaDistance, float sigmaInfluence, bool mollify)
 Calculates Eq. More...
 
osg::Vec3 calcTriangleCenter (std::size_t triIdx) const
 Calculates the center position of a triangle. More...
 
float calcTriangleArea (std::size_t triIdx) const
 Calculates the area of a triangle. More...
 
double calcAngleBetweenNormalizedVectors (osg::Vec3 const &v1, osg::Vec3 const &v2)
 Calculates the angle between two NORMALIZED vectors. More...
 

Private Attributes

size_t m_countVerts
 number of vertexes in the mesh More...
 
size_t m_countTriangles
 number of triangles in the mesh More...
 
bool m_meshDirty
 flag indicating a change took place which requires a recalculation of components More...
 
bool m_autoNormal
 flag denoting whether normals should be calculated automatically. More...
 
bool m_neighborsCalculated
 flag indicating whether the neighbor information has been calculated yet More...
 
bool m_curvatureCalculated
 Indicates whether the curvature and its principal directions have been calculated. More...
 
osg::ref_ptr< osg::Vec3Array > m_verts
 array containing the vertices More...
 
osg::ref_ptr< osg::Vec3Array > m_textureCoordinates
 array containing the texture coordinates More...
 
osg::ref_ptr< osg::Vec3Array > m_vertNormals
 array containing the vertex normals More...
 
osg::ref_ptr< osg::Vec3Array > m_vertFlatNormals
 array containing the flat vertex normals More...
 
osg::ref_ptr< osg::Vec4Array > m_vertColors
 array containing vertex colors More...
 
std::vector< size_t > m_triangles
 array containing the triangles More...
 
osg::ref_ptr< osg::Vec3Array > m_triangleNormals
 array containing the triangle normals More...
 
osg::ref_ptr< osg::Vec4Array > m_triangleColors
 array containing the triangle colors More...
 
std::vector< std::vector< size_t > > m_vertexIsInTriangle
 for each vertex, list of triangles it is part of More...
 
std::vector< std::vector< size_t > > m_triangleNeighbors
 edge neighbors for each triangle More...
 
std::shared_ptr< std::vector< float > > m_mainNormalCurvature
 Stores the maximum normal curvature (for the first principal direction) for each vertex. More...
 
std::shared_ptr< std::vector< float > > m_secondaryNormalCurvature
 Stores the minimum normal curvature (for the second principal direction) for each vertex. More...
 
osg::ref_ptr< osg::Vec3Array > m_mainCurvaturePrincipalDirection
 Stores the first principal curvature direction for each vertex. More...
 
osg::ref_ptr< osg::Vec3Array > m_secondaryCurvaturePrincipalDirection
 Stores the second principal curvature direction for each vertex. More...
 
size_t m_numTriVerts
 stores the number of vertexes before the loop subdivion is run, needed by the loop algorithm More...
 
size_t m_numTriFaces
 stores the number of triangles before the loop subdivion is run, needed by the loop algorithm More...
 

Friends

class WTriangleMeshTest
 Access for test class. More...
 

Detailed Description

Triangle mesh data structure allowing for convenient access of the elements.

Definition at line 45 of file WTriangleMesh.h.

Member Typedef Documentation

◆ ConstSPtr

typedef std::shared_ptr< const WTriangleMesh > WTriangleMesh::ConstSPtr

Const shared pointer.

Definition at line 60 of file WTriangleMesh.h.

◆ SPtr

typedef std::shared_ptr< WTriangleMesh > WTriangleMesh::SPtr

Shared pointer.

Definition at line 55 of file WTriangleMesh.h.

Constructor & Destructor Documentation

◆ WTriangleMesh() [1/3]

WTriangleMesh::WTriangleMesh ( size_t  vertNum,
size_t  triangleNum 
)

constructor that already reserves space for a given number of triangles and vertexes

Parameters
vertNum
triangleNum

Definition at line 61 of file WTriangleMesh.cpp.

References m_textureCoordinates, m_triangleColors, m_triangleNormals, m_triangles, m_vertColors, m_vertFlatNormals, m_vertNormals, and m_verts.

◆ WTriangleMesh() [2/3]

WTriangleMesh::WTriangleMesh ( osg::ref_ptr< osg::Vec3Array >  vertices,
const std::vector< size_t > &  triangles 
)

Constructs a new mesh out of the given vertices and triangles.

Parameters
verticesVec3Array storing all vertices
trianglesVector of consecutive vertex indices where each 3 IDs are a triangle starting at 0,1,2 for first triangle 3,4,5 for the second

Definition at line 80 of file WTriangleMesh.cpp.

◆ ~WTriangleMesh()

WTriangleMesh::~WTriangleMesh ( )
virtual

destructor

Definition at line 98 of file WTriangleMesh.cpp.

◆ WTriangleMesh() [3/3]

WTriangleMesh::WTriangleMesh ( )
private

we don't allow the standard constructor

Referenced by getPrototype().

+ Here is the caller graph for this function:

Member Function Documentation

◆ addMesh()

void WTriangleMesh::addMesh ( std::shared_ptr< WTriangleMesh mesh,
float  xOff = 0.,
float  yOff = 0.,
float  zOff = 0. 
)

adds a mesh to the existing, no check for duplicate vertexes is performed, an additional vector may be specified to move the mesh to add

Parameters
mesh
xOff
yOff
zOff

Definition at line 616 of file WTriangleMesh.cpp.

References addTriangle(), addVertex(), m_countVerts, m_meshDirty, and setVertexColor().

+ Here is the call graph for this function:

◆ addTextureCoordinate() [1/2]

void WTriangleMesh::addTextureCoordinate ( float  x,
float  y,
float  z 
)
inline

Adds a texture coordinate for the vertex.

Parameters
xtexture coordinate X
ytexture coordinate Y
ztexture coordinate Z

Definition at line 836 of file WTriangleMesh.h.

References addTextureCoordinate().

+ Here is the call graph for this function:

◆ addTextureCoordinate() [2/2]

void WTriangleMesh::addTextureCoordinate ( osg::Vec3  texCoord)
inline

Adds a texture coordinate for the vertex.

Parameters
texCoordthe texture coordinate

Definition at line 831 of file WTriangleMesh.h.

References m_countVerts.

Referenced by addTextureCoordinate().

+ Here is the caller graph for this function:

◆ addTriangle() [1/2]

void WTriangleMesh::addTriangle ( osg::Vec3  vert0,
osg::Vec3  vert1,
osg::Vec3  vert2 
)

adds a tringle and its 3 vertexes to the mesh

Parameters
vert0position of the first vertex
vert1position of the second vertex
vert2position of the third vertex

Definition at line 129 of file WTriangleMesh.cpp.

References addTriangle(), addVertex(), and m_countVerts.

+ Here is the call graph for this function:

◆ addTriangle() [2/2]

void WTriangleMesh::addTriangle ( size_t  vert0,
size_t  vert1,
size_t  vert2 
)

adds a tringle to the mesh

Parameters
vert0index of the first vertex
vert1index of the second vertex
vert2index of the third vertex

Definition at line 117 of file WTriangleMesh.cpp.

References m_countTriangles, and m_triangles.

Referenced by addMesh(), addTriangle(), loopInsertCenterTriangle(), loopInsertCornerTriangles(), WTriangleMeshTest::testComponentDecomposition(), and WTriangleMeshTest::testEqualityOperator().

+ Here is the caller graph for this function:

◆ addVertex() [1/3]

size_t WTriangleMesh::addVertex ( float  x,
float  y,
float  z 
)

adds a vertex position to the mesh

Parameters
x
y
z
Returns
the index of the vertex

Definition at line 107 of file WTriangleMesh.cpp.

References addVertex().

+ Here is the call graph for this function:

◆ addVertex() [2/3]

size_t WTriangleMesh::addVertex ( osg::Vec3  vert)
inline

adds a vertex position to the mesh

Parameters
vert
Returns
the index of the vertex

Definition at line 841 of file WTriangleMesh.h.

References m_countVerts.

Referenced by addMesh(), addTriangle(), addVertex(), loopCalcEdgeVert(), WTriangleMeshTest::testComponentDecomposition(), and WTriangleMeshTest::testEqualityOperator().

+ Here is the caller graph for this function:

◆ addVertex() [3/3]

size_t WTriangleMesh::addVertex ( WPosition  vert)

adds a vertex position to the mesh

Parameters
vertvertex to add
Returns
the index of the vertex

Definition at line 112 of file WTriangleMesh.cpp.

References addVertex().

+ Here is the call graph for this function:

◆ calcAngleBetweenNormalizedVectors()

double WTriangleMesh::calcAngleBetweenNormalizedVectors ( osg::Vec3 const &  v1,
osg::Vec3 const &  v2 
)
private

Calculates the angle between two NORMALIZED vectors.

Asserts in debug mode, in release mode when called with non-normalized vectors, results are undefined.

Parameters
v1The first NORMALIZED vector.
v2The second NORMALIZED vector.
Returns
The angle between the vectors in radians.

Definition at line 1146 of file WTriangleMesh.cpp.

Referenced by estimateCurvature().

+ Here is the caller graph for this function:

◆ calcNeighbors()

void WTriangleMesh::calcNeighbors ( )
private

calculates neighbor information for triangles

Definition at line 359 of file WTriangleMesh.cpp.

References getNeighbor(), getTriVertId0(), getTriVertId1(), getTriVertId2(), m_countTriangles, m_neighborsCalculated, and m_triangleNeighbors.

Referenced by estimateCurvature(), and performFeaturePreservingSmoothing().

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

◆ calcNormal()

osg::Vec3 WTriangleMesh::calcNormal ( osg::Vec3  vert0,
osg::Vec3  vert1,
osg::Vec3  vert2 
)
private

calculates a normal from the 3 points in space

Parameters
vert0vertex 1
vert1vertex 2
vert2vertex 3
Returns
the normal of the plane defined by these three points

Definition at line 333 of file WTriangleMesh.cpp.

◆ calcTriangleArea()

float WTriangleMesh::calcTriangleArea ( std::size_t  triIdx) const
private

Calculates the area of a triangle.

Parameters
triIdxThe id of the triangle to calculate the area of.
Returns
The area of the triangle.

Definition at line 913 of file WTriangleMesh.cpp.

References m_triangles, and m_verts.

Referenced by estimateSmoothedVertexPosition().

+ Here is the caller graph for this function:

◆ calcTriangleCenter()

osg::Vec3 WTriangleMesh::calcTriangleCenter ( std::size_t  triIdx) const
private

Calculates the center position of a triangle.

Parameters
triIdxThe id of the triangle to calculate the center of.
Returns
The center of the triangle.

Definition at line 903 of file WTriangleMesh.cpp.

References m_triangles, and m_verts.

Referenced by estimateCurvature(), and estimateSmoothedVertexPosition().

+ Here is the caller graph for this function:

◆ calcTriangleNormal()

osg::Vec3 WTriangleMesh::calcTriangleNormal ( size_t  triangle)
private

calculates a normal from the 3 points in space defining a triangle

Parameters
triangle
Returns
the normal of the triangle

Definition at line 317 of file WTriangleMesh.cpp.

References getTriVert().

Referenced by recalcVertNormals().

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

◆ doLoopSubD()

void WTriangleMesh::doLoopSubD ( )

◆ estimateCurvature()

void WTriangleMesh::estimateCurvature ( )

Estimates the normal curvatures and their principal directions for every vertex using the algorithm of:

DONG, Chen-shi; WANG, Guo-zhao. Curvatures estimation on triangular mesh. Journal of Zhejiang University SCIENCE, 2005, 6. Jg., Nr. 1, S. 128-136.

Definition at line 922 of file WTriangleMesh.cpp.

References calcAngleBetweenNormalizedVectors(), calcNeighbors(), calcTriangleCenter(), m_curvatureCalculated, m_mainCurvaturePrincipalDirection, m_mainNormalCurvature, m_secondaryCurvaturePrincipalDirection, m_secondaryNormalCurvature, m_triangleNormals, m_triangles, m_vertexIsInTriangle, m_verts, updateVertsInTriangles(), and wlog::warn().

+ Here is the call graph for this function:

◆ estimateSmoothedVertexPosition()

osg::Vec3 WTriangleMesh::estimateSmoothedVertexPosition ( std::size_t  vtx,
float  sigmaDistance,
float  sigmaInfluence,
bool  mollify 
)
private

Calculates Eq.

3 of:

"Non-Iterative, Feature-Preserving Mesh Smoothing", Jones, T.R., Durand, F., Desbrun, M., ACM Trans. Graph. (22), 2003, 943-949

Parameters
vtxThe id of the vertex to calculate the new position for.
sigmaDistanceThe standard deviation of the spatial weights.
sigmaInfluenceThe standard deviation of the influence weights.
mollifyWhether this is a mollification pass (simple position estimates) or not.
Returns
The smoothed vertex position.

Definition at line 838 of file WTriangleMesh.cpp.

References calcTriangleArea(), calcTriangleCenter(), m_triangleNeighbors, m_triangleNormals, m_vertexIsInTriangle, and m_verts.

Referenced by performFeaturePreservingSmoothingMollificationPass(), and performFeaturePreservingSmoothingVertexPass().

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

◆ getCurvatureMainPrincipalDirection()

osg::Vec3 WTriangleMesh::getCurvatureMainPrincipalDirection ( std::size_t  vtxId) const

Retreive the 3d principal direction of curvature of a vertex.

Parameters
vtxIdThe id of the vertex.
Returns
The first principal duirection.

Definition at line 1189 of file WTriangleMesh.cpp.

References m_mainCurvaturePrincipalDirection.

◆ getCurvatureSecondaryPrincipalDirection()

osg::Vec3 WTriangleMesh::getCurvatureSecondaryPrincipalDirection ( std::size_t  vtxId) const

Retreive the 3d principal direction of curvature for the minimum normal curvature of a vertex.

Parameters
vtxIdThe id of the vertex.
Returns
The second principal duirection.

Definition at line 1194 of file WTriangleMesh.cpp.

References m_secondaryCurvaturePrincipalDirection.

◆ getDescription()

const std::string WTriangleMesh::getDescription ( ) const
inlinevirtual

Gets the description for this prototype.

Returns
the description

Implements WPrototyped.

Definition at line 874 of file WTriangleMesh.h.

◆ getMainCurvature()

double WTriangleMesh::getMainCurvature ( std::size_t  vtxId) const

Retreive the main (maximum) curvature of a vertex.

Parameters
vtxIdThe id of the vertex.
Returns
The estimated main normal curvature.

Definition at line 1169 of file WTriangleMesh.cpp.

References m_mainNormalCurvature.

◆ getMainCurvatures()

std::shared_ptr< std::vector< float > > const & WTriangleMesh::getMainCurvatures ( ) const

Get the vector of main curvature values.

Returns
The curvature values for all the vertices.

Definition at line 1179 of file WTriangleMesh.cpp.

References m_mainNormalCurvature.

◆ getMainPrincipalCurvatureDirectionArray()

osg::ref_ptr< osg::Vec3Array > WTriangleMesh::getMainPrincipalCurvatureDirectionArray ( )

Retreive the array of principal directions e.g.

for use as texture coords.

Returns
The full array of principal directions.

Definition at line 1204 of file WTriangleMesh.cpp.

References m_mainCurvaturePrincipalDirection.

◆ getName()

const std::string WTriangleMesh::getName ( ) const
inlinevirtual

Gets the name of this prototype.

Returns
the name.

Implements WPrototyped.

Definition at line 869 of file WTriangleMesh.h.

◆ getNeighbor()

size_t WTriangleMesh::getNeighbor ( const size_t  coVert1,
const size_t  coVert2,
const size_t  triangleNum 
)
private

returns the triangle index of a triangle neighboring a given edge of a vertex

Parameters
coVert1
coVert2
triangleNum
Returns
the number of the neighboring triangle.

Definition at line 377 of file WTriangleMesh.cpp.

References m_vertexIsInTriangle.

Referenced by calcNeighbors(), and loopCalcEdgeVert().

+ Here is the caller graph for this function:

◆ getNormal()

WVector3d WTriangleMesh::getNormal ( size_t  index)

getter

Parameters
index
Returns
normal

Definition at line 235 of file WTriangleMesh.cpp.

References m_countVerts, m_meshDirty, m_vertNormals, and recalcVertNormals().

+ Here is the call graph for this function:

◆ getPrototype()

std::shared_ptr< WPrototyped > WTriangleMesh::getPrototype ( )
static

Returns a prototype instantiated with the true type of the deriving class.

Returns
the prototype.

Definition at line 49 of file WTriangleMesh.cpp.

References m_prototype, and WTriangleMesh().

+ Here is the call graph for this function:

◆ getSecondaryCurvature()

double WTriangleMesh::getSecondaryCurvature ( std::size_t  vtxId) const

Retreive the secondary (minimum) curvature of a vertex.

Parameters
vtxIdThe id of the vertex.
Returns
The estimated secondary normal curvature.

Definition at line 1174 of file WTriangleMesh.cpp.

References m_secondaryNormalCurvature.

◆ getSecondaryCurvatures()

std::shared_ptr< std::vector< float > > const & WTriangleMesh::getSecondaryCurvatures ( ) const

Get the vector of secondary curvature values.

Returns
The curvature values for all the vertices.

Definition at line 1184 of file WTriangleMesh.cpp.

References m_secondaryNormalCurvature.

◆ getSecondaryPrincipalCurvatureDirectionArray()

osg::ref_ptr< osg::Vec3Array > WTriangleMesh::getSecondaryPrincipalCurvatureDirectionArray ( )

Retreive the array of principal directions e.g.

for use as texture coords.

Returns
The full array of principal directions.

Definition at line 1209 of file WTriangleMesh.cpp.

References m_secondaryCurvaturePrincipalDirection.

◆ getTextureCoordinateArray() [1/2]

osg::ref_ptr< osg::Vec3Array > WTriangleMesh::getTextureCoordinateArray ( )

Returns a reference pointer to the texture coordinate array.

Returns
texture coordinate array

Definition at line 175 of file WTriangleMesh.cpp.

References m_textureCoordinates.

◆ getTextureCoordinateArray() [2/2]

osg::ref_ptr< const osg::Vec3Array > WTriangleMesh::getTextureCoordinateArray ( ) const

Returns a const reference pointer to the texture coordinate array.

Returns
texture coordinate array

Definition at line 180 of file WTriangleMesh.cpp.

References m_textureCoordinates.

◆ getTriangleColors()

osg::ref_ptr< osg::Vec4Array > WTriangleMesh::getTriangleColors ( ) const

Return triangle colors.

Returns
OSG Vec4 Array of triangle colors

Definition at line 787 of file WTriangleMesh.cpp.

References m_triangleColors.

◆ getTriangleNormalArray()

osg::ref_ptr< osg::Vec3Array > WTriangleMesh::getTriangleNormalArray ( bool  forceRecalc = false)

Normal per triangle.

Be careful when using this in a geometry node. They do not support attributes on a per primitive basis. Use getVertexFlatNormalArray in this case.

Parameters
forceRecalctrue to force recalc
Returns
pointer to the triangle normal array

Definition at line 203 of file WTriangleMesh.cpp.

References m_autoNormal, m_meshDirty, m_triangleNormals, and recalcVertNormals().

+ Here is the call graph for this function:

◆ getTriangles()

const std::vector< size_t > & WTriangleMesh::getTriangles ( ) const

Returns a const reference to the vertex ids of the triangles.

Returns
The triangle vertex id list

Definition at line 218 of file WTriangleMesh.cpp.

References m_triangles.

Referenced by tm_utils::componentDecomposition(), and tm_utils::operator<<().

+ Here is the caller graph for this function:

◆ getTriVert()

osg::Vec3 WTriangleMesh::getTriVert ( size_t  triId,
size_t  vertNum 
)
inline

getter

Parameters
triId
vertNum
Returns
vertex

Definition at line 900 of file WTriangleMesh.h.

References m_countTriangles, m_triangles, and m_verts.

Referenced by calcTriangleNormal().

+ Here is the caller graph for this function:

◆ getTriVertId0()

size_t WTriangleMesh::getTriVertId0 ( size_t  triId) const
inline

returns the id of the first vertex of a triangle

Parameters
triIdid of the triangle
Returns
id of the vertex

Definition at line 906 of file WTriangleMesh.h.

References m_countTriangles, and m_triangles.

Referenced by calcNeighbors(), loopCalcEdgeVert(), loopGetNextVertex(), loopGetThirdVert(), loopInsertCenterTriangle(), loopInsertCornerTriangles(), and updateVertsInTriangles().

+ Here is the caller graph for this function:

◆ getTriVertId1()

size_t WTriangleMesh::getTriVertId1 ( size_t  triId) const
inline

returns the id of the second vertex of a triangle

Parameters
triIdid of the triangle
Returns
id of the vertex

Definition at line 912 of file WTriangleMesh.h.

References m_countTriangles, and m_triangles.

Referenced by calcNeighbors(), loopCalcEdgeVert(), loopGetNextVertex(), loopGetThirdVert(), loopInsertCenterTriangle(), loopInsertCornerTriangles(), loopSetTriangle(), and updateVertsInTriangles().

+ Here is the caller graph for this function:

◆ getTriVertId2()

size_t WTriangleMesh::getTriVertId2 ( size_t  triId) const
inline

return the id of the third vertex of a triangle

Parameters
triIdid of the triangle
Returns
id of the vertex

Definition at line 918 of file WTriangleMesh.h.

References m_countTriangles, and m_triangles.

Referenced by calcNeighbors(), loopCalcEdgeVert(), loopGetNextVertex(), loopGetThirdVert(), loopInsertCenterTriangle(), loopInsertCornerTriangles(), loopSetTriangle(), and updateVertsInTriangles().

+ Here is the caller graph for this function:

◆ getVertColor()

osg::Vec4 WTriangleMesh::getVertColor ( size_t  index) const

getter

Parameters
index
Returns
color

Definition at line 229 of file WTriangleMesh.cpp.

References m_countVerts, and m_vertColors.

◆ getVertex()

osg::Vec3 WTriangleMesh::getVertex ( size_t  index) const

getter

Parameters
index
Returns
vertex

Definition at line 223 of file WTriangleMesh.cpp.

References m_countVerts, and m_verts.

Referenced by loopCalcNewPosition().

+ Here is the caller graph for this function:

◆ getVertexArray() [1/2]

osg::ref_ptr< osg::Vec3Array > WTriangleMesh::getVertexArray ( )

getter

Returns
pointer to the vertex array

Definition at line 165 of file WTriangleMesh.cpp.

References m_verts.

Referenced by tm_utils::componentDecomposition(), and tm_utils::operator<<().

+ Here is the caller graph for this function:

◆ getVertexArray() [2/2]

osg::ref_ptr< const osg::Vec3Array > WTriangleMesh::getVertexArray ( ) const

Returns a const reference pointer to the vertex array.

Returns
vertex array

Definition at line 170 of file WTriangleMesh.cpp.

References m_verts.

◆ getVertexColorArray()

osg::ref_ptr< osg::Vec4Array > WTriangleMesh::getVertexColorArray ( )

Color array with a color for each vertex.

Returns
pointer to the vertex color array

Definition at line 213 of file WTriangleMesh.cpp.

References m_vertColors.

◆ getVertexFlatNormalArray()

osg::ref_ptr< osg::Vec3Array > WTriangleMesh::getVertexFlatNormalArray ( bool  forceRecalc = false)

Get the normal array with flat normals for each vertex.

These normals will be calculated. If you have a mesh with shared vertices, this will create some unwanted effects like having the flat normal of a neighbour triangle as the flat normal of a given vertex.

Parameters
forceRecalctrue to force recalc
Returns
pointer to the vertex normal array

Definition at line 194 of file WTriangleMesh.cpp.

References m_autoNormal, m_meshDirty, m_vertFlatNormals, and recalcVertNormals().

+ Here is the call graph for this function:

◆ getVertexNormalArray()

osg::ref_ptr< osg::Vec3Array > WTriangleMesh::getVertexNormalArray ( bool  forceRecalc = false)

Get normal array containing smooth normals for each vertex.

Parameters
forceRecalctrue to force recalc
Returns
pointer to the vertex normal array

Definition at line 185 of file WTriangleMesh.cpp.

References m_autoNormal, m_meshDirty, m_vertNormals, and recalcVertNormals().

+ Here is the call graph for this function:

◆ loopCalcEdgeVert()

size_t WTriangleMesh::loopCalcEdgeVert ( size_t  triId,
size_t  edgeV1,
size_t  edgeV2,
size_t  V3 
)
private

calculates the vertex id for a given edge, inserts a new vertex of none exists yet

Parameters
triIdthe triangle id
edgeV1
edgeV2
V3
Returns
index of the vertex

Definition at line 480 of file WTriangleMesh.cpp.

References addVertex(), getNeighbor(), getTriVertId0(), getTriVertId1(), getTriVertId2(), loopGetThirdVert(), m_countVerts, and m_numTriFaces.

Referenced by loopInsertCenterTriangle().

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

◆ loopCalcNewPosition()

osg::Vec3 WTriangleMesh::loopCalcNewPosition ( size_t  vertId)
private

calculates the new position of a vertex depending on it's location in the grid and number of neighbors

Parameters
vertIdthe vertex id
Returns
new position in 3D space

Definition at line 444 of file WTriangleMesh.cpp.

References getVertex(), loopGetAlpha(), loopGetNextVertex(), and m_vertexIsInTriangle.

Referenced by doLoopSubD().

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

◆ loopEraseTriangleFromVertex()

void WTriangleMesh::loopEraseTriangleFromVertex ( size_t  triId,
size_t  vertId 
)
private

erases a triangle from the vertexe's list of triangles it is part of

Parameters
triId
vertId

Definition at line 564 of file WTriangleMesh.cpp.

References m_vertexIsInTriangle.

Referenced by loopSetTriangle().

+ Here is the caller graph for this function:

◆ loopGetAlpha()

double WTriangleMesh::loopGetAlpha ( int  n)
private

loop helper function

Parameters
n
Returns
alpha

Definition at line 575 of file WTriangleMesh.cpp.

Referenced by loopCalcNewPosition().

+ Here is the caller graph for this function:

◆ loopGetNextVertex()

size_t WTriangleMesh::loopGetNextVertex ( size_t  triNum,
size_t  vertNum 
)
private

returns the id of the next vertex int he triangle

Parameters
triNumid of the triangle
vertNumid of the vertex
Returns
id of the next vertex

Definition at line 590 of file WTriangleMesh.cpp.

References getTriVertId0(), getTriVertId1(), and getTriVertId2().

Referenced by loopCalcNewPosition().

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

◆ loopGetThirdVert()

size_t WTriangleMesh::loopGetThirdVert ( size_t  coVert1,
size_t  coVert2,
size_t  triangleNum 
)
private

returns the id of the third vertex of a triangle for two given vertexes

Parameters
coVert1
coVert2
triangleNum
Returns
id of the third vertex

Definition at line 603 of file WTriangleMesh.cpp.

References getTriVertId0(), getTriVertId1(), and getTriVertId2().

Referenced by loopCalcEdgeVert().

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

◆ loopInsertCenterTriangle()

void WTriangleMesh::loopInsertCenterTriangle ( size_t  triId)
private

inserts the center triangle in a given triangle,

Parameters
triIdthe triangle id

Definition at line 468 of file WTriangleMesh.cpp.

References addTriangle(), getTriVertId0(), getTriVertId1(), getTriVertId2(), and loopCalcEdgeVert().

Referenced by doLoopSubD().

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

◆ loopInsertCornerTriangles()

void WTriangleMesh::loopInsertCornerTriangles ( size_t  triId)
private

inserts the 3 corner triangles in a given triangle

Parameters
triIdthe triangle id

Definition at line 529 of file WTriangleMesh.cpp.

References addTriangle(), getTriVertId0(), getTriVertId1(), getTriVertId2(), loopSetTriangle(), and m_numTriFaces.

Referenced by doLoopSubD().

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

◆ loopSetTriangle()

void WTriangleMesh::loopSetTriangle ( size_t  triId,
size_t  vertId1,
size_t  vertId2,
size_t  vertId3 
)
private

changes the vertex ids of a triangle

Parameters
triId
vertId1
vertId2
vertId3

Definition at line 551 of file WTriangleMesh.cpp.

References getTriVertId1(), getTriVertId2(), loopEraseTriangleFromVertex(), m_vertexIsInTriangle, setTriVert0(), setTriVert1(), and setTriVert2().

Referenced by loopInsertCornerTriangles().

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

◆ operator==()

bool WTriangleMesh::operator== ( const WTriangleMesh rhs) const
inline

Checks if two meshes are exactly the same.

Same number of triangles, and points, and indices as well as same ordering. Keep in mind different ordering might result in the same structure but is considered different here.

Parameters
rhsThe other mesh to compare with
Returns
True if and only if both: vertices and triangles are exactly the same.

Definition at line 825 of file WTriangleMesh.h.

References m_triangles, and m_verts.

◆ performFeaturePreservingSmoothing()

void WTriangleMesh::performFeaturePreservingSmoothing ( float  sigmaDistance,
float  sigmaInfluence 
)

Implements the feature-preserving mesh smoothing algorithm of Jones et al.

:

"Non-Iterative, Feature-Preserving Mesh Smoothing", Jones, T.R., Durand, F., Desbrun, M., ACM Trans. Graph. (22), 2003, 943-949

Parameters
sigmaDistanceThe standard deviation for the spatial weight.
sigmaInfluenceThe standard deviation for the influence weight.

Definition at line 792 of file WTriangleMesh.cpp.

References calcNeighbors(), performFeaturePreservingSmoothingMollificationPass(), performFeaturePreservingSmoothingVertexPass(), and updateVertsInTriangles().

+ Here is the call graph for this function:

◆ performFeaturePreservingSmoothingMollificationPass()

void WTriangleMesh::performFeaturePreservingSmoothingMollificationPass ( float  sigmaDistance,
float  sigmaInfluence 
)
private

Performs the first pass of the feature-preserving smoothing, only changing the triangle normals.

Parameters
sigmaDistanceThe standard deviation of the spatial weights.
sigmaInfluenceThe standard deviation of the influence weights.

Definition at line 806 of file WTriangleMesh.cpp.

References estimateSmoothedVertexPosition(), m_triangleNormals, m_triangles, and m_verts.

Referenced by performFeaturePreservingSmoothing().

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

◆ performFeaturePreservingSmoothingVertexPass()

void WTriangleMesh::performFeaturePreservingSmoothingVertexPass ( float  sigmaDistance,
float  sigmaInfluence 
)
private

Performs the second pass of the feature-preserving smoothing.

This calculates new smoothed vertex positions and updates the normals accordingly. Triangle information and colors stay the same.

Parameters
sigmaDistanceThe standard deviation of the spatial weights.
sigmaInfluenceThe standard deviation of the influence weights.

Definition at line 828 of file WTriangleMesh.cpp.

References estimateSmoothedVertexPosition(), m_verts, and recalcVertNormals().

Referenced by performFeaturePreservingSmoothing().

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

◆ recalcVertNormals()

void WTriangleMesh::recalcVertNormals ( )

recalculates the vertex normals

Definition at line 271 of file WTriangleMesh.cpp.

References calcTriangleNormal(), m_countTriangles, m_countVerts, m_meshDirty, m_vertexIsInTriangle, and updateVertsInTriangles().

Referenced by getNormal(), getTriangleNormalArray(), getVertexFlatNormalArray(), getVertexNormalArray(), and performFeaturePreservingSmoothingVertexPass().

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

◆ removeTriangle()

void WTriangleMesh::removeTriangle ( size_t  index)
private

removes a triangle from the mesh

Parameters
indexthe triangle to remove

Definition at line 264 of file WTriangleMesh.cpp.

References m_countTriangles, m_meshDirty, and m_triangles.

◆ removeVertex()

void WTriangleMesh::removeVertex ( size_t  index)
private

removes a vertex from the vertex array, if any triangles still index that vertex they will be removed if forceRemoveTriangle is true

Parameters
indexthe index of the vertex to remove

Definition at line 245 of file WTriangleMesh.cpp.

References m_countTriangles, m_countVerts, m_meshDirty, m_triangles, and m_vertexIsInTriangle.

◆ rescaleVertexColors()

void WTriangleMesh::rescaleVertexColors ( )

Rescale the vertex colors so that the maximum of all r, g and b values is 1.

Definition at line 654 of file WTriangleMesh.cpp.

References m_vertColors.

◆ setAutoRecalcNormals()

void WTriangleMesh::setAutoRecalcNormals ( bool  autoRecalc = true)

Set this to true to force automatic normal calculation.

Set it to false if you specify your own normals.

Parameters
autoRecalcauto normal calculation.

Definition at line 102 of file WTriangleMesh.cpp.

References m_autoNormal.

◆ setTextureCoord()

void WTriangleMesh::setTextureCoord ( std::size_t  index,
osg::Vec3  texCoord 
)

Set a texture coordinate.

Parameters
indexThe id of the vertex to set the texture coord of.
texCoordThe texture coordinate to use.

Definition at line 1199 of file WTriangleMesh.cpp.

References m_textureCoordinates.

◆ setTriangleColor()

void WTriangleMesh::setTriangleColor ( size_t  index,
osg::Vec4  color 
)

sets the color for a given triangle

Parameters
index
color

Definition at line 159 of file WTriangleMesh.cpp.

References m_countTriangles.

◆ setTriVert0()

void WTriangleMesh::setTriVert0 ( size_t  triId,
size_t  vertId 
)
inlineprivate

higher level access function to the triangle vector, sets the first vertex of a triangle to a given vertex id

Parameters
triIdthe id of the triangle to modify
vertIdnew id of the first vertex

Definition at line 879 of file WTriangleMesh.h.

References m_countTriangles, m_countVerts, and m_triangles.

Referenced by loopSetTriangle().

+ Here is the caller graph for this function:

◆ setTriVert1()

void WTriangleMesh::setTriVert1 ( size_t  triId,
size_t  vertId 
)
inlineprivate

higher level access function to the triangle vector, sets the second vertex of a triangle to a given vertex id

Parameters
triIdthe id of the triangle to modify
vertIdnew id of the second vertex

Definition at line 886 of file WTriangleMesh.h.

References m_countTriangles, m_countVerts, and m_triangles.

Referenced by loopSetTriangle().

+ Here is the caller graph for this function:

◆ setTriVert2()

void WTriangleMesh::setTriVert2 ( size_t  triId,
size_t  vertId 
)
inlineprivate

higher level access function to the triangle vector, sets the third vertex of a triangle to a given vertex id

Parameters
triIdthe id of the triangle to modify
vertIdnew id of the third vertex

Definition at line 893 of file WTriangleMesh.h.

References m_countTriangles, m_countVerts, and m_triangles.

Referenced by loopSetTriangle().

+ Here is the caller graph for this function:

◆ setVertex()

void WTriangleMesh::setVertex ( size_t  index,
osg::Vec3  vert 
)
inline

sets a vertex to a new position

Parameters
index
vert

Definition at line 924 of file WTriangleMesh.h.

◆ setVertexColor()

void WTriangleMesh::setVertexColor ( size_t  index,
osg::Vec4  color 
)

sets the color for a given vertex

Parameters
index
color

Definition at line 153 of file WTriangleMesh.cpp.

References m_countVerts.

Referenced by addMesh().

+ Here is the caller graph for this function:

◆ setVertexNormal() [1/3]

void WTriangleMesh::setVertexNormal ( size_t  index,
float  x,
float  y,
float  z 
)

sets the normal for a given vertex

Parameters
index
xx coordinate
yy coordinate
zz coordinate

Definition at line 148 of file WTriangleMesh.cpp.

References setVertexNormal().

+ Here is the call graph for this function:

◆ setVertexNormal() [2/3]

void WTriangleMesh::setVertexNormal ( size_t  index,
osg::Vec3  normal 
)

sets the normal for a given vertex

Parameters
index
normal

Definition at line 137 of file WTriangleMesh.cpp.

References m_countVerts.

Referenced by setVertexNormal().

+ Here is the caller graph for this function:

◆ setVertexNormal() [3/3]

void WTriangleMesh::setVertexNormal ( size_t  index,
WPosition  normal 
)

sets the normal for a given vertex

Parameters
index
normal

Definition at line 143 of file WTriangleMesh.cpp.

References setVertexNormal().

+ Here is the call graph for this function:

◆ translateMesh()

void WTriangleMesh::translateMesh ( float  xOff,
float  yOff,
float  zOff 
)

moves the entire mesh to a new postion

Parameters
xOff
yOff
zOff

Definition at line 637 of file WTriangleMesh.cpp.

◆ triangleSize()

size_t WTriangleMesh::triangleSize ( ) const

getter

Returns
number of triangles in the mesh

Definition at line 354 of file WTriangleMesh.cpp.

References m_countTriangles.

Referenced by tm_utils::componentDecomposition(), and tm_utils::operator<<().

+ Here is the caller graph for this function:

◆ updateVertsInTriangles()

void WTriangleMesh::updateVertsInTriangles ( )
private

updates the list for which vertexes appear in which triangle

Definition at line 303 of file WTriangleMesh.cpp.

References getTriVertId0(), getTriVertId1(), getTriVertId2(), m_countTriangles, and m_vertexIsInTriangle.

Referenced by doLoopSubD(), estimateCurvature(), performFeaturePreservingSmoothing(), and recalcVertNormals().

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

◆ vertSize()

size_t WTriangleMesh::vertSize ( ) const

getter

Returns
number of vertices in the mesh

Definition at line 349 of file WTriangleMesh.cpp.

References m_countVerts.

Referenced by tm_utils::componentDecomposition(), and tm_utils::operator<<().

+ Here is the caller graph for this function:

◆ zoomMesh()

void WTriangleMesh::zoomMesh ( float  zoom)

multiplies the vertex vectors of the mesh with a given number

Parameters
zoom

Definition at line 646 of file WTriangleMesh.cpp.

Friends And Related Function Documentation

◆ WTriangleMeshTest

friend class WTriangleMeshTest
friend

Access for test class.

Definition at line 50 of file WTriangleMesh.h.

Member Data Documentation

◆ m_autoNormal

bool WTriangleMesh::m_autoNormal
private

flag denoting whether normals should be calculated automatically.

Definition at line 755 of file WTriangleMesh.h.

Referenced by getTriangleNormalArray(), getVertexFlatNormalArray(), getVertexNormalArray(), and setAutoRecalcNormals().

◆ m_countTriangles

size_t WTriangleMesh::m_countTriangles
private

◆ m_countVerts

size_t WTriangleMesh::m_countVerts
private

◆ m_curvatureCalculated

bool WTriangleMesh::m_curvatureCalculated
private

Indicates whether the curvature and its principal directions have been calculated.

Definition at line 760 of file WTriangleMesh.h.

Referenced by estimateCurvature().

◆ m_mainCurvaturePrincipalDirection

osg::ref_ptr< osg::Vec3Array > WTriangleMesh::m_mainCurvaturePrincipalDirection
private

Stores the first principal curvature direction for each vertex.

Definition at line 790 of file WTriangleMesh.h.

Referenced by estimateCurvature(), getCurvatureMainPrincipalDirection(), and getMainPrincipalCurvatureDirectionArray().

◆ m_mainNormalCurvature

std::shared_ptr< std::vector< float > > WTriangleMesh::m_mainNormalCurvature
private

Stores the maximum normal curvature (for the first principal direction) for each vertex.

Definition at line 784 of file WTriangleMesh.h.

Referenced by estimateCurvature(), getMainCurvature(), and getMainCurvatures().

◆ m_meshDirty

bool WTriangleMesh::m_meshDirty
private

flag indicating a change took place which requires a recalculation of components

Definition at line 753 of file WTriangleMesh.h.

Referenced by addMesh(), doLoopSubD(), getNormal(), getTriangleNormalArray(), getVertexFlatNormalArray(), getVertexNormalArray(), recalcVertNormals(), removeTriangle(), and removeVertex().

◆ m_neighborsCalculated

bool WTriangleMesh::m_neighborsCalculated
private

flag indicating whether the neighbor information has been calculated yet

Definition at line 757 of file WTriangleMesh.h.

Referenced by calcNeighbors().

◆ m_numTriFaces

size_t WTriangleMesh::m_numTriFaces
private

stores the number of triangles before the loop subdivion is run, needed by the loop algorithm

Definition at line 797 of file WTriangleMesh.h.

Referenced by doLoopSubD(), loopCalcEdgeVert(), and loopInsertCornerTriangles().

◆ m_numTriVerts

size_t WTriangleMesh::m_numTriVerts
private

stores the number of vertexes before the loop subdivion is run, needed by the loop algorithm

Definition at line 795 of file WTriangleMesh.h.

Referenced by doLoopSubD().

◆ m_prototype

std::shared_ptr< WPrototyped > WTriangleMesh::m_prototype = std::shared_ptr< WPrototyped >()
staticprotected

The prototype as singleton.

Definition at line 514 of file WTriangleMesh.h.

Referenced by getPrototype().

◆ m_secondaryCurvaturePrincipalDirection

osg::ref_ptr< osg::Vec3Array > WTriangleMesh::m_secondaryCurvaturePrincipalDirection
private

Stores the second principal curvature direction for each vertex.

Definition at line 793 of file WTriangleMesh.h.

Referenced by estimateCurvature(), getCurvatureSecondaryPrincipalDirection(), and getSecondaryPrincipalCurvatureDirectionArray().

◆ m_secondaryNormalCurvature

std::shared_ptr< std::vector< float > > WTriangleMesh::m_secondaryNormalCurvature
private

Stores the minimum normal curvature (for the second principal direction) for each vertex.

Definition at line 787 of file WTriangleMesh.h.

Referenced by estimateCurvature(), getSecondaryCurvature(), and getSecondaryCurvatures().

◆ m_textureCoordinates

osg::ref_ptr< osg::Vec3Array > WTriangleMesh::m_textureCoordinates
private

array containing the texture coordinates

Definition at line 764 of file WTriangleMesh.h.

Referenced by getTextureCoordinateArray(), setTextureCoord(), and WTriangleMesh().

◆ m_triangleColors

osg::ref_ptr< osg::Vec4Array > WTriangleMesh::m_triangleColors
private

array containing the triangle colors

Definition at line 776 of file WTriangleMesh.h.

Referenced by doLoopSubD(), getTriangleColors(), and WTriangleMesh().

◆ m_triangleNeighbors

std::vector< std::vector< size_t > > WTriangleMesh::m_triangleNeighbors
private

edge neighbors for each triangle

Definition at line 781 of file WTriangleMesh.h.

Referenced by calcNeighbors(), and estimateSmoothedVertexPosition().

◆ m_triangleNormals

osg::ref_ptr< osg::Vec3Array > WTriangleMesh::m_triangleNormals
private

◆ m_triangles

std::vector< size_t > WTriangleMesh::m_triangles
private

◆ m_vertColors

osg::ref_ptr< osg::Vec4Array > WTriangleMesh::m_vertColors
private

array containing vertex colors

Definition at line 770 of file WTriangleMesh.h.

Referenced by doLoopSubD(), getVertColor(), getVertexColorArray(), rescaleVertexColors(), and WTriangleMesh().

◆ m_vertexIsInTriangle

std::vector< std::vector< size_t > > WTriangleMesh::m_vertexIsInTriangle
private

◆ m_vertFlatNormals

osg::ref_ptr< osg::Vec3Array > WTriangleMesh::m_vertFlatNormals
private

array containing the flat vertex normals

Definition at line 768 of file WTriangleMesh.h.

Referenced by getVertexFlatNormalArray(), and WTriangleMesh().

◆ m_vertNormals

osg::ref_ptr< osg::Vec3Array > WTriangleMesh::m_vertNormals
private

array containing the vertex normals

Definition at line 766 of file WTriangleMesh.h.

Referenced by doLoopSubD(), getNormal(), getVertexNormalArray(), and WTriangleMesh().

◆ m_verts

osg::ref_ptr< osg::Vec3Array > WTriangleMesh::m_verts
private

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