3

通常如何找到两个向量的二等分 b = (bx, by)(我们考虑两个非零向量 u = (ux, uy), v = (vx, vy),它们可能是共线的)。

对于非共线向量,我们可以写:

bx = ux/|u| + vx / |v|
by = uy/|u| + vy / |v|

但是对于共线向量

bx = by = 0.

例子:

u = (0 , 1)
v = (0, -1)
b = (0, 0)
4

2 回答 2

6

一种通用且统一的方法是获取两个向量的角度

theta_u = math.atan2(ux, uy)
theta_v = math.atan2(vx, vy)

并创建一个具有平均角度的新向量:

middle_theta = (theta_u+theta_v)/2
(bx, by) = (cos(middle_theta), sin(middle_theta))

这样,您就可以避免使用相反向量观察到的陷阱。

PS:请注意,“平分线”向量的含义并不明确:通常有两个平分线向量(通常一个用于较小的角度,一个用于较大的角度)。如果您希望平分线向量在较小的角度内,那么您的原始公式非常好;您可以单独处理您观察到的特殊情况,例如,(-uy/|u|, ux/|u|)如果您的公式产生空向量,则采用与两个输入向量中的任何一个正交的向量。

于 2011-07-03T13:05:35.923 回答
5

求 u 和 v 的单位二等分向量。

if u/|u|+v/|v| !=0

first calculate the unit vector of u and v

then use the parallelogram rule to get the bisection (just add them)

since they both have unit of 1, their sum is the bisector vector 

then calculate the unit vector of the calculated vector.

else (if u/|u|+v/|v| ==0):
 (if you use the method above, it's like a indintermination: 0*infinity=?)

 if you want the bisector of (u0v) if u/|u| = (cos(t),sin(t)) 
 take b=(cost(t+Pi/2),sin(t+Pi/2)) = (-sin(t),cos(t) )as the bisector
 therefore if u/|u|=(a1,a2) chose b=(-a2,a1)

例子:

u=(0,1)
v=(0,-1)
the bisector of (u0v):
b=(-1,0)
于 2011-07-03T12:34:56.873 回答