This class implements the Marching Cubes algorithm. More...
#include <marching_cubes.h>
Public Types | |
typedef vcg::tri::Allocator < TRIMESH_TYPE > | AllocatorType |
typedef TRIMESH_TYPE::CoordType * | CoordPointer |
typedef TRIMESH_TYPE::CoordType | CoordType |
enum | Dimension { X, Y, Z } |
typedef TRIMESH_TYPE::FaceIterator | FaceIterator |
typedef TRIMESH_TYPE::FacePointer | FacePointer |
typedef TRIMESH_TYPE::FaceType | FaceType |
typedef TRIMESH_TYPE::ScalarType | ScalarType |
typedef TRIMESH_TYPE::VertexIterator | VertexIterator |
typedef TRIMESH_TYPE::VertexPointer | VertexPointer |
typedef TRIMESH_TYPE::VertexType | VertexType |
Public Member Functions | |
void | Finalize () |
void | Initialize () |
MarchingCubes (TRIMESH_TYPE &mesh, WALKER_TYPE &walker) | |
void | ProcessCell (const vcg::Point3i &min, const vcg::Point3i &max) |
Private Member Functions | |
void | AddTriangles (const char *vertices_list, char n, VertexPointer v12=NULL) |
void | ComputeCVertex (VertexPointer &v12) |
bool | TestFace (signed char face) |
bool | TestInterior (signed char s) |
Private Attributes | |
unsigned char | _case |
unsigned char | _config |
vcg::Point3i | _corners [8] |
ScalarType | _field [8] |
TRIMESH_TYPE * | _mesh |
unsigned char | _subconfig |
WALKER_TYPE * | _walker |
This class implements the Marching Cubes algorithm.
The implementation is enough generic: this class works only on one volume cell for each call to ProcessCell
. Using the field value at the cell corners, it adds to the mesh the triangles set approximating the surface that cross that cell. The ambiguities are resolved using an enhanced topologically controlled lookup table.
TRIMESH_TYPE | (Template parameter) the mesh type that will be constructed |
WALKER_TYPE | (Template parameter) the class that implement the traversal ordering of the volume |
Definition at line 62 of file marching_cubes.h.
typedef vcg::tri::Allocator< TRIMESH_TYPE > vcg::tri::MarchingCubes< TRIMESH_TYPE, WALKER_TYPE >::AllocatorType |
Definition at line 66 of file marching_cubes.h.
typedef TRIMESH_TYPE::CoordType* vcg::tri::MarchingCubes< TRIMESH_TYPE, WALKER_TYPE >::CoordPointer |
Definition at line 75 of file marching_cubes.h.
typedef TRIMESH_TYPE::CoordType vcg::tri::MarchingCubes< TRIMESH_TYPE, WALKER_TYPE >::CoordType |
Definition at line 74 of file marching_cubes.h.
typedef TRIMESH_TYPE::FaceIterator vcg::tri::MarchingCubes< TRIMESH_TYPE, WALKER_TYPE >::FaceIterator |
Definition at line 73 of file marching_cubes.h.
typedef TRIMESH_TYPE::FacePointer vcg::tri::MarchingCubes< TRIMESH_TYPE, WALKER_TYPE >::FacePointer |
Definition at line 72 of file marching_cubes.h.
typedef TRIMESH_TYPE::FaceType vcg::tri::MarchingCubes< TRIMESH_TYPE, WALKER_TYPE >::FaceType |
Definition at line 71 of file marching_cubes.h.
typedef TRIMESH_TYPE::ScalarType vcg::tri::MarchingCubes< TRIMESH_TYPE, WALKER_TYPE >::ScalarType |
Definition at line 67 of file marching_cubes.h.
typedef TRIMESH_TYPE::VertexIterator vcg::tri::MarchingCubes< TRIMESH_TYPE, WALKER_TYPE >::VertexIterator |
Definition at line 70 of file marching_cubes.h.
typedef TRIMESH_TYPE::VertexPointer vcg::tri::MarchingCubes< TRIMESH_TYPE, WALKER_TYPE >::VertexPointer |
Definition at line 69 of file marching_cubes.h.
typedef TRIMESH_TYPE::VertexType vcg::tri::MarchingCubes< TRIMESH_TYPE, WALKER_TYPE >::VertexType |
Definition at line 68 of file marching_cubes.h.
enum vcg::tri::MarchingCubes::Dimension |
Definition at line 65 of file marching_cubes.h.
vcg::tri::MarchingCubes< TRIMESH_TYPE, WALKER_TYPE >::MarchingCubes | ( | TRIMESH_TYPE & | mesh, |
WALKER_TYPE & | walker | ||
) | [inline] |
Constructor
mesh | the mesh that will be constructed |
walker | the class implementing the traversal policy |
Definition at line 82 of file marching_cubes.h.
void vcg::tri::MarchingCubes< TRIMESH_TYPE, WALKER_TYPE >::AddTriangles | ( | const char * | vertices_list, |
char | n, | ||
VertexPointer | v12 = NULL |
||
) | [inline, private] |
Adds new triangles to the mesh
vertices_list | The list of vertex indices |
n | The number of triangles that will be added to the mesh |
v12 | The pointer to the vertex inside the current cell |
Definition at line 663 of file marching_cubes.h.
void vcg::tri::MarchingCubes< TRIMESH_TYPE, WALKER_TYPE >::ComputeCVertex | ( | VertexPointer & | v12 | ) | [inline, private] |
Adds a vertex inside the current cube
v | The pointer to the new vertex along the edge |
Definition at line 588 of file marching_cubes.h.
void vcg::tri::MarchingCubes< TRIMESH_TYPE, WALKER_TYPE >::Finalize | ( | ) | [inline] |
This method must be executed after the last call to ApplyMC
Definition at line 101 of file marching_cubes.h.
void vcg::tri::MarchingCubes< TRIMESH_TYPE, WALKER_TYPE >::Initialize | ( | ) | [inline] |
Execute the initialiazation. This method must be executed before the first call to ApplyMC
Definition at line 92 of file marching_cubes.h.
void vcg::tri::MarchingCubes< TRIMESH_TYPE, WALKER_TYPE >::ProcessCell | ( | const vcg::Point3i & | min, |
const vcg::Point3i & | max | ||
) | [inline] |
Apply the marching cubes algorithm to the volume cell identified by the two points min
and max
. All the three coordinates of the first point must be smaller than the respectives three coordinatas of the second point.
min | the first point |
max | the second point |
Definition at line 113 of file marching_cubes.h.
bool vcg::tri::MarchingCubes< TRIMESH_TYPE, WALKER_TYPE >::TestFace | ( | signed char | face | ) | [inline, private] |
Tests if the components of the tesselation of the cube should be connected by the interior of an ambiguous face
Definition at line 408 of file marching_cubes.h.
bool vcg::tri::MarchingCubes< TRIMESH_TYPE, WALKER_TYPE >::TestInterior | ( | signed char | s | ) | [inline, private] |
Tests if the components of the tesselation of the cube should be connected through the interior of the cube
Definition at line 431 of file marching_cubes.h.
unsigned char vcg::tri::MarchingCubes< TRIMESH_TYPE, WALKER_TYPE >::_case [private] |
Case of the volume cell being processed
Definition at line 392 of file marching_cubes.h.
unsigned char vcg::tri::MarchingCubes< TRIMESH_TYPE, WALKER_TYPE >::_config [private] |
Configuration of the volume cell being processed
Definition at line 397 of file marching_cubes.h.
vcg::Point3i vcg::tri::MarchingCubes< TRIMESH_TYPE, WALKER_TYPE >::_corners[8] [private] |
Array of the 8 corners of the volume cell being processed
Definition at line 387 of file marching_cubes.h.
ScalarType vcg::tri::MarchingCubes< TRIMESH_TYPE, WALKER_TYPE >::_field[8] [private] |
The field value at the cell corners
Definition at line 382 of file marching_cubes.h.
TRIMESH_TYPE* vcg::tri::MarchingCubes< TRIMESH_TYPE, WALKER_TYPE >::_mesh [private] |
Definition at line 377 of file marching_cubes.h.
unsigned char vcg::tri::MarchingCubes< TRIMESH_TYPE, WALKER_TYPE >::_subconfig [private] |
Subconfiguration of the volume cell being processed
Definition at line 402 of file marching_cubes.h.
WALKER_TYPE* vcg::tri::MarchingCubes< TRIMESH_TYPE, WALKER_TYPE >::_walker [private] |
Definition at line 369 of file marching_cubes.h.