resqpy.olio.vector_utilities.points_in_polygons

resqpy.olio.vector_utilities.points_in_polygons(points: ndarray, polygons: ndarray, points_xlen: int) ndarray[source]

Calculates which points are within which polygons in 2D.

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

  • polygons (np.ndarray) – array of each polygons’ vertices in 2D.

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

Returns:

polygons_points (np.ndarray)

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

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