[poly_contains_points] consistently return boolean arrays

This commit is contained in:
jan 2026-03-08 10:17:52 -07:00
commit 5cb608734d

View file

@ -62,7 +62,7 @@ def poly_contains_points(
vertices: ArrayLike, vertices: ArrayLike,
points: ArrayLike, points: ArrayLike,
include_boundary: bool = True, include_boundary: bool = True,
) -> NDArray[numpy.int_]: ) -> NDArray[numpy.bool_]:
""" """
Tests whether the provided points are inside the implicitly closed polygon Tests whether the provided points are inside the implicitly closed polygon
described by the provided list of vertices. described by the provided list of vertices.
@ -81,7 +81,7 @@ def poly_contains_points(
vertices = numpy.asarray(vertices, dtype=float) vertices = numpy.asarray(vertices, dtype=float)
if points.size == 0: if points.size == 0:
return numpy.zeros(0, dtype=numpy.int8) return numpy.zeros(0, dtype=bool)
min_bounds = numpy.min(vertices, axis=0)[None, :] min_bounds = numpy.min(vertices, axis=0)[None, :]
max_bounds = numpy.max(vertices, axis=0)[None, :] max_bounds = numpy.max(vertices, axis=0)[None, :]