Visualization Library v1.0.3A lightweight C++ OpenGL middleware for 2D/3D graphics |
[Download] [Tutorials] [All Classes] [Grouped Classes] |
An efficient implementation of the Marching Cubes algorithm. More...
#include <MarchingCubes.hpp>
Classes | |
struct | Edge |
Public Member Functions | |
MarchingCubes () | |
void | run (bool generate_colors) |
void | reset () |
const Collection< VolumeInfo > * | volumeInfo () const |
Collection< VolumeInfo > * | volumeInfo () |
void | updateColor (const fvec3 &color, int volume_index) |
void | updateColor (const fvec4 &color, int volume_index) |
void | updateAlpha (float alpha, int volume_index) |
void | setHighQualityNormals (bool hq) |
Select hight quality normals for best rendering quality, select low quality normals for best performances. | |
bool | highQualityNormals () const |
Select hight quality normals for best rendering quality, select low quality normals for best performances. | |
Public Attributes | |
ref< ArrayFloat3 > | mVertsArray |
ref< ArrayFloat3 > | mNormsArray |
ref< ArrayFloat4 > | mColorArray |
ref< DrawElementsUShort > | mDrawElements |
Protected Member Functions | |
void | computeEdges (Volume *, float threshold) |
void | processCube (int x, int y, int z, Volume *vol, float threshold) |
Static Protected Attributes | |
static const int | mTriangleConnectionTable [256][16] |
static const int | mCubeEdgeFlags [256] |
An efficient implementation of the Marching Cubes algorithm.
Pictures from the Marching Cubes tutorial.
Definition at line 223 of file MarchingCubes.hpp.
MarchingCubes::MarchingCubes | ( | ) |
Definition at line 60 of file MarchingCubes.cpp.
References mColorArray, mDrawElements, mNormsArray, mVertsArray, vl::PT_TRIANGLES, and vl::Object::setAutomaticDelete().
void MarchingCubes::run | ( | bool | generate_colors ) |
Definition at line 312 of file MarchingCubes.cpp.
References vl::Collection< T >::at(), vl::VolumeInfo::color(), computeEdges(), vl::Volume::dataIsDirty(), vl::ref< T >::get(), mColorArray, mDrawElements, mNormsArray, mVertsArray, processCube(), vl::Volume::setupInternalData(), vl::VolumeInfo::setVert0(), vl::VolumeInfo::setVertC(), vl::Collection< T >::size(), vl::VolumeInfo::threshold(), and vl::VolumeInfo::volume().
Referenced by vl::VolumePlot::compute().
void MarchingCubes::reset | ( | ) |
Definition at line 297 of file MarchingCubes.cpp.
References vl::Collection< T >::clear(), mColorArray, mDrawElements, mNormsArray, and mVertsArray.
const Collection<VolumeInfo>* vl::MarchingCubes::volumeInfo | ( | ) | const [inline] |
Definition at line 232 of file MarchingCubes.hpp.
Referenced by vl::VolumePlot::compute().
Collection<VolumeInfo>* vl::MarchingCubes::volumeInfo | ( | ) | [inline] |
Definition at line 233 of file MarchingCubes.hpp.
void MarchingCubes::updateColor | ( | const fvec3 & | color, |
int | volume_index | ||
) |
Definition at line 398 of file MarchingCubes.cpp.
References vl::Collection< T >::at(), vl::Vector3< T_Scalar >::b(), vl::Log::error(), vl::Vector3< T_Scalar >::g(), mColorArray, vl::Vector3< T_Scalar >::r(), vl::Collection< T >::size(), vl::VolumeInfo::vert0(), and vl::VolumeInfo::vertC().
void MarchingCubes::updateColor | ( | const fvec4 & | color, |
int | volume_index | ||
) |
Definition at line 420 of file MarchingCubes.cpp.
References vl::Collection< T >::at(), vl::Log::error(), mColorArray, vl::Collection< T >::size(), vl::VolumeInfo::vert0(), and vl::VolumeInfo::vertC().
void MarchingCubes::updateAlpha | ( | float | alpha, |
int | volume_index | ||
) |
Definition at line 438 of file MarchingCubes.cpp.
References vl::Collection< T >::at(), vl::Log::error(), mColorArray, vl::Collection< T >::size(), vl::VolumeInfo::vert0(), and vl::VolumeInfo::vertC().
void vl::MarchingCubes::setHighQualityNormals | ( | bool | hq ) | [inline] |
Select hight quality normals for best rendering quality, select low quality normals for best performances.
Definition at line 240 of file MarchingCubes.hpp.
bool vl::MarchingCubes::highQualityNormals | ( | ) | const [inline] |
Select hight quality normals for best rendering quality, select low quality normals for best performances.
Definition at line 242 of file MarchingCubes.hpp.
void MarchingCubes::computeEdges | ( | Volume * | vol, |
float | threshold | ||
) | [protected] |
Definition at line 78 of file MarchingCubes.cpp.
References vl::Volume::cellSize(), vl::Volume::coordinate(), vl::Volume::cube(), vl::Volume::normalHQ(), vl::Volume::slices(), vl::Volume::value(), VL_CHECK, vl::Vector3< T_Scalar >::x(), vl::Vector3< T_Scalar >::y(), and vl::Vector3< T_Scalar >::z().
Referenced by run().
void MarchingCubes::processCube | ( | int | x, |
int | y, | ||
int | z, | ||
Volume * | vol, | ||
float | threshold | ||
) | [protected] |
Definition at line 201 of file MarchingCubes.cpp.
References vl::cross(), vl::Vector3< T_Scalar >::isNull(), mCubeEdgeFlags, mTriangleConnectionTable, vl::Volume::slices(), vl::Volume::value(), vl::Vector3< T_Scalar >::x(), and vl::Vector3< T_Scalar >::y().
Referenced by run().
Definition at line 245 of file MarchingCubes.hpp.
Referenced by vl::VolumePlot::compute(), MarchingCubes(), reset(), and run().
Definition at line 246 of file MarchingCubes.hpp.
Referenced by vl::VolumePlot::compute(), MarchingCubes(), reset(), and run().
Definition at line 247 of file MarchingCubes.hpp.
Referenced by MarchingCubes(), reset(), run(), updateAlpha(), and updateColor().
Definition at line 253 of file MarchingCubes.hpp.
Referenced by vl::VolumePlot::compute(), MarchingCubes(), reset(), and run().
const int MarchingCubes::mTriangleConnectionTable [static, protected] |
Definition at line 283 of file MarchingCubes.hpp.
Referenced by processCube().
const int MarchingCubes::mCubeEdgeFlags [static, protected] |
{ 0x000, 0x109, 0x203, 0x30a, 0x406, 0x50f, 0x605, 0x70c, 0x80c, 0x905, 0xa0f, 0xb06, 0xc0a, 0xd03, 0xe09, 0xf00, 0x190, 0x099, 0x393, 0x29a, 0x596, 0x49f, 0x795, 0x69c, 0x99c, 0x895, 0xb9f, 0xa96, 0xd9a, 0xc93, 0xf99, 0xe90, 0x230, 0x339, 0x033, 0x13a, 0x636, 0x73f, 0x435, 0x53c, 0xa3c, 0xb35, 0x83f, 0x936, 0xe3a, 0xf33, 0xc39, 0xd30, 0x3a0, 0x2a9, 0x1a3, 0x0aa, 0x7a6, 0x6af, 0x5a5, 0x4ac, 0xbac, 0xaa5, 0x9af, 0x8a6, 0xfaa, 0xea3, 0xda9, 0xca0, 0x460, 0x569, 0x663, 0x76a, 0x066, 0x16f, 0x265, 0x36c, 0xc6c, 0xd65, 0xe6f, 0xf66, 0x86a, 0x963, 0xa69, 0xb60, 0x5f0, 0x4f9, 0x7f3, 0x6fa, 0x1f6, 0x0ff, 0x3f5, 0x2fc, 0xdfc, 0xcf5, 0xfff, 0xef6, 0x9fa, 0x8f3, 0xbf9, 0xaf0, 0x650, 0x759, 0x453, 0x55a, 0x256, 0x35f, 0x055, 0x15c, 0xe5c, 0xf55, 0xc5f, 0xd56, 0xa5a, 0xb53, 0x859, 0x950, 0x7c0, 0x6c9, 0x5c3, 0x4ca, 0x3c6, 0x2cf, 0x1c5, 0x0cc, 0xfcc, 0xec5, 0xdcf, 0xcc6, 0xbca, 0xac3, 0x9c9, 0x8c0, 0x8c0, 0x9c9, 0xac3, 0xbca, 0xcc6, 0xdcf, 0xec5, 0xfcc, 0x0cc, 0x1c5, 0x2cf, 0x3c6, 0x4ca, 0x5c3, 0x6c9, 0x7c0, 0x950, 0x859, 0xb53, 0xa5a, 0xd56, 0xc5f, 0xf55, 0xe5c, 0x15c, 0x055, 0x35f, 0x256, 0x55a, 0x453, 0x759, 0x650, 0xaf0, 0xbf9, 0x8f3, 0x9fa, 0xef6, 0xfff, 0xcf5, 0xdfc, 0x2fc, 0x3f5, 0x0ff, 0x1f6, 0x6fa, 0x7f3, 0x4f9, 0x5f0, 0xb60, 0xa69, 0x963, 0x86a, 0xf66, 0xe6f, 0xd65, 0xc6c, 0x36c, 0x265, 0x16f, 0x066, 0x76a, 0x663, 0x569, 0x460, 0xca0, 0xda9, 0xea3, 0xfaa, 0x8a6, 0x9af, 0xaa5, 0xbac, 0x4ac, 0x5a5, 0x6af, 0x7a6, 0x0aa, 0x1a3, 0x2a9, 0x3a0, 0xd30, 0xc39, 0xf33, 0xe3a, 0x936, 0x83f, 0xb35, 0xa3c, 0x53c, 0x435, 0x73f, 0x636, 0x13a, 0x033, 0x339, 0x230, 0xe90, 0xf99, 0xc93, 0xd9a, 0xa96, 0xb9f, 0x895, 0x99c, 0x69c, 0x795, 0x49f, 0x596, 0x29a, 0x393, 0x099, 0x190, 0xf00, 0xe09, 0xd03, 0xc0a, 0xb06, 0xa0f, 0x905, 0x80c, 0x70c, 0x605, 0x50f, 0x406, 0x30a, 0x203, 0x109, 0x000 }
Definition at line 284 of file MarchingCubes.hpp.
Referenced by processCube().