resqpy.olio.vector_utilities.points_in_triangles

resqpy.olio.vector_utilities.points_in_triangles(p, t, da, projection='xy', edged=False)[source]

Returns 2D numpy bool array indicating which of points da are within which triangles.

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

  • da (numpy float array of shape (D, 2 or 3)) – points to test for

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

  • edged (bool, default False) – if True, points lying exactly on the edge of a triangle are included as being in the triangle, otherwise they are excluded

Returns:

numpy bool array of shape (M, D) indicating which points are within which triangles

Note

the triangles do not need to be in a consistent clockwise or anti-clockwise order