from shapely.geometry import Point, LineString from shapely.geometry import Polygon,MultiPoint #多边形 import matplotlib.pyplot as plt point = Point(4, 4) poly = Polygon([(0, 0), (2,2),(3, 0), (3, 3), (0, 3)]) print(poly.area) print(poly.contains(point)) ax = plt.gca() #获取到当前坐标轴信息 ax.xaxis.set_ticks_position('top') #将X坐标轴移到上面 ax.invert_yaxis() #反转Y坐标轴 plt.plot(*poly.exterior.xy) plt.show()
[python][原创]判断某个点是不是在多边形里面
最新推荐文章于 2024-06-14 16:22:29 发布