使用该线上的点查找垂直线 [英] Find perpendicular line using points on that line
本文介绍了使用该线上的点查找垂直线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一条线(P1,P2)和该线上的一个点(中点).我可以使用什么方程式找到通过中点的直线(P1,P2)的垂直线.标有?"的点未知.我不希望使用角度,仅给出3个点(P1,P2,中点).直线P1,P2可以具有任何方向/角度.
I have a line (P1, P2), and a point on that line (midpoint). What equation can I used to find the perpendicular line of line (P1, P2), that passes through midpoint. The point labelled with a '?' is unknown. I do not wish to use angles, only the 3 points given (P1, P2, midpoint). The line P1, P2 can be of any orientation/angle.
提前谢谢.
推荐答案
定义向量
D = P2 - P1 (dx=x2-x1, dy = y2-y1)
和中间点
mx = (x2+x1)/2
my = (y2+y1)/2
垂直于D向量
PD = (-dy, dx)
单位(归一化)垂直向量
Unit (normalized) perpendicular vector
U = (-dy / L, dx / L)
where
L = Sqrt (dx * dx + dy * dy)
与中心的距离为F的点的坐标为
And coordinates of point lying at distance F from the middle are
x = mx + U.x * F
y = my + U.y * F
或(指向另一侧)
x = mx - U.x * F
y = my - U.y * F
这篇关于使用该线上的点查找垂直线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文