Degenerate Faces

A degenerate face is a face with two vertex indices that are identical, and therefore no geometric area, and no normal . Some applications consider degenerate faces illegal, and do not allow them to be created or imported. 3ds Max allows them to be created in Mesh objects, but they are generally discouraged. They cannot be created in MNMesh objects. Some native geometric shapes, such as the teapot, contain degenerate faces when converted to an Editable Mesh.

Degenerate faces will cause a hard edge on smoothed meshes, and this is the one legitimate case for creating them. Many importers for 3ds Max, from both Autodesk and third parties, may create meshes that contain degenerate faces and other "unfriendly" geometry. Your plugin code should be careful when dealing with meshes that are imported. There are no native Mesh methods that create degenerate faces inadvertently; you must explicitly create duplicate vertices. The Mesh copy and clone methods do not check for degenerate faces.

There are some things to consider when writing algorithms that deal with Mesh objects that might contain degenerate faces. Some APIs do not account for degenerate faces; for example, AdjFaceList will report incorrect results if the mesh contains them. You should also be careful when walking an edge from vertex to vertex, as degenerate faces can cause a circular loop. This is because if you hit a degenerate face, you will have an edge that looks like this: A <-- -- -->A. Always check that you are walking forward, and never assume you are working with valid geometry. Similarly, tessellation algorithms or any code that divides faces should check for degenerate faces and skip them, or clear all degenerate faces on the mesh to begin with, as dividing degenerate faces has no effect and is a performance overhead. The Mesh.RemoveDegenerateFaces() method provides an easy way to do this.

See the UVUnwrap sample ( maxsdk/samples/modifiers/uvwunwrap/MeshTopData.cpp ) for an example of detecting and dealing with degenerate faces.