OpenWalnut  1.2.5
Public Member Functions | Private Member Functions | Private Attributes
WMarchingLegoAlgorithm Class Reference

Creates a non interpolated triangulation of an isosurface. More...

#include <WMarchingLegoAlgorithm.h>

List of all members.

Public Member Functions

 WMarchingLegoAlgorithm ()
 standard constructor
 ~WMarchingLegoAlgorithm ()
 destructor
template<typename T >
boost::shared_ptr< WTriangleMeshgenerateSurface (size_t nbCoordsX, size_t nbCoordsY, size_t nbCoordsZ, const WMatrix< double > &mat, const std::vector< T > *vals, double isoValue)
 Generate the triangles for the surface on the given dataSet (inGrid, vals).
boost::shared_ptr< WTriangleMeshgenSurfaceOneValue (size_t nbCoordsX, size_t nbCoordsY, size_t nbCoordsZ, const WMatrix< double > &mat, const std::vector< size_t > *vals, size_t isoValue)
 Generate the triangles for the surface on the given dataSet (inGrid, vals).

Private Member Functions

void addSurface (size_t x, size_t y, size_t z, size_t surface)
 adds 2 triangles for a given face of the voxel
size_t getVertexID (size_t nX, size_t nY, size_t nZ)
 returns a vertex id for a given grid point

Private Attributes

unsigned int m_nCellsX
 No. of cells in x direction.
unsigned int m_nCellsY
 No. of cells in y direction.
unsigned int m_nCellsZ
 No. of cells in z direction.
double m_tIsoLevel
 The isovalue.
WMatrix< double > m_matrix
 The 4x4 transformation matrix for the triangle vertices.
ID2WMLPointXYZId m_idToVertices
 List of WPointXYZIds which form the isosurface.
WMLTriangleVECTOR m_trivecTriangles
 List of WMCTriangleS which form the triangulation of the isosurface.

Detailed Description

Creates a non interpolated triangulation of an isosurface.

Definition at line 62 of file WMarchingLegoAlgorithm.h.


Constructor & Destructor Documentation

standard constructor

Definition at line 27 of file WMarchingLegoAlgorithm.cpp.

destructor

Definition at line 32 of file WMarchingLegoAlgorithm.cpp.


Member Function Documentation

void WMarchingLegoAlgorithm::addSurface ( size_t  x,
size_t  y,
size_t  z,
size_t  surface 
) [private]

adds 2 triangles for a given face of the voxel

Parameters:
xposition of the voxel
yposition of the voxel
zposition of the voxel
surfacewhich side of the voxel to paint

Definition at line 36 of file WMarchingLegoAlgorithm.cpp.

References getVertexID(), m_idToVertices, m_trivecTriangles, WMLPointXYZId::newID, WMLTriangle::pointID, WMLPointXYZId::x, WMLPointXYZId::y, and WMLPointXYZId::z.

Referenced by generateSurface(), and genSurfaceOneValue().

template<typename T >
boost::shared_ptr< WTriangleMesh > WMarchingLegoAlgorithm::generateSurface ( size_t  nbCoordsX,
size_t  nbCoordsY,
size_t  nbCoordsZ,
const WMatrix< double > &  mat,
const std::vector< T > *  vals,
double  isoValue 
)

Generate the triangles for the surface on the given dataSet (inGrid, vals).

The texture coordinates in the resulting mesh are relative to the grid. This means they are NOT transformed. This ensure faster grid matrix updates in texture space. This might be useful where texture transformation matrices are used.

Parameters:
nbCoordsXnumber of vertices in X direction
nbCoordsYnumber of vertices in Y direction
nbCoordsZnumber of vertices in Z direction
matthe matrix transforming the vertices from canonical space
valsthe values at the vertices
isoValueThe surface will run through all positions with this value.
Returns:
the created triangle mesh

Definition at line 146 of file WMarchingLegoAlgorithm.h.

References addSurface(), m_idToVertices, m_matrix, m_nCellsX, m_nCellsY, m_nCellsZ, m_tIsoLevel, and m_trivecTriangles.

Referenced by WROIArbitrary::updateGFX().

boost::shared_ptr< WTriangleMesh > WMarchingLegoAlgorithm::genSurfaceOneValue ( size_t  nbCoordsX,
size_t  nbCoordsY,
size_t  nbCoordsZ,
const WMatrix< double > &  mat,
const std::vector< size_t > *  vals,
size_t  isoValue 
)

Generate the triangles for the surface on the given dataSet (inGrid, vals).

The texture coordinates in the resulting mesh are relative to the grid. This means they are NOT transformed. This ensure faster grid matrix updates in texture space. This might be useful where texture transformation matrices are used.

Parameters:
nbCoordsXnumber of vertices in X direction
nbCoordsYnumber of vertices in Y direction
nbCoordsZnumber of vertices in Z direction
matthe matrix transforming the vertices from canonical space
valsthe values at the vertices
isoValueThe surface will run through all positions with this value.
Returns:
the created triangle mesh

Definition at line 288 of file WMarchingLegoAlgorithm.cpp.

References addSurface(), m_idToVertices, m_matrix, m_nCellsX, m_nCellsY, m_nCellsZ, and m_trivecTriangles.

size_t WMarchingLegoAlgorithm::getVertexID ( size_t  nX,
size_t  nY,
size_t  nZ 
) [private]

returns a vertex id for a given grid point

Parameters:
nXx position in space
nYy position in space
nZz position in space
Returns:
the id

Definition at line 283 of file WMarchingLegoAlgorithm.cpp.

References m_nCellsX, and m_nCellsY.

Referenced by addSurface().


Member Data Documentation

ID2WMLPointXYZId WMarchingLegoAlgorithm::m_idToVertices [private]

List of WPointXYZIds which form the isosurface.

Definition at line 142 of file WMarchingLegoAlgorithm.h.

Referenced by addSurface(), generateSurface(), and genSurfaceOneValue().

The 4x4 transformation matrix for the triangle vertices.

Definition at line 140 of file WMarchingLegoAlgorithm.h.

Referenced by generateSurface(), and genSurfaceOneValue().

unsigned int WMarchingLegoAlgorithm::m_nCellsX [private]

No. of cells in x direction.

Definition at line 134 of file WMarchingLegoAlgorithm.h.

Referenced by generateSurface(), genSurfaceOneValue(), and getVertexID().

unsigned int WMarchingLegoAlgorithm::m_nCellsY [private]

No. of cells in y direction.

Definition at line 135 of file WMarchingLegoAlgorithm.h.

Referenced by generateSurface(), genSurfaceOneValue(), and getVertexID().

unsigned int WMarchingLegoAlgorithm::m_nCellsZ [private]

No. of cells in z direction.

Definition at line 136 of file WMarchingLegoAlgorithm.h.

Referenced by generateSurface(), and genSurfaceOneValue().

The isovalue.

Definition at line 138 of file WMarchingLegoAlgorithm.h.

Referenced by generateSurface().

WMLTriangleVECTOR WMarchingLegoAlgorithm::m_trivecTriangles [private]

List of WMCTriangleS which form the triangulation of the isosurface.

Definition at line 143 of file WMarchingLegoAlgorithm.h.

Referenced by addSurface(), generateSurface(), and genSurfaceOneValue().


The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends