https://github.com/juliageometry/marchingcubes.jl
Efficient Implementation of Marching Cubes' Cases with Topological Guarantees
https://github.com/juliageometry/marchingcubes.jl
implicit-surface-tiler isosurface-extraction marching-cubes topological-guarantees
Last synced: 11 months ago
JSON representation
Efficient Implementation of Marching Cubes' Cases with Topological Guarantees
- Host: GitHub
- URL: https://github.com/juliageometry/marchingcubes.jl
- Owner: JuliaGeometry
- License: mit
- Created: 2022-01-27T01:42:39.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-06-17T22:35:47.000Z (12 months ago)
- Last Synced: 2025-06-20T19:03:50.681Z (12 months ago)
- Topics: implicit-surface-tiler, isosurface-extraction, marching-cubes, topological-guarantees
- Language: C
- Homepage:
- Size: 728 KB
- Stars: 23
- Watchers: 2
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](LICENSE.md)
[](https://github.com/JuliaGeometry/MarchingCubes.jl/actions/workflows/ci.yml)
[](https://juliaci.github.io/NanosoldierReports/pkgeval_badges/report.html)
[](https://app.codecov.io/gh/JuliaGeometry/MarchingCubes.jl)
[](https://juliapkgstats.com/pkg/MarchingCubes)
# MarchingCubes
Julia port of [Efficient Implementation of Marching Cubes' Cases with Topological Guarantees](https://www.tandfonline.com/doi/abs/10.1080/10867651.2003.10487582).
Public article available [here](http://thomas.lewiner.org/pdfs/marching_cubes_jgt.pdf).
# Implementation
Adapted to `Julia` (`1` based indexing) from the original [c++ implementation](http://thomas.lewiner.org/srcs/marching_cubes_jgt.zip) (`0` based indexing).
# Tiny benchmark - visualization with ParaView
```bash
$ 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:

# MWE demonstrating visualization with MeshViz.jl
```julia
using MarchingCubes
using GLMakie
using MeshViz
using Meshes
mc = MarchingCubes.scenario()
march(mc)
msh = MarchingCubes.makemesh(Meshes, mc)
display(viz(msh))
```

# MWE demonstrating visualization with GeometryBasics.jl and Makie.jl
```julia
using GeometryBasics
using MarchingCubes
using GLMakie
mc = MarchingCubes.scenario()
march(mc)
msh = MarchingCubes.makemesh(GeometryBasics, mc)
fap = mesh(msh; color = :gray)
display(fap)
```

# Original BibTeX
```
@article{marching_cubes_jgt,
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{http://thomas.lewiner.org/pdfs/marching_cubes_jgt.pdf}}
}
```
# License
This code is free to use under the terms of the MIT license.