Wed, 09/06/2023 - 00:31

Forums:

For a given internal face shared by two parent solids, how can I determine for which parent solid it faces outward and for which it faces inward?

For example, in the model below the internal face clearly points outwards with respect to the left cube and inwards with respect to the right cube, but it does not seem possible to determine this programatically.

Thu, 09/07/2023 - 00:06

A face has normal direction that is computed as vector product of first derivatives at each point on its surface. Also a face has orientation Forward or Reversed, which tells if the normal must be reversed in order to know actual normal direction. Face of a solid always must have normal pointed outside of the solid, taking into account orientation of this face as it is got from this solid. If a face is shared between two solids it must have different orientations in each of them.

Thu, 09/07/2023 - 00:35

Thanks, Mikhail, for your response.

Perhaps I misunderstand. You say that "If a face is shared between two solids it must have different orientations in each of them." However, to the best of my knowledge, two Solids can share the same Face object. The Orientation property of that face tells us how its normal relates to the underlying surface, but, I do not see how to tell for *which* solid it points outwards.

Thanks,

Alex

Thu, 09/07/2023 - 01:10

A shape has to kinds of comparing methods, IsEqual and IsSame. Indeed, in two solids there are different objects of type TopoDS_Face. So, is they are compared as IsEqual they are different, because they have different orientation. But if they are compared as IsSame it returns true, because they have the same geometry and location.

Sat, 09/09/2023 - 01:01

Ok this makes sense now. I was confused as I was comparing hash codes and finding them the same, not realizing that Orientation is treated separately. Thanks for your help.