
Сообщение от
Евгений Круг
А ты про scipy слышал? Она тоже норм. К примеру, можно использовать путь:
[PHP]
from scipy.spatial import ConvexHull
import numpy as np
points = np.array([(2, 1), (8, 1), (8, 6), (2, 6)])
hull = ConvexHull(points)
def is_point_in_hull(point, hull, points):
new_points = np.append(points, [point], axis=0)
new_hull = ConvexHull(new_points)
return len(hull.vertices) == len(new_hull.vertices)
point = (4, 2)
print(is_point_in_hull(point, hull, points)) # True
[PHP]
Попробуй, может зайдет!