MatterHackers / agg-sharp

A C# port of Anti-Grain Geometry (AGG) with extensions for common scenarios
BSD 2-Clause "Simplified" License
183 stars 71 forks source link

Fix dual contouring implementation #1510

Closed oneill closed 2 years ago

oneill commented 2 years ago

This is my proposal to fix MatterHackers/MatterControl#5193.

It fixes some errors in the implementation and improves function ApproximateZeroCrossingPosition by including a linear interpolation in addition to the existing incremental search.

larsbrubaker commented 2 years ago

This is looking very close. The intention of the issue is to make Dual Contouring a viable output mode and the cube example was not sufficient to show all the required functionality. I have added another few modes to show some more error conditions as well as the ability to output marching cubes to demonstrate more of what the dual marching should produce.

Added a Cube and Sphere that is producing a strange result: image image

And 3 Boxes: image image

Hopefully this seems reasonable for this issue as the change as originally described is not useful to the project and it was hoped that fixing that issue with the corners would make dual contouring a viable output type for things like fixing meshes and an optional combine output type,