Acoular 25.03 documentation

acoular.grids.in_hull

«  Polygon   ::   grids   ::   microphones  »

acoular.grids.in_hull

acoular.grids.in_hull(p, hull, border=True, tol=0)

Test if points in p are in hull, in- or excluding the border.

Parameters:
pnumpy.ndarray of floats, shape (N, K)

Coordinates of N points in K dimensions.

hullnumpy.ndarray of floats, shape (M, K), or Delaunay object

Coordinates of M points in K dimensions for which Delaunay triangulation will be computed.

borderbool, optional

Points in p on the border of hull will be kept in the return if True. If False, only points inside hull will be kept. Default is True.

tolfloat, optional

Tolerance allowed in the inside-triangle check. Default is 0.

Returns:
numpy.ndarray of bools

An array of boolean values indicating which points in p are inside the hull, same shape as p. Each entry is True if the corresponding point is inside the hull (or on the border, if border=True), and False otherwise.

Notes

This function uses Delaunay triangulation to determine if a point is inside the convex hull, which is efficient and robust for arbitrary shapes in higher-dimensional spaces.

Examples

>>> from acoular.grids import in_hull
>>> import numpy as np
>>> from scipy.spatial import Delaunay
>>> points = np.array([[0, 0], [1, 0], [0, 1], [1, 1]])
>>> hull = Delaunay(points)
>>> p = np.array([[0.5, 0.5], [2, 2]])
>>> in_hull(p, hull)
array([ True, False])

«  Polygon   ::   grids   ::   microphones  »