IfcPolygonalFaceSet and face winding.
Hello, I’m a bit confused about the winding of faces in IfcPolygonalFaceSet.
According to the spec:
NOTE If the IfcPolygonalFaceSet is closed, the face vertices of the IfcIndexedPolygonalFace’s shall connect counterclock-wise when seen from the outside of the closed shell to guarantee that the face normal points away from the material of the shell. Inner loops, provided by the IfcIndexedPolygonalFaceWithVoids, shall connect clock-wise.
Which makes sense, however I am unsure as to how to resolve the normal direction if the vertex ordering is not supplied (as I expect) correctly. The example on that page also highlights my problem.
According to the example (specifically Figure 342)…
Face #6 (the ‘top’ of the cube) is defined 6, 7, 8, 5… which prodcues a winding which (by cross product) gives a normal of the face pointing upwards (0,0,1), assuming z up.
Face #1 (the ‘bottom’ of the cube) is defined 1, 2, 3, 4… which prodcues a winding which (by cross product) gives a normal of the face pointing upwards (0,0,1) as well… same as Face #6 [6,7,8,5]).
The windings are the same, yet I would thought the winding of face 1 should be reversed (to produce a normal 0,0,-1 by cross product)… e.g. 4, 3, 2, 1
How can I know to reverse certain windings and not others when two (horizontal) faces have windings producing the same direction when (I assume, perhaps incorrectly) that they should be different?
I’m in a catch 22, as in order to understand what is ‘inside’ or ‘outside’ of the closed shell, I need to know the correct normal in the first place.
Also to add to my confusion, when checking IfcIndexedPolygonalFace…
… according to figures 338 and 339 (which show to different windings) it seems that the winding should be reversed simply if the indexes are provided by a PnIndex or not. This seems a really subtle behaviour trait, is this by design? why would simply having an extra ‘indexed’ layer suddenly imply the windings are opposite?
Many thanks.