Skip to content

Simple C implementation of the (manifold) dual marching cubes algorithm from Gregory M. Nielson

License

Notifications You must be signed in to change notification settings

dominikwodniok/dualmc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

This project provides a simple C implementation of the dual marching cubes algorithm described in the paper Dual Marching Cubes from Gregory M. Nielson. It is a byproduct of some work I did as a student assistent back in 2009. Though there are other implementations out there it might still be helpfull to someone.

Unfortunately, under rare circumstances the original algorithm can create non-manifold meshes. See the remarks of the original paper on this problem. In chapter 3.3.5 of his book "Isosurfaces: Geometry, Topology, and Algorithms" Rephael Wenger proposed the manifold dual marching cubes algorithm as a possible solution, which is also included in this implementation.

Requirements

  • C 11
  • No other dependencies

Implementation

The algorithm is implemented in the files dualmc.h, dualmc.tpp, and dualmc_tables.tpp. A simple example command-line application which demonstrates basic usage is provided as well. An application for generating the (manifold) dual marching cubes tables is implemented in apps/gentables.

Dual point computation could be improved using Hermite data or at least first derivatives as described in Dual Contouring of Hermite Data. So feel free to contribute :)

Example Application

To build the example and see the available options in a Linux environment type:

$ make
$ ./dmc -help

A basic CMAKE file is provided as well. If this still does not suit you under Windows or OS X the adept programmer should have no problems setting up a small project.

RAW Files

The example application can only read 8-bit and 16-bit volume data sets in the very limited RAW format (i.e. only stores raw data, no further information such as the volume grid dimension is included). A classic source for RAW files is http://www.volvis.org/ . Currently, the site does not seem to be available. The OpenQVis project also provides some data sets in RAW format. Another source is The Volume Library from Stefan Roettger. This site provides files in the more versatile PMV format but also code which can convert these files to RAW.

The example application provides a small cube data set (32^3)and can also generate a caffeine molecule. To extract a surface from the cube volume type:

$ ./dmc -raw data/cube.raw 32 32 32 -iso 0.5

The iso value of 0.5 is mapped to a middle density w.r.t. the bit-depth of the data set. For the caffeine data set type:

$ ./dmc -caffeine -iso 0.5

caffeine

For code simplicity the example outputs surfaces in the Wavefront OBJ format.

License

BSD 3-Clause License

About

Simple C implementation of the (manifold) dual marching cubes algorithm from Gregory M. Nielson

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published