polytopax.point_in_convex_hull

polytopax.point_in_convex_hull(point: Array, hull_vertices: Array, tolerance: float = 1e-08, method: str = 'halfspace') Array[source]

Test if point is inside convex hull.

Determines whether a point lies inside, on the boundary, or outside of the convex hull defined by the given vertices.

Parameters:
  • point – Point to test with shape (…, dim)

  • hull_vertices – Hull vertices with shape (…, n_vertices, dim)

  • tolerance – Numerical tolerance for boundary detection

  • method – Algorithm to use (“halfspace”, “linear_programming”, “barycentric”)

Returns:

Boolean array indicating inclusion (True = inside or on boundary)

Algorithm (linear_programming method):

A point p is inside the convex hull if it can be expressed as: p = sum(λᵢ * vᵢ) where sum(λᵢ) = 1 and λᵢ >= 0

This is solved as a linear programming problem: minimize 0 subject to: sum(λᵢ * vᵢ) = p

sum(λᵢ) = 1 λᵢ >= 0