This post is for preparing the Blender GSoC project. In the previous posts I tried several signed distance field/PDE based methods for the new Solidify modifier.

Here is another one which also makes use of signed distance field but has a more straightforward implementation. Simply put, I offset the mesh surface and perform a union at the self-intersection places.

Following illustrates the basic idea of this approach. The source code is provided on gist.

clip-at-zero-level

Note that I use signed distance function to determine if a vertex resides inside a polygon, rather than to fire a ray and compute the winding number.

In my opinion, the computation of winding number by firing a ray is not numerically robust and we have to handle the corner cases (such as co-planner issues, tangent hits, multiple counts at intersection, etc.) very carefully.