keep scale In quaternion
Ok , i want to find, is it possible keep scale of object in a quaternion ?
Do some body work with that ?
i found that quaternion to matrix conversion do the rotation and scale if little change in a classic conversion, any way this conversion more stable to produce rotation matrix (any errors only break scale ).
m.m[0][0] = ww + xx - yy - zz;
m.m[1][0] = 2.0f*(xy - wz);
m.m[2][0] = 2.0f*(xz + wy);
m.m[0][1] = 2.0f*(xy + wz);
m.m[1][1] = yy + ww - xx - zz;
m.m[2][1] = 2.0f*(yz - wx);
m.m[0][2] = 2.0f*(xz - wy);
m.m[1][2] = 2.0f*(yz + wx);
m.m[2][2] = zz + ww - xx - yy;
//------------------------------------------
The experiments show that multiplication of quaternion still work when they are scaled ? Is it correct ?
And my main quest , do some body know the matrix -> quaternion conversion that keep scale ?
All tips welcome !
I think the easiest will be to find the scale factor of the matrix, divide it by that to get a non-scaling matrix, converting that to a quaternion then reappyling the scale.
In detail: the matrix determinant is the scale^3, so to get the scale calculate the determinant and take it''s cube root. Divide the matrix by this and calculate the quaternion from this matrix. Then because the matrix scale is (quaternion size)^2 take the square root of the matrix scale and multiply the quaternion by it.
Note that this will only work if the matrix is a pure rotate/scale matrix. But you should know already that matrix->quaternion makes sense only for a rotation matrix.
Also note that for a pure rotate/scale matrix each column and each row is a vector with the same length as the scale factor. You can use this to get the scale factor more quickly or to verify it and to confirm the matrix is of the right sort.
In detail: the matrix determinant is the scale^3, so to get the scale calculate the determinant and take it''s cube root. Divide the matrix by this and calculate the quaternion from this matrix. Then because the matrix scale is (quaternion size)^2 take the square root of the matrix scale and multiply the quaternion by it.
Note that this will only work if the matrix is a pure rotate/scale matrix. But you should know already that matrix->quaternion makes sense only for a rotation matrix.
Also note that for a pure rotate/scale matrix each column and each row is a vector with the same length as the scale factor. You can use this to get the scale factor more quickly or to verify it and to confirm the matrix is of the right sort.
John BlackburneProgrammer, The Pitbull Syndicate
to "johnb"
Thanks for replay. I understand things that you talking about. I need the effective way to create quaternion than you propose. (if such exist).
Of couse i talk about rotation/scale matrix.
I not sure it have a much sense but may be it help me to understand the other ..
Thanks for replay. I understand things that you talking about. I need the effective way to create quaternion than you propose. (if such exist).
Of couse i talk about rotation/scale matrix.
I not sure it have a much sense but may be it help me to understand the other ..
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement