Last active
November 15, 2022 08:58
-
-
Save marmakoide/2b148e65c9f34945c25a5f666852dc5b to your computer and use it in GitHub Desktop.
Test if a point is inside a convex hull
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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