Add OpenMesh face only if does not result in complex face/edge/vertex

74 views Asked by At

Is there a way to test whether adding a new face would result in complex edges/faces and skip adding if it would?

The function add_face uses 3 ordered VertexHandle to add a face to the mesh. If the order of vertices is incompatible with the existing mesh (so that the face would be wrongly oriented) or a triangle already exists with those 3 vertices, this is the typical warning OpenMesh gives:

PolyMeshT::add_face: complex edge

I was wondering if it is possible to test whether a face addition would result in such complex edge warning and skip the addition if it would? I'm thinking some kind of try-catch block. Alternatively, how can I remove the face that caused such an incompatibility?

Note that here my aim is not to properly orient the new face. I simply do not want to add it if it causes incompatibilities.

1

There are 1 answers

0
Botond On

As per the nice explanation of the developers,

if you add a face and get this warning, the face will not be actually added to the mesh. You will receive an invalid face handle as the return value of the add_face function. Therefore you do not have to remove anything.