所以基本上我有两个问题需要解决,我已经用Symphy解决了很多次了,但是当它工作的时候,它会变慢
第一个问题是我需要将两条线段转换成直线,然后找到这些直线的截距点。每条线段本身不截取另一条线段。我还需要找到这些线之间的角度,单位是度。下面是我目前正在使用的Symphy代码,其中包含一些示例值,但它的运行速度会变慢,我需要找到另一种方法来解决这一问题,而且速度要快得多
第一个问题:
import math
from sympy import Point, Line, Segment, Polygon
p1=Point(1, 4)
p2=Point(8, 8)
p3=Point(10, 10)
p4=Point(16, 16)
l1 = Line(p1, p2)
l2 = Line(p3, p4)
showIntersection = l1.intersection(l2)
unList=showIntersection[0]
points=unList.coordinates
angle = float(l1.angle_between(l2))
angleDegrees = angle*(180/math.pi)
x0inter=float(points[0])
y0inter=float(points[1])
第二个问题更简单,我需要找出点是否包含在四边形中。我可以使用示例代码或建议我应该使用哪个库
目前没有回答
相关问题 更多 >
编程相关推荐