from shapely import geometry
import matplotlib.pyplot as plt
pts = [(0, 0), (1, 1), (0, 1), (0, 0)]
polygon = geometry.Polygon(pts)
pt = 0.1, 0.2
point = geometry.Point(*pt)
plt.figure(0)
plt.plot([i[0] for i in pts], [i[1] for i in pts])
plt.scatter(*pt)
print(polygon.contains(point))
判断点在三角形(多边形)内部 python
最新推荐文章于 2023-10-14 18:07:54 发布