API
Quick Start - isosurface
Given 3D levelset data such as a CT scan, we can do:
using Meshing
A = rand(50,50,50) # 3D Matrix
points,faces = isosurface(A)An iso-level is specified within the algorithm specification as follows:
using Meshing
A = rand(50,50,50) # 3D Matrix
points,faces = isosurface(A, MarchingCubes(iso=1))Isosurface
isosurface is the common and generic API for isosurface extraction with any type of abstract vector/vertex/face type.
Meshing.isosurface — Functionisosurface(V)
isosurface(V, method::AbstractMeshingAlgorithm, X, Y, Z)isosurface is the general interface to all isosurface extraction algorithms.
Returns: (Vector{NTuple{3, T}, }, Vector{NTuple{3, Int}})
Defaults: method must be an instance of an AbstractMeshingAlgorithm, e.g.:
- MarchingCubes()
- MarchingTetrahedra()
If isosurface is called without a specified algorithm, it will default to MarchingCubes.
If a subtype of AbstractArray is specified, the mesh will by default be centered at the origin between (-1,1) in each axis.
See also:
Meshing Algorithms
Three meshing algorithms exist:
MarchingCubes()MarchingTetrahedra()
Each takes optional iso and eps parameters, e.g. MarchingCubes(iso=0.0,eps=1e-6).
Here iso controls the offset for the boundary detection. By default this is set to 0. eps is the detection tolerance for a voxel edge intersection.
Users must construct an algorithm type and use it as an argument to a GeometryTypes mesh call or isosurface call.
Visual Comparison: From left: Marching Cubes, Naive Surface Nets, Marching Tetrahedra

Meshing.MarchingCubes — TypeMarchingCubes(;iso=0.0)Specifies the use of the Marching Cubes algorithm for isosurface extraction. This algorithm provides a good balance between performance and vertex count. In contrast to the other algorithms, vertices may be repeated, so mesh size may be large and it will be difficult to extract topological/connectivity information.
iso(default: 0.0) specifies the iso level to use for surface extraction.
Meshing.MarchingTetrahedra — TypeMarchingTetrahedra(;iso=0.0, eps=1e-3)Specifies the use of the Marching Tetrahedra algorithm for isosurface extraction. This algorithm generates more faces. However, each vertex is guaranteed to not be repeated, making this algorithm useful for topological analysis.
isospecifies the iso level to use for surface extraction.epsis the tolerence around a voxel corner to ensure manifold mesh generation.
Meshing.AbstractMeshingAlgorithm — TypeAbstractMeshingAlgorithmAbstract type to specify an algorithm for isosurface extraction. See: