UnityMol  0.9.6-875
UnityMol viewer / In developement
MarchingCubes Class Reference
+ Collaboration diagram for MarchingCubes:

Static Public Member Functions

static void SetModeToCubes ()
 
static void SetModeToTetrahedrons ()
 
static void SetTarget (float tar)
 
static void SetWindingOrder (int v0, int v1, int v2)
 
static MeshData CreateMesh (float[,,] voxels, int xStart, int xEnd, int yStart, int yEnd, int zStart, int zEnd)
 
static float[,,] SmoothVoxels (float[,,] m_voxels)
 

Static Public Attributes

static VertexTree vertexTree
 

Private Member Functions

delegate void MODE_FUNC (Vector3 pos, float[] cube, List< Vector3 > vertList, List< int > indexList)
 

Static Private Member Functions

static void FillCube (int x, int y, int z, float[,,] voxels, float[] cube)
 
static float GetOffset (float v1, float v2)
 
static void MarchCube (Vector3 pos, float[] cube, List< Vector3 > vertList, List< int > indexList)
 
static void MarchTetrahedron (Vector3[] tetrahedronPosition, float[] tetrahedronValue, List< Vector3 > vertList, List< int > indexList)
 
static void MarchCubeTetrahedron (Vector3 pos, float[] cube, List< Vector3 > vertList, List< int > indexList)
 

Static Private Attributes

static MODE_FUNC Mode_Func = MarchCube
 
static EdgeGrid edgeGrid
 
static int[,] m_sampler
 
static float target = 0.5f
 
static int[] windingOrder = new int[] { 0, 1, 2 }
 
static int[,] vertexOffset
 
static int[,] edgeConnection
 
static float[,] edgeDirection
 
static int[,] tetrahedronEdgeConnection
 
static int[,] tetrahedronsInACube
 
static int[] tetrahedronEdgeFlags
 
static int[,] tetrahedronTriangles
 
static int[] cubeEdgeFlags
 
static int[,] triangleConnectionTable
 

Detailed Description

Definition at line 5 of file MarchingCubes.cs.

Member Function Documentation

static MeshData MarchingCubes.CreateMesh ( float  voxels[,,],
int  xStart,
int  xEnd,
int  yStart,
int  yEnd,
int  zStart,
int  zEnd 
)
static

Definition at line 29 of file MarchingCubes.cs.

References FillCube(), Mode_Func, MeshData.triangles, and MeshData.vertices.

Referenced by GenerateMesh.CreateSurfaceObjects().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void MarchingCubes.FillCube ( int  x,
int  y,
int  z,
float  voxels[,,],
float[]  cube 
)
staticprivate

Definition at line 124 of file MarchingCubes.cs.

References vertexOffset.

Referenced by CreateMesh().

+ Here is the caller graph for this function:

static float MarchingCubes.GetOffset ( float  v1,
float  v2 
)
staticprivate

Definition at line 131 of file MarchingCubes.cs.

References target.

Referenced by MarchCube(), and MarchTetrahedron().

+ Here is the caller graph for this function:

static void MarchingCubes.MarchCube ( Vector3  pos,
float[]  cube,
List< Vector3 >  vertList,
List< int >  indexList 
)
staticprivate

Definition at line 196 of file MarchingCubes.cs.

References VertexTree.AddVertex(), cubeEdgeFlags, edgeConnection, edgeDirection, GetOffset(), target, triangleConnectionTable, and vertexOffset.

Referenced by SetModeToCubes().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void MarchingCubes.MarchCubeTetrahedron ( Vector3  pos,
float[]  cube,
List< Vector3 >  vertList,
List< int >  indexList 
)
staticprivate

Definition at line 292 of file MarchingCubes.cs.

References MarchTetrahedron(), tetrahedronsInACube, and vertexOffset.

Referenced by SetModeToTetrahedrons().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void MarchingCubes.MarchTetrahedron ( Vector3[]  tetrahedronPosition,
float[]  tetrahedronValue,
List< Vector3 >  vertList,
List< int >  indexList 
)
staticprivate

Definition at line 247 of file MarchingCubes.cs.

References GetOffset(), target, tetrahedronEdgeConnection, tetrahedronEdgeFlags, tetrahedronTriangles, and windingOrder.

Referenced by MarchCubeTetrahedron().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

delegate void MarchingCubes.MODE_FUNC ( Vector3  pos,
float[]  cube,
List< Vector3 >  vertList,
List< int >  indexList 
)
private
static void MarchingCubes.SetModeToCubes ( )
static

Definition at line 21 of file MarchingCubes.cs.

References MarchCube().

Referenced by GenerateMesh.InitGenMesh().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void MarchingCubes.SetModeToTetrahedrons ( )
static

Definition at line 22 of file MarchingCubes.cs.

References MarchCubeTetrahedron().

+ Here is the call graph for this function:

static void MarchingCubes.SetTarget ( float  tar)
static

Definition at line 24 of file MarchingCubes.cs.

References target.

Referenced by GenerateMesh.InitGenMesh().

+ Here is the caller graph for this function:

static void MarchingCubes.SetWindingOrder ( int  v0,
int  v1,
int  v2 
)
static

Definition at line 25 of file MarchingCubes.cs.

References windingOrder.

static float [,,] MarchingCubes.SmoothVoxels ( float  m_voxels[,,])
static

Definition at line 136 of file MarchingCubes.cs.

Member Data Documentation

int [] MarchingCubes.cubeEdgeFlags
staticprivate
Initial value:
= new int[] {
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 413 of file MarchingCubes.cs.

Referenced by MarchCube().

int [,] MarchingCubes.edgeConnection
staticprivate
Initial value:
= new int[,] {
{0,1}, {1,2}, {2,3}, {3,0},
{4,5}, {5,6}, {6,7}, {7,4},
{0,4}, {1,5}, {2,6}, {3,7}
}

Definition at line 330 of file MarchingCubes.cs.

Referenced by MarchCube().

float [,] MarchingCubes.edgeDirection
staticprivate
Initial value:
= new float[,] {
{1.0f, 0.0f, 0.0f},{0.0f, 1.0f, 0.0f},{-1.0f, 0.0f, 0.0f},{0.0f, -1.0f, 0.0f},
{1.0f, 0.0f, 0.0f},{0.0f, 1.0f, 0.0f},{-1.0f, 0.0f, 0.0f},{0.0f, -1.0f, 0.0f},
{0.0f, 0.0f, 1.0f},{0.0f, 0.0f, 1.0f},{ 0.0f, 0.0f, 1.0f},{0.0f, 0.0f, 1.0f}
}

Definition at line 339 of file MarchingCubes.cs.

Referenced by MarchCube().

EdgeGrid MarchingCubes.edgeGrid
staticprivate

Definition at line 10 of file MarchingCubes.cs.

int [,] MarchingCubes.m_sampler
staticprivate
Initial value:
= new int[,] {
{1,-1,0}, {1,-1,1}, {0,-1,1}, {-1,-1,1}, {-1,-1,0}, {-1,-1,-1}, {0,-1,-1}, {1,-1,-1}, {0,-1,0},
{1,0,0}, {1,0,1}, {0,0,1}, {-1,0,1}, {-1,0,0}, {-1,0,-1}, {0,0,-1}, {1,0,-1}, {0,0,0},
{1,1,0}, {1,1,1}, {0,1,1}, {-1,1,1}, {-1,1,0}, {-1,1,-1}, {0,1,-1}, {1,1,-1}, {0,1,0}
}

Definition at line 15 of file MarchingCubes.cs.

MODE_FUNC MarchingCubes.Mode_Func = MarchCube
staticprivate

Definition at line 9 of file MarchingCubes.cs.

Referenced by CreateMesh().

float MarchingCubes.target = 0.5f
staticprivate

Definition at line 314 of file MarchingCubes.cs.

Referenced by GetOffset(), MarchCube(), MarchTetrahedron(), and SetTarget().

int [,] MarchingCubes.tetrahedronEdgeConnection
staticprivate
Initial value:
= new int[,] {
{0,1}, {1,2}, {2,0}, {0,3}, {1,3}, {2,3}
}

Definition at line 348 of file MarchingCubes.cs.

Referenced by MarchTetrahedron().

int [] MarchingCubes.tetrahedronEdgeFlags
staticprivate
Initial value:
= new int[] {
0x00, 0x0d, 0x13, 0x1e, 0x26, 0x2b, 0x35, 0x38, 0x38, 0x35, 0x2b, 0x26, 0x1e, 0x13, 0x0d, 0x00
}

Definition at line 373 of file MarchingCubes.cs.

Referenced by MarchTetrahedron().

int [,] MarchingCubes.tetrahedronsInACube
staticprivate
Initial value:
= new int[,] {
{0,5,1,6},
{0,1,2,6},
{0,2,3,6},
{0,3,7,6},
{0,7,4,6},
{0,4,5,6}
}

Definition at line 356 of file MarchingCubes.cs.

Referenced by MarchCubeTetrahedron().

int [,] MarchingCubes.tetrahedronTriangles
staticprivate
Initial value:
= new int[,] {
{-1, -1, -1, -1, -1, -1, -1},
{ 0, 3, 2, -1, -1, -1, -1},
{ 0, 1, 4, -1, -1, -1, -1},
{ 1, 4, 2, 2, 4, 3, -1},
{ 1, 2, 5, -1, -1, -1, -1},
{ 0, 3, 5, 0, 5, 1, -1},
{ 0, 2, 5, 0, 5, 4, -1},
{ 5, 4, 3, -1, -1, -1, -1},
{ 3, 4, 5, -1, -1, -1, -1},
{ 4, 5, 0, 5, 2, 0, -1},
{ 1, 5, 0, 5, 3, 0, -1},
{ 5, 2, 1, -1, -1, -1, -1},
{ 3, 4, 2, 2, 4, 1, -1},
{ 4, 1, 0, -1, -1, -1, -1},
{ 2, 3, 0, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1}
}

Definition at line 383 of file MarchingCubes.cs.

Referenced by MarchTetrahedron().

int [,] MarchingCubes.triangleConnectionTable
staticprivate

Definition at line 439 of file MarchingCubes.cs.

Referenced by MarchCube().

int [,] MarchingCubes.vertexOffset
staticprivate
Initial value:
= new int[,] {
{0, 0, 0},{1, 0, 0},{1, 1, 0},{0, 1, 0},
{0, 0, 1},{1, 0, 1},{1, 1, 1},{0, 1, 1}
}

Definition at line 322 of file MarchingCubes.cs.

Referenced by FillCube(), MarchCube(), and MarchCubeTetrahedron().

VertexTree MarchingCubes.vertexTree
static

Definition at line 11 of file MarchingCubes.cs.

int [] MarchingCubes.windingOrder = new int[] { 0, 1, 2 }
staticprivate

Definition at line 317 of file MarchingCubes.cs.

Referenced by MarchTetrahedron(), and SetWindingOrder().


The documentation for this class was generated from the following file: