Skip to content

Implements a simple, readable naive surface nets algorithm

License

Notifications You must be signed in to change notification settings

Q-Minh/naive-surface-nets

Repository files navigation

A Documented Simple Naive Surface Nets Implementation

Overview

unit circle generated by naive surface nets

This repository implements the Naive Surface Nets Algorithm which is used to generate a triangular mesh that approximates a given isosurface defined by the level-set { x,y,z in R^3 | f(x,y,z)=isovalue } of a scalar function f: R^3 -> R. The approximation's precision is bounded by a given voxel grid's resolution in which the isosurface to extract is contained. In the main.cpp file, you can find an example use of the surface_nets function which generates a mesh of the unit circle f(x,y,z) = sqrt(x*x + y*y + z*z) - 1.0 at the specified grid resolution. We add libigl as submodule for visualization of the generated triangular meshes.

Goals

This repository aims to provide a clear, simple and documented implementation of the naive surface nets algorithm that is (in my opinion) much needed. Most open source implementations are hard to read and poorly documented, assuming much prior knowledge from the readers or optimized at the expense of readability and simplicity. This repository's implementation assumes minimal prior knowledge of:

The surface_nets.cpp file contains thorough documentation of the surface nets implementation in the form of comments. I hope this will be of help to many for learning mesh generation algorithms.

Dependencies

Building

$ git clone https://github.com/Q-Minh/naive-surface-nets
$ cd naive-surface-nets
$ cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
$ cmake --build build --target App --config Release
# generated executable will be at path ./build/Release/App.exe or ./build/App

Helpful Documentation

Releases

No releases published

Packages

No packages published