manifold
manifold copied to clipboard
Adding SDF class
Fixes #129
I've implemented my own take on Marching Cubes for making manifold meshes from signed-distance functions. It's a form of Marching Tetrahedra on a body-centered cubic grid, which ensures all tetrahedra are identical, maximum quality, and symmetric. It also ensures all output is manifold without needing to deal with edge cases.
I've implemented this for the GPU (of course it works on the CPU as well) because the computation can get pretty intense. The interface is intended to mimic Thrust with its use of functors, but I think I'm doing something wrong, because the type system isn't managing to infer as much as it should. For instance, I'd like to write const SDF sdf(Gyroid());
, but instead I seem to need this:
const Gyroid gyroid;
const SDF<Gyroid> sdf(gyroid);
I've still got some optimizations to do too.
So if I have a random glb I may be possible to test this?
Do I need to generate sdfs in some form? What form is that?
So if I have a random glb I may be possible to test this?
Do I need to generate sdfs in some form? What form is that?
There's documentation in sdf.h for the SDF class. Any function that takes a vec3 and returns a float will do. Turning an arbitrary GLB into an SDF is pretty non-trivial - that's not really what it's for. It's about creating complex surfaces from mathematical functions. Try out the sample.
Codecov Report
Merging #187 (94a3c69) into master (08598c0) will increase coverage by
0.02%
. The diff coverage is97.35%
.
@@ Coverage Diff @@
## master #187 +/- ##
==========================================
+ Coverage 98.15% 98.18% +0.02%
==========================================
Files 30 33 +3
Lines 2602 2919 +317
==========================================
+ Hits 2554 2866 +312
- Misses 48 53 +5
Impacted Files | Coverage Δ | |
---|---|---|
src/collider/src/collider.cpp | 100.00% <ø> (ø) |
|
src/manifold/src/impl.cpp | 100.00% <ø> (ø) |
|
src/utilities/include/structs.h | 100.00% <ø> (ø) |
|
src/utilities/include/utils.h | 100.00% <ø> (ø) |
|
src/sdf/include/sdf.h | 96.10% <96.10%> (ø) |
|
samples/src/gyroid_module.cpp | 100.00% <100.00%> (ø) |
|
src/manifold/src/boolean3.cpp | 100.00% <100.00%> (ø) |
|
src/manifold/src/boolean_result.cpp | 99.57% <100.00%> (+0.06%) |
:arrow_up: |
src/sdf/src/sdf.cpp | 100.00% <100.00%> (ø) |
|
src/utilities/include/par.h | 100.00% <100.00%> (ø) |
|
... and 17 more |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
I've simplified the API; I think this is pretty much ready to merge.