resqpy.olio.vector_utilities.mesh_points_in_triangle

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

Calculates which implicit mesh points are within a triangle in 2D for normalised triangle.

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

  • points_xlen (int) – the number of unique x coordinates, starting at 0.0, spacing 1.0.

  • points_ylen (int) – the number of unique y coordinates, starting at 0.0, spacing 1.0.

  • 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.