(V, E)
return orientation
Check the ccw orientation of each simplex in the mesh.
Check the ccw orientation of each simplex in the mesh.
Check the ccw orientation of each simplex in the mesh .
def check_mesh(V, E):
    """Check the ccw orientation of each simplex in the mesh."""
    E01 = np.vstack((V[E[:, 1], 0] - V[E[:, 0], 0],
                     V[E[:, 1], 1] - V[E[:, 0], 1],
                     np.zeros(E.shape[0]))).T
    E12 = np.vstack((V[E[:, 2], 0] - V[E[:, 1], 0],
                     V[E[:, 2], 1] - V[E[:, 1], 1],
                     np.zeros(E.shape[0]))).T
    orientation = np.all(np.cross(E01, E12)[:, 2] > 0)

    return orientation
def check_mesh ( V , E ) : E01 = np . vstack ( ( V [ E [ : , 1 ] , 0 ] - V [ E [ : , 0 ] , 0 ] , V [ E [ : , 1 ] , 1 ] - V [ E [ : , 0 ] , 1 ] , np . zeros ( E . shape [ 0 ] ) ) ) . T E12 = np . vstack ( ( V [ E [ : , 2 ] , 0 ] - V [ E [ : , 1 ] , 0 ] , V [ E [ : , 2 ] , 1 ] - V [ E [ : , 1 ] , 1 ] , np . zeros ( E . shape [ 0 ] ) ) ) . T orientation = np . all ( np . cross ( E01 , E12 ) [ : , 2 ] > 0 ) return orientation