CGPdocs

Marching cubes

Extract a triangle mesh from a scalar field sampled on a grid, and the lookup tables.

Compute 5

size_t marching_cube(
    std::vector<vec3>& position,
    std::vector<float> const& field,
    spatial_domain_grid_3D const& domain,
    float iso,
    std::vector<marching_cube_relative_coordinates>* relative = nullptr
)

Fast marching cube writing a triangle soup into a reused position buffer and returning the number of valid vertices, optionally with the grid edge of each vertex.

std::array<int,256> marching_cube_lut_edgeTable()

Marching-cube table giving, for each of the 256 inside/outside corner configurations, the bit mask of the intersected edges (Paul Bourke).

std::array<std::pair<int,int>,12> marching_cube_lut_edge_order()

Pairs of corner indices defining the twelve edges of a marching-cube voxel.

std::array<int3,8> marching_cube_lut_offset_cube()

Integer offsets of the eight corners of a marching-cube voxel, in the corner order of marching_cube_lut_edge_order.

std::array<std::array<int,16>,256> marching_cube_lut_triTable()

Marching-cube table giving, for each of the 256 corner configurations, the list of edge triplets forming triangles, terminated by -1 (Paul Bourke).

CGP - Computer Graphics Programming.