matlabgeometrynormalsquadrilaterals

Catmull Clarke doesn't preserve planar normals


In the toy example I show, one of the surface normals is clearly incorrectly pointing inwards. I can create a new cube with the normals outward facing as expected, but after processing with Catmull Clarke, there is no guarantee that all normals will remain extant facing.

Since I'm using quadrilaterals by necessity, I know I can fix the face by transposing the vertice order i.e. [a b c d] -> [d c b a] and thus fix the normal. But how do I determine that a given face's normal is pointing the wrong direction?

(not enough rep to embed) https://gyazo.com/e20576e700196a43a2378eb055a71b38


Solution

  • You can check for sign of the dot product between the face normal vector and the vector from the cube's centroid to any point on the face.

    Let's say the normal vector of the face [a,b,c,d] is n. Next, compute the centroid of the cube by averaging its 8 vertex coordinates, and let's call it p.

    Then, calculate dir = dot(n,(a-p)). If dir > 0, the normal n is pointing outwards from the cube. If dir is negative, you have to flip the normal.

    This method will work for the faces of any convex polyhedron. If you're dealing with non-convex polyhedra, you will have to use an approach like the one mentioned here.