resqpy.olio.vector_utilities.clockwise_triangles

resqpy.olio.vector_utilities.clockwise_triangles(p, t, projection='xy')[source]

Returns a numpy array of +ve values where triangle points are in clockwise order, 0.0 if in line, -ve for ccw.

Parameters:
  • p (numpy float array of shape (N, 2 or 3)) – points in use as vertices of triangles

  • t (numpy int array of shape (M, 3)) – indices into first axis of p defining the triangles

  • projection (string, default 'xy') – one of ‘xy’, ‘xz’ or ‘yz’ being the direction of projection, ie. which elements of the second axis of p to use; must be ‘xy’ if p has shape (N, 2)

Returns:

numpy float array of shape (M,) being the +ve or -ve values indicating clockwise or anti-clockwise ordering of each triangle’s vertices when projected onto the specified plane and viewed in the direction negative to positive of the omitted axis

Note

assumes xyz axes are left-handed (reverse the result for a right handed system)