Original Post
🔒 Locked
Vector rotation question
Advertisement
I *think* but am not totally sure that it would be:
RotationVector = (v1 + v2) / sqrt(v1^2+v2^2)
Angle = (d1 + d2)
I just added the vectors together to get the resultant, then normalized it because that''s what you should always do, and just added the angles together. I''m pretty sure this is right.
RotationVector = (v1 + v2) / sqrt(v1^2+v2^2)
Angle = (d1 + d2)
I just added the vectors together to get the resultant, then normalized it because that''s what you should always do, and just added the angles together. I''m pretty sure this is right.
Shadow12345 - It's not.
Counter example:
v1 = [1, 0, 0] d1 = 90°
v2 = [0, 1, 0] d2 = 90°
Result:
v = [sqrt(2)/2, sqrt(2)/2, 0]
d = 90°
lwinkenb - That's exactly the problem quaternions solve.
[edited by - Fruny on May 3, 2004 12:51:08 PM]
Counter example:
v1 = [1, 0, 0] d1 = 90°
v2 = [0, 1, 0] d2 = 90°
Result:
v = [sqrt(2)/2, sqrt(2)/2, 0]
d = 90°
lwinkenb - That's exactly the problem quaternions solve.
Assume |v1| = |v2| = 1
Let A = [cos(d1/2), v1x.sin(d1/2), v1y.sin(d1/2), v1z.sin(d1/2)] = [Aw,Ax,Ay,Az]
Let B = [cos(d2/2), v2x.sin(d2/2), v2y.sin(d2/2), v2z.sin(d2/2)] = [Bw,Bx,By,Bz]
Q'= A*B = [Qw,Qx,Qy,Qz]
= [ Aw.Bw - Ax.Bx - Ay.By - Az.Bz,
Aw.Bx + Ax.Bw + Ay.Bz - Az.By,
Aw.By - Ax.Bz + Ay.Bw + Az.Bx,
Aw.Bz + Ax.By - Ay.Bx + Az.Bw ]
cos(d'/2) = Aw.Bw - Ax.Bx - Ay.By - Az.Bz
v'x.sin(d'/2) = Aw.Bx + Ax.Bw + Ay.Bz - Az.By
v'y.sin(d'/2) = Aw.By - Ax.Bz + Ay.Bw + Az.Bx
v'z.sin(d'/2) = Aw.Bz + Ax.By - Ay.Bx + Az.Bw
|(Qx,Qy,Qz)| = |sin(d'/2)|
= sqrt(1-cos(d'/2)^2)
= sqrt(1-Qw)
v' = (Qx,Qy,Qz) / sqrt(1-Qw)
d' = acos(Qw)*2
[edited by - Fruny on May 3, 2004 12:51:08 PM]
does it work unless you rotate one axis onto another though?
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement