resqpy.olio.vector_utilities.points_in_triangle

resqpy.olio.vector_utilities.points_in_triangle(points: ndarray, triangle: ndarray, points_xlen: int, triangle_num: int = 0) ndarray[source]

Calculates which points are within a triangle in 2D.

Parameters:
  • points (np.ndarray) – array of the points in 2D.

  • triangle (np.ndarray) – array of the triangle’s vertices in 2D, shape (3, 2).

  • points_xlen (int) – the number of unique x coordinates.

  • triangle_num (int) – the triangle number, default is 0.

Returns:

triangle_points (np.ndarray)

2D array containing only the points within the triangle,

with each row being the triangle number, points y index, and points x index.