![]() ![]() q = is a quaternion representing a rotation.p 2 = is a vector representing a point after being rotated.However, to rotate a vector, we must use this formula: This almost works as explained on this page. One approach might be to define a quaternion which, when multiplied by a vector, rotates it: In theġ80 degree case the axis can be anything at 90 degrees to the vectors so there Not matter and can be anything because there is no rotation round it. X v2 will be zero because sin(0)=sin(180)=0. If the vectors are parallel (angle = 0 or 180 degrees) then the length of v1 So, if v1 and v2 are normalised so that |v1|=|v2|=1, then, ![]() Two vectors, the length of this axis is given by |v1 x v2| = |v1||v2| sin(angle). the axis is given by the cross product of the.Of the two (normalised) vectors: v1v2 = |v1||v2| cos(angle) the angle is given by acos of the dot product.This is easiest to calculate using axis-angle representation because: using:Īngle of 2 relative to 1= atan2(v2.y,v2.x) - atan2(v1.y,v1.x)įor a discussion of the issues to be aware of when using this formula see the page here. If we want a + or - value to indicate which vector is ahead, then we probably need to use the atan2 function (as explained on this page). In most math libraries acos will usually return a value between 0 and π ( in radians) which is 0° and 180°. In other words, it won't tell us if v1 is ahead or behind v2, to go from v1 to v2 is the opposite direction from v2 to v1. The only problem is, this won't give all possible values between 0° and 360°, or -180° and +180°. acos = arc cos = inverse of cosine function see trigonometry page. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |