environmentaltools.spatial.in_box
- environmentaltools.spatial.in_box(towers, bounding_box)[source]
Check if points are within rectangular bounding box.
- Parameters:
towers (np.ndarray) – Point coordinates as (N, 2) array of [x, y] values
bounding_box (tuple or list) – Rectangular bounds as [xmin, xmax, ymin, ymax]
- Returns:
Boolean array of length N indicating which points are inside the box (True if inside, False if outside)
- Return type:
np.ndarray
Examples
>>> import numpy as np >>> points = np.array([[0, 0], [5, 5], [15, 15]]) >>> bbox = [0, 10, 0, 10] >>> mask = in_box(points, bbox) >>> print(mask) [True, True, False]