
Simplest possible smooth contouring algorithm - okaleniuk
https://wordsandbuttons.online/the_simplest_possible_smooth_contouring_algorithm.html
======
andrewla
Very interesting, and I like the interactive graphics. I've been looking at
this problem recently with an eye towards what it looks like to translate
scene descriptions from an SDF (signed distance function) representation of a
CSG (constructive solid geometry) scene to a triangular-mesh representation.
I've looked at marching cubes, which has another page on this site that is
linked from this page, but it seems kind of inelegant.

The obvious problem with this method is that it relies in the underlying
object being smooth, and many CSG designs have cusps and other non-smooth
artifacts that are very hard to derive from an abstract representation because
the SDF is not well-behaved around those regions.

~~~
okaleniuk
Try dual contouring. It preserves sharp features from the box. When combined
with octrees, it's much more effective than the simple thing.
[https://www.cse.wustl.edu/~taoju/research/dualContour.pdf](https://www.cse.wustl.edu/~taoju/research/dualContour.pdf)

------
lalaithion
It's pretty easy to create weird loops in the contour by placing two dots with
about ~0.5r of distance between the edges.

------
fwip
What makes this the simplest possible algorithm?

~~~
Scarblac
As opposed to, say, drawing a circle large enough to encompass all the points.

------
jerrysievert
I really have a problem with this article, not because of the algorithm, but
because of the presentation:

    
    
        for(x...)
        for(y...)
        for(z...) {
          ...
        }
    

I believe that code should at least attempt to be literate, and this just
makes me shake my head in frustration.

~~~
karmakaze
I see no problem with this and do it myself if autoformat doesn't undo it.

This is being literate (evaluating over a space of three dimensions) rather
than literal (of nested loops).

