August 6, 2011 General News 2 Comments

99% of the time, algorithms end up being way more frustrating and way less effective in code than they were in your head. Then, there's that 1% of the time wherein divine powder falls from the sky, striking your code at a secret, magical angle that induces ridiculous levels of wow-this-just-works-ness. And then you ask "where's the catch?" and hope that there isn't one.

Such has been the story of SurfaceWrap, my work-in-progress surface-based scalar field polygonization algorithm. It's remarkable how well it's working so far. Granted, it's still not adaptive nor self-stitching, so I'm hesitant to terminate my relationship with marching cubes just yet...but things are looking really, really good. I've run into a surprisingly small number of headaches, especially considering how hard I usually fail at writing topological algorithms.

Here's the current state of the algorithm:

A few things to notice:

  • The triangles cover the surface very smoothly and gradually without slivers or jaggies
  • The consistency of the triangles is really nice! Looks like this algorithm is going to dominate with┬ásymmetric┬ásurfaces
  • Approximate normals are calculated for free (no gradient evaluations!) during the process! BIG WIN!
  • Although stitching isn't yet implemented, no self-intersection has been observed (so long as the boundary isn't allowed to wrap back around on itself). Looks like the small-angle-elimination feature is keeping everything in check

Next step: boundary merging/splitting. Pray for me.