point_is_inside_polyhedron#

regridding.geometry.point_is_inside_polyhedron(point, polyhedron, winding_tolerance=1e-06)[source]#

Check if the given point is inside or on the boundary of a polyhedron defined by a sequence of triangles.

Parameters:
  • point (tuple[float, float, float]) – A 3D query point.

  • polyhedron (Sequence[tuple[tuple[float, float, float], tuple[float, float, float], tuple[float, float, float]]]) – A sequence of triangles describing the polyhedron. The vertices of the triangles must be oriented counterclockwise as viewed from outside the polyhedron.

  • winding_tolerance (float) – A parameter that controls the degree to which points close to the border are determined to be inside the polyhedron. Values close to 0.0 allow points on the border to be considered inside the polyhedron, and values close to 1.0 allow points on the border to be considered outside the polyhedron.

Return type:

bool

Notes

This function uses the generalized winding number developed by Jacobson et al.[1] to test if the point is inside the polyhedron.

Due to floating-point errors, there is some ambiguity for points right on the border of the polyhedron.

References