Efficient Implementation of Marching Cubes' Cases with Topological Guarantees
Author JuliaGeometry
12 Stars
Updated Last
5 Months Ago
Started In
January 2022

License CI PkgEval Coverage Status MarchingCubes Downloads


Julia port of Efficient Implementation of Marching Cubes' Cases with Topological Guarantees.

Public article available here.


Adapted to Julia (1 based indexing) from the original c++ implementation (0 based indexing).

Tiny benchmark - visualization with ParaView

$ g++ -O3 ply.c main.cpp MarchingCubes.cpp
$ ./a.out
Marching Cubes ran in 0.007834 secs.
$ julia --check-bounds=no
julia> using BenchmarkTools, MarchingCubes
julia> mc = MarchingCubes.scenario();
julia> @btime march($mc)
  7.865 ms (0 allocations: 0 bytes)
julia> @btime march_legacy($mc)
  9.268 ms (0 allocations: 0 bytes)
julia> using PlyIO
julia> MarchingCubes.output(PlyIO, mc)  # writes "test.ply" (can be opened in a viewer, e.g. ParaView)

Test scenario output: ParaView Torus

MWE demonstrating visualization with MeshViz.jl

using MarchingCubes
using GLMakie
using MeshViz
using Meshes

mc = MarchingCubes.scenario()
msh = MarchingCubes.makemesh(Meshes, mc)

Meshviz Mesh

MWE demonstrating visualization with GeometryBasics.jl and Makie.jl

using GeometryBasics
using MarchingCubes
using GLMakie

mc = MarchingCubes.scenario()
msh = MarchingCubes.makemesh(GeometryBasics, mc)

fap = mesh(msh; color = :gray)

Makie Mesh

Original BibTeX

    author = {Thomas Lewiner and Hélio Lopes and Antônio Wilson Vieira and Geovan Tavares},
    title = {Efficient implementation of marching cubes cases with topological guarantees},
    year = {2003},
    month = {december},
    journal = {Journal of Graphics Tools},
    volume = {8},
    number = {2},
    pages = {1--15},
    publisher = {A.K.Peters},
    doi = {10.1080/10867651.2003.10487582},
    url = {\url{}}


This code is free to use under the terms of the MIT license.