Question

I just dig a bit deeper in use of quaternions in 3D game programming (Yes, I know about matrices and they are OK, but we always have to learn some new things), so, we can rotate some object like this Pout = q*Pin*conjug(q), where are q is quaternion, Pin is an object of(let's say we are using some framework, where this class is defined for us) the Vector3 class, conjug(q) is the q quaternion after the its conjugating and, finally, Pout is the new Vector3's object, which we got after the rotation initial Vector3's object Pin by some angle alfa(or theta, whatever you like). Also, I know there is a way to combine rotations, like so: q_final = q2*q1 (this represents rotating by the alfa1 and then by the alfa2 angles). And, finally, dot product represents the angle between 2 quaternions in, let's say, sphere. This is clear for me. My question will concern such things as division, adding and subtracting.

My question is: Could anybody tell me, please, what are they(division, adding, subtracting -operations on quaternions) representing in a 3D programming? How they will affect on 3D model?

Thank you beforehand for your answers.

p.s. If you (DarenW, bensiu, Dharmendra, Uwe Keim, Jennis) can't understand this question, please, leave this topic. Someone might have an answer. Thank you.

Was it helpful?

Solution

As you know, quaternions are identifiable with 4x4 real matrices. Quaternion multiplication, scalar multiplication and addition is preserved by this identification (see http://en.wikipedia.org/wiki/Quaternion#Matrix_representations). So converting two quaternions to 4x4 matrices, adding them, and converting them back is the same as just adding them. The same thing is true for multiplication.

Division of quaternion A by quaternion B is nothing more than multiplying A by the multiplicative inverse of B. This is equivalent to the matrix form of A multiplied by the inverse of the matrix form of B.

Note that rigid-body rotations (no shearing or scaling) are represented by unit length quaternions. So you can accumulate rotations by multiplying unit quaterions. Addition in this case isn't as useful.

Finally, the main reason we use quaterions in graphics is in interpolating key frames (e.g. Eberly 1999). That is, if we know the desired rotations at k positions, we can interpolate the quaterions, e.g. with a spline, resulting in a quaternion-valued curve. Each value C(t) is a unit quaternion, so it represents an intermediate rotation. Key frame interpolation is harder with homogeneous matrices because not all 4x4 matrices represent homogeneous transforms: The interpolation process may add scaling, shearing, etc.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top