计算一条线的法线 [英] Calculate a point normal to a line
问题描述
我有一个由(x1,y1)(x2,y2)指定的行L,并且想要计算这个点的 但是我不知道如何以所有 谢谢 两点之间的中心点由 ,而(非标准化)法线是 如果我们对这个向量进行归一化,我们得到 $ b ( - (y2-y1),(x2-x1))/ sqrt((x2-x1)^ 2 +(y2-y1)^ 2)(b2 b1 如果我们将两者结合起来,我们可以找到两点 您的要求。 I have a line L specified by (x1,y1)(x2,y2) and want to calculate the
coordinates of the point that is: Examples: But i dont know how to calculate the coordinates in a generic way for all
lines regardless of the angle (-Pi to Pi). Thanks in advance! The center between both points is given by while the (unnormalized) normal is If we normalize this vector we get and if we combine both we find the two points which both fulfill your requirements. 这篇关于计算一条线的法线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
坐标:
位于法线上的
<例如:
计算点的坐标为((x2-x1)/ 2,D)。如果线是(a,y1)(a ,y2)(vertical),计算的
点的坐标为(D,(y2-y1)/ 2)。
行的通用方式计算坐标,而不考虑角度(-Pi到Pi)。
((x1 + x2)/ 2,(y1 + y2)/ 2)
( - (y2-y1 ),(x2-x1))
$ b pre $ )
$ b (x1 + x2)/ 2,(y1 + y2)/ 2)+ - D *( - (y2-y1),(x2-x1))/ sqrt((x2-x1)^ 2 +(y2-y1)^ 2)
((x1+x2)/2, (y1+y2)/2)
(-(y2-y1), (x2-x1))
(-(y2-y1), (x2-x1)) / sqrt((x2-x1)^2+(y2-y1)^2)
((x1+x2)/2, (y1+y2)/2) +- D * (-(y2-y1), (x2-x1)) / sqrt((x2-x1)^2+(y2-y1)^2)