![](/img/trans.png)
[英]Python: find a x,y coordinate for a given point B using the distance from the point A (x0, y0) and the angle
[英]Method to find x,y point on a spline that is an exact distance from another point
我有一个二维样条曲线,它是(x,y)元组的列表。 如果将线的一端放在现有样条线上,则需要确定样条线上的点,其中长度L的线会落在该点上。
spline=[(x1,y1),(x2,y2),(xn,yn).....]
Line=200
for i in spline:
find (xn,yn) 200 units from here
因此,对于样条中的每个点,找到一个(Xn,Yn)(或内插值),该点与所选点的线性距离为200。
为什么不计算距离并将其与“线”进行比较,如下所示
spline=[(x1,y1),(x2,y2),(xn,yn).....]
Line=200
for x1,y1 in spline:
for x2,y2 in spline:
dist=math.sqrt((x2-x1)**2+(y2-y1)**2)
if dist==Line:
print x1,y1,'is Line distant from',x2,y2
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.