resqpy.olio.vector_utilities.point_in_polygon

resqpy.olio.vector_utilities.point_in_polygon(x, y, polygon)[source]

Calculates if a point in within a polygon in 2D.

Parameters
  • x (float) – the point’s x-coordinate.

  • y (float) – the point’s y-coordinate.

  • polygon (np.ndarray) – array of the polygon’s vertices in 2D.

Returns

inside (bool) – True if point is within the polygon, False otherwise.

Note

the polygon is assumed closed, the closing point should not be repeated