Cogs.Core
Functions
Cogs::Core::MarchingCubes Namespace Reference

Various tables for driving the Marching Cubes algorithm. More...

Functions

COGSCORE_DLL_API const std::vector< unsigned char > & triangulationTable ()
 
COGSCORE_DLL_API const std::vector< unsigned char > & indexCountTable ()
 
COGSCORE_DLL_API const std::vector< unsigned char > & axesTable ()
 
COGSCORE_DLL_API const std::vector< unsigned char > & axesTableNoIShift ()
 
COGSCORE_DLL_API const std::vector< unsigned char > & axesTableNoJShift ()
 
COGSCORE_DLL_API const std::vector< unsigned char > & axesTableNoKShift ()
 
COGSCORE_DLL_API const std::vector< unsigned char > & indexTable ()
 
COGSCORE_DLL_API const std::vector< uint8_t > & vertexCountTable ()
 

Detailed Description

Various tables for driving the Marching Cubes algorithm.

Cell corners are assumed have the following layout:

2--------—3 |\ |\ | \ | \ | \ | \ J | 6----—+—7 | | | | | | 0—+----—1 | +— I \ | \ | \ \ | \ | \ | | K 4--------—5

Edges that may pierce the iso-surface have the following layout

+--— 4 —+ |\ |\ | 7 | 5 8 \ 9 \ J | +--—6-+—+ | | | | | | +—+–0-—+ | +— I \ 11 \ 10 \ 3 | 1 | \ | | K +--—2--—+

Function Documentation

◆ axesTable()

const std::vector< unsigned char > & Cogs::Core::MarchingCubes::axesTable ( )

Definition at line 435 of file MarchingCubesTables.cpp.

◆ axesTableNoIShift()

const std::vector< unsigned char > & Cogs::Core::MarchingCubes::axesTableNoIShift ( )

Definition at line 441 of file MarchingCubesTables.cpp.

◆ axesTableNoJShift()

const std::vector< unsigned char > & Cogs::Core::MarchingCubes::axesTableNoJShift ( )

Definition at line 447 of file MarchingCubesTables.cpp.

◆ axesTableNoKShift()

const std::vector< unsigned char > & Cogs::Core::MarchingCubes::axesTableNoKShift ( )

Definition at line 453 of file MarchingCubesTables.cpp.

◆ indexCountTable()

const std::vector< unsigned char > & Cogs::Core::MarchingCubes::indexCountTable ( )

A table that gives the number of vertices produced for each of the Marching Cubes cases.

Definition at line 471 of file MarchingCubesTables.cpp.

◆ indexTable()

const std::vector< unsigned char > & Cogs::Core::MarchingCubes::indexTable ( )

Definition at line 459 of file MarchingCubesTables.cpp.

◆ triangulationTable()

const std::vector< unsigned char > & Cogs::Core::MarchingCubes::triangulationTable ( )

A table with the edge intersections that form triangles for Marching Cubes cases.

Around a cell, the corners are ordered in the following way,

2-—3 |\ |\ | 6–+-7 | | | | 0-+–1 | | | 4-—5

A marching cubes case is found by checking which of the eight corners that satisfy a given predicate (typically, a scalar field is less than a threshold at that position), and interpreting this as bits in an 8-bit integer (where vertex 0 corresponds to bit 0 and so on).

A vertex in produced by marching cubes always lie on an edge between two corners, where the predicate is satisfied for one of the corners and not satisfied for the others.

Thus, an output vertex is described by on which edge it is. This is encoded as two 3-bit numbers (corners 0 through 7) stored in the upper and lower nibble of an uchar.

The table is of size 256x16 where the fastest-running index enumerates triangle vertices and the slowest running index enumerates cases.

Definition at line 465 of file MarchingCubesTables.cpp.

◆ vertexCountTable()

const std::vector< uint8_t > & Cogs::Core::MarchingCubes::vertexCountTable ( )

Definition at line 477 of file MarchingCubesTables.cpp.