[Bf-committers] Patch for bug 1355
Jonathan Merritt
bf-committers@blender.org
Sun, 13 Jun 2004 11:39:52 +1000
jeremy@marzhillstudios.com wrote:
>The adjacent face method worked for sphere but not test blend. The
>mesh centroid worked for test blend but not sphere. Anyone got a
>suggestion as to how to proceed from here? Its possible we migh need
>to offer a selection of algorithms for this function. Different types
>of meshes need different types of methods.
>
>
This is off the top of my head. It may be woefully slow (who knows?),
but is there anything wrong with it:
1. Select a face of the mesh.
2. Construct a line along the normal of the face. Trace the line out on
one side of the face; if it intersects zero or any even number of faces
then accept this as the "outside" direction, otherwise take the other
direction as "outside". (This borrows from the concept of "Gaussian
surfaces" in physics.)
3. For non-manifold meshes, repeat step 2 for all faces (non-manifold
meshes surely don't have a well-defined inside or outside anyway!?).
4. For manifold meshes, it may be possible to use edge adjacency to
propagate the first normal found. This can be done by using the concept
of normals that are determined by the "winding direction" of the vertex
ordering. For normals to be consistent across faces that share an
adjacent edge, the ordering of vertices is reversed across the edge (the
two adjacent polygons "wind through" the edge in different directions -
I need a diagram! :-). Regardless of the actual implementation,
consistent normals can be found using this concept. Propagation could
be done by a variety of different methods that search outwards from the
initial face.
What do you think?
Jonathan Merritt.