Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我知道线段的起点和终点。对于此示例,假设线段的距离为 5。现在我想知道距离终点为 3 的点。知道如何用数学来做到这一点吗?
起点 (0,0) 终点 (0,5)
我想找到的点 (0,2)
如果您的点是(x1, y1)和(x2, y2),并且您想找到与点 2(x3, y3)相距n单位的点:
(x1, y1)
(x2, y2)
(x3, y3)
n
d = sqrt((x2-x1)^2 + (y2 - y1)^2) #distance r = n / d #segment ratio x3 = r * x2 + (1 - r) * x1 #find point that divides the segment y3 = r * y2 + (1 - r) * y1 #into the ratio (1-r):r