resqpy.olio.vector_utilities.points_in_triangles_aligned_optimised

resqpy.olio.vector_utilities.points_in_triangles_aligned_optimised(nx: int, ny: int, dx: float, dy: float, triangles: ndarray, n_batches: int = 20) ndarray[source]

Calculates which points are within which triangles in 2D for a regular mesh of aligned points.

Parameters
  • nx (int) – number of points in x axis

  • ny (int) – number of points in y axis

  • dx (float) – spacing of points in x axis (first point is at half dx)

  • dy (float) – spacing of points in y axis (first point is at half dy)

  • triangles (np.ndarray) – float array of each triangles’ vertices in 2D, shape (N, 3, 2)

  • n_batches (int, default 20) – number of parallel batches

Returns

triangles_points (np.ndarray)

2D array (list-like) containing only the points within each triangle,

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