|
AvogadroLibs
1.93.1
|
Class that can generate Mesh objects from Cube objects. More...
#include <avogadro/qtgui/meshgenerator.h>
Signals | |
| void | progressValueChanged (int) |
Public Member Functions | |
| MeshGenerator (QObject *parent=0) | |
| MeshGenerator (const Core::Cube *cube, Core::Mesh *mesh, float iso, bool reverse=false, QObject *parent=0) | |
| ~MeshGenerator () override | |
| bool | initialize (const Core::Cube *cube, Core::Mesh *mesh, float iso, bool reverse=false) |
| void | run () override |
| const Core::Cube * | cube () const |
| Core::Mesh * | mesh () const |
| void | clear () |
| int | progressMinimum () |
| int | progressMaximum () |
Protected Member Functions | |
| Vector3f | normal (const Vector3f &pos) |
| float | offset (float val1, float val2) |
| unsigned long | duplicate (const Vector3i &c, const Vector3f &pos) |
| bool | marchingCube (const Vector3i &pos) |
Protected Attributes | |
| float | m_iso |
| bool | m_reverseWinding |
| const Core::Cube * | m_cube |
| Core::Mesh * | m_mesh |
| Vector3f | m_stepSize |
| Vector3f | m_min |
| Vector3i | m_dim |
| Core::Array< Vector3f > | m_vertices |
| Core::Array< Vector3f > | m_normals |
| Core::Array< unsigned int > | m_indices |
| int | m_progmin |
| int | m_progmax |
Static Protected Attributes | |
| static const float | a2fVertexOffset [8][3] |
| static const int | a2iVertexOffset [8][3] |
| static const int | a2iEdgeConnection [12][2] |
| static const float | a2fEdgeDirection [12][3] |
| static const int | a2iTetrahedronEdgeConnection [6][2] |
| static const int | a2iTetrahedronsInACube [6][4] |
| static const long | aiTetrahedronEdgeFlags [16] |
| static const int | a2iTetrahedronTriangles [16][7] |
| static const long | aiCubeEdgeFlags [256] |
| static const int | a2iTriangleConnectionTable [256][16] |
This class implements a method of generating an isosurface Mesh from volumetric data using the marching cubes algorithm. In the case of the MeshGenerator class it expects a Cube as an input and an isosurface value. The tables and the basic code is taken from the public domain code written by Cory Bloyd (marchingsource.cpp) and available at, http://local.wasp.uwa.edu.au/~pbourke/geometry/polygonise/
You must first initialize the class and then call run() to actually polygonize the isosurface. Connect to the classes finished() signal to do something once the polygonization is complete.
|
explicit |
Constructor.
| MeshGenerator | ( | const Core::Cube * | cube, |
| Core::Mesh * | mesh, | ||
| float | iso, | ||
| bool | reverse = false, |
||
| QObject * | parent = 0 |
||
| ) |
Constructor. Can be used to initialize the MeshGenerator.
| cube | The source Cube with the volumetric data. |
| mesh | The Mesh that will hold the isosurface. |
| iso | The iso value of the surface. |
|
override |
Destructor.
| bool initialize | ( | const Core::Cube * | cube, |
| Core::Mesh * | mesh, | ||
| float | iso, | ||
| bool | reverse = false |
||
| ) |
Initialization function, set up the MeshGenerator ready to find an isosurface of the supplied Cube.
| cube | The source Cube with the volumetric data. |
| mesh | The Mesh that will hold the isosurface. |
| iso | The iso value of the surface. |
|
override |
Use this function to begin Mesh generation. Uses an asynchronous thread, and so avoids locking the user interface while the isosurface is found.
| const Core::Cube* cube | ( | ) | const |
| Core::Mesh* mesh | ( | ) | const |
| void clear | ( | ) |
Clears the contents of the MeshGenerator.
| int progressMinimum | ( | ) |
| int progressMaximum | ( | ) |
|
signal |
The current value of the calculation's progress.
|
protected |
Get the normal to the supplied point. This operation is quite expensive and so should be avoided wherever possible.
| pos | The position of the vertex whose normal is needed. |