OpenWalnut 1.2.5
|
Creates a non interpolated triangulation of an isosurface. More...
#include <WMarchingLegoAlgorithm.h>
Public Member Functions | |
WMarchingLegoAlgorithm () | |
standard constructor | |
~WMarchingLegoAlgorithm () | |
destructor | |
template<typename T > | |
boost::shared_ptr< WTriangleMesh > | 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). | |
boost::shared_ptr< WTriangleMesh > | 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). | |
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. |
Creates a non interpolated triangulation of an isosurface.
Definition at line 62 of file WMarchingLegoAlgorithm.h.
WMarchingLegoAlgorithm::WMarchingLegoAlgorithm | ( | ) |
standard constructor
Definition at line 27 of file WMarchingLegoAlgorithm.cpp.
WMarchingLegoAlgorithm::~WMarchingLegoAlgorithm | ( | ) |
destructor
Definition at line 32 of file WMarchingLegoAlgorithm.cpp.
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
x | position of the voxel |
y | position of the voxel |
z | position of the voxel |
surface | which 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().
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.
nbCoordsX | number of vertices in X direction |
nbCoordsY | number of vertices in Y direction |
nbCoordsZ | number of vertices in Z direction |
mat | the matrix transforming the vertices from canonical space |
vals | the values at the vertices |
isoValue | The surface will run through all positions with this value. |
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.
nbCoordsX | number of vertices in X direction |
nbCoordsY | number of vertices in Y direction |
nbCoordsZ | number of vertices in Z direction |
mat | the matrix transforming the vertices from canonical space |
vals | the values at the vertices |
isoValue | The surface will run through all positions with this value. |
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
nX | x position in space |
nY | y position in space |
nZ | z position in space |
Definition at line 283 of file WMarchingLegoAlgorithm.cpp.
References m_nCellsX, and m_nCellsY.
Referenced by addSurface().
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().
WMatrix< double > WMarchingLegoAlgorithm::m_matrix [private] |
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().
double WMarchingLegoAlgorithm::m_tIsoLevel [private] |
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().