Skip to main content
gamedev.net
🔒 Locked

D3D Quaternion problem ???

Started by yyh Jan 4, 2003 at 11:56 AM 3 replies 400+ views
Original Post
yyh
yyh
code [1] result is equal to code [2] //temp2 == temp1 ////////// //code 1// ////////// vAxis.x = 1.0f; vAxis.y = 0.0f; vAxis.z = 0.0f; fAngle = 0.785398; //45 degree D3DXQuaternionRotationAxis( &qCursor, &vAxis, fAngle ); D3DXMatrixRotationQuaternion( &matCursor, &qCursor ); D3DXMatrixMultiply( &temp2, &temp2, &matCursor ); vAxis.x = 0.0f; vAxis.y = 1.0f; vAxis.z = 0.0f; fAngle = 0.785398; //45 degree D3DXQuaternionRotationAxis( &qCursor, &vAxis, fAngle ); D3DXMatrixRotationQuaternion( &matCursor, &qCursor ); D3DXMatrixMultiply( &temp2, &temp2, &matCursor ); vAxis.x = 0.0f; vAxis.y = 0.0f; vAxis.z = 1.0f; fAngle = 0.785398; //45 degree D3DXQuaternionRotationAxis( &qCursor, &vAxis, fAngle ); D3DXMatrixRotationQuaternion( &matCursor, &qCursor ); D3DXMatrixMultiply( &temp2, &temp2, &matCursor ); ////////// //code 2// ////////// m_RotX = 0.785398f; //45 degree D3DXMatrixRotationX(&matRot,m_RotX); D3DXMatrixMultiply( &temp1, &temp1, &matRot ); m_RotY = 0.785398f; //45 degree D3DXMatrixRotationY(&matRot,m_RotY); D3DXMatrixMultiply( &temp1, &temp1, &matRot ); m_RotZ = 0.785398f; //45 degree D3DXMatrixRotationZ(&matRot,m_RotZ); D3DXMatrixMultiply( &temp1, &temp1, &matRot ); So my problem is what are the use of Quaternion and different of rotation ????? please !!!! thanks a lots..
Yee
Yann L
Yann L
quote:

code [1] result is equal to code [2] //temp2 == temp1


Of course they are equal. You are rotating around the same axes, using the same angles. So, what else did you expect ?
yyh
yyh
So why use Quaternion ???????
Yee
serg3d
serg3d
To interpolate rotations. There is no easy way to interpolate rotation with matrices.
Yann L
Yann L
Quaternions are mostly used to specify rotations in a convenient and intuitive angle/axis format. While still being able to easily interpolate and concatenate rotations, they completely avoid the gimbal lock problem (as it is very often encountered when using Euler angles).

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.