Class MarchingCubes
Basic implementation of marching cubes mesh generation, which can be applied to arbitrary Implicit function. Multi-threading enabled by default.
[TODO] support locking on Implicit.Value()? May not be thread-safe!! [TODO] extension that tracks set of triangles in each cube, so we can do partial updates? [TODO] is hash table on vertex x/y/z the best idea? [TODO] hash table for edge vtx-indices instead, like old polygonizer? (how did we index edges?!?)
Inherited Members
Namespace: g3
Assembly: cs.temp.dll.dll
Syntax
public class MarchingCubes
Constructors
MarchingCubes()
Declaration
public MarchingCubes()
Fields
Bounds
bounding-box we will mesh inside of. We use the min-corner and the width/height/depth, but do not clamp vertices to stay within max-corner, we may spill one cell over
Declaration
public AxisAlignedBox3d Bounds
Field Value
Type | Description |
---|---|
AxisAlignedBox3d |
CancelF
if this function returns true, we should abort calculation
Declaration
public Func<bool> CancelF
Field Value
Type | Description |
---|---|
Func<Boolean> |
CellDimensions
Declaration
public Vector3i CellDimensions
Field Value
Type | Description |
---|---|
Vector3i |
CubeSize
Length of edges of cubes that are marching. currently, # of cells along axis = (int)(bounds_dimension / CellSize) + 1
Declaration
public double CubeSize
Field Value
Type | Description |
---|---|
Double |
Implicit
this is the function we will evaluate
Declaration
public ImplicitFunction3d Implicit
Field Value
Type | Description |
---|---|
ImplicitFunction3d |
IsoValue
mesh surface will be at this isovalue. Normally 0 unless you want offset surface or field is not a distance-field.
Declaration
public double IsoValue
Field Value
Type | Description |
---|---|
Double |
Mesh
Declaration
public DMesh3 Mesh
Field Value
Type | Description |
---|---|
DMesh3 |
ParallelCompute
Use multi-threading? Generally a good idea unless problem is very small or you are multi-threading at a higher level (which may be more efficient as we currently use very fine-grained spinlocks to synchronize)
Declaration
public bool ParallelCompute
Field Value
Type | Description |
---|---|
Boolean |
RootMode
Which rootfinding method will be used to converge on surface along edges
Declaration
public MarchingCubes.RootfindingModes RootMode
Field Value
Type | Description |
---|---|
MarchingCubes.RootfindingModes |
RootModeSteps
number of iterations of rootfinding method (ignored for SingleLerp)
Declaration
public int RootModeSteps
Field Value
Type | Description |
---|---|
Int32 |
VertexHash
Declaration
public Dictionary<Vector3d, int> VertexHash
Field Value
Type | Description |
---|---|
Dictionary<Vector3d, Int32> |
Methods
Generate()
Run MC algorithm and generate Output mesh
Declaration
public void Generate()