python - Check if points lies inside a convex hull -
i making convex hull using scipy.spatial
package http://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.convexhull.html#scipy.spatial.convexhull
i've tried searching, have yet know if there easy way find if point (latitude/longitude) lies inside convex hull. suggestions?
the method i've used before using path
class matplotlib
. has contains_point
method that. contains_points
allows query array of points.
to use do
from scipy.spatial import convexhull matplotlib.path import path hull = convexhull( points ) hull_path = path( points[hull.vertices] ) print hull_path.contains_point((1,2)) # (1,2) in convex hull?
Comments
Post a Comment