Skip to content

Instantly share code, notes, and snippets.

@marmakoide
Last active November 15, 2022 08:58
Show Gist options
  • Save marmakoide/2b148e65c9f34945c25a5f666852dc5b to your computer and use it in GitHub Desktop.
Save marmakoide/2b148e65c9f34945c25a5f666852dc5b to your computer and use it in GitHub Desktop.
Test if a point is inside a convex hull
import numppy
from scipy.spatial import ConvexHull
def convex_hull_contains_point(hull, P):
for E in hull.equations:
if numpy.dot(P, E[:-1]) > -E[-1]:
return False
return True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment