Optus 422 Report post Posted August 16, 2004 Hi, I had a small question about rotating a vector by a quaternion. The quaternion/matrix FAQ on this site in the articles section (at the very end) has the following: Q63. How do I use quaternions to rotate a vector? A rather elegant way to rotate a vector using a quaternion directly is the following (qr being the rotation quaternion): -1 v' = qr * v * qr This can easily be realised and is most likely faster then the transformation using a rotation matrix. So we define v' the rotated vector, qr is the orientation, v is the source vector, and qr^-1 is qr's inverse. From here, I am lost. Do the *'s represent cross product? or multiplication? And B) quaternions have four elements, vectors three. Doesn't this complicate doing a cross product or even multiplication? And does this imply that v is a four-vector? Previously in my game, I was converting quaternions into matrices to transform vectors. I could see how this would be a lot faster! I've done lots of googling, including looking through mathworld's quat section. I haven't seen this particular method anywhere. Thanks for your time Adam 0 Share this post Link to post Share on other sites
Dmytry 1151 Report post Posted August 16, 2004 no,i don't think it faster than matrix. In fact,matrix is constructed fromv' = qr * v * qr^{-1}IIRC, it's 4-vector there... but i'm not really 100% sure. 0 Share this post Link to post Share on other sites
SiCrane 11839 Report post Posted August 16, 2004 Usually I see that represented asp' = q * p * q^{-1}where p is a pure quaternion made from the 3-vector to be rotated. A pure quaternion just takes the vector components as the i, j, and k terms with no scalar quantity or on other notations (0, v). So it becomes the normal multiplication of three quaternions.In any case, this tends to save a few multiplications and additions compared to converting the quaternion to a full matrix and mulitplying the vector by the matrix. IIRC, if you need to multiply a lot of vectors by the same quaternion, it's still more efficient to convert to a matrix and then multiply all the vectors by the matrix.(Oh, and mathworld does mention this method. See equation 30 on the quaternion entry.) 0 Share this post Link to post Share on other sites
VolkerG 151 Report post Posted August 16, 2004 it is a quaternion multiplication and v is usually a quaternion where the scalar (real) part is zero and the vector (imaginary) part is the vector to rotate. 0 Share this post Link to post Share on other sites