找到第三点 [英] Find the third point
本文介绍了找到第三点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有2分P1
和P2
.我需要找到P3
,以便
I have 2 points P1
and P2
. I need to find the P3
, in order that
- 所有点都在同一条线上;
-
P3
应该与P2
保持距离d
(远离P1
)
- all points to be on the same line;
P3
should be at the distanced
from theP2
(away fromP1
)
我启动了一个复杂的系统,显然很难解决...
I started a complicated system apparently hardly to resolve...
PS.
矢量答案很酷,但是我使用C#并且不知道如何在此处添加矢量.
Vectorial answers is cool, but I use C# and don't know how to add vectors over there.
推荐答案
P3 = P2 + d * ±(P2 - P1) / |P2 - P1|
因为购物很容易:
mag = sqrt((P2x - P1x) ** 2 + (P2y - P1y) ** 2)
P3x = P2x + d * (P2x - P1x) / mag
P3y = P2y + d * (P2y - P1y) / mag
这篇关于找到第三点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文