pythonquadopenmesh

Openmesh faces on the same plane


I am playing with Python Openmesh. If I have a quad it will be split into triangles. When drawing on the screen I want to draw as a quad. Is there an easy was to check an edge and see if the normals of the two triangles are parallel? I assume dot product of normals. Is there a built in or easy way? Thanks.


Solution

  • OpenMesh provides the calc_dihedral_angle method which computes the angle between the two incident faces of an edge. It becomes zero for coplanar faces. You can check this with a small tolerance:

    for eh in mesh.edges():
        if abs(mesh.calc_dihedral_angle(eh)) < 1e-6:
            continue # Incident faces almost coplanar --> Skip edge
        # Draw edge