Code: Select all
vector3df someIrrVect(390, 89, 219);
matrix4 matrixIrr, matrixIrr2;
//matrixIrr.makeIdentity();
matrixIrr.setRotationDegrees(someIrrVect);
Quaternion quat = Quaternion( Matrix3( matrixIrr[0], matrixIrr[4], matrixIrr[8],
matrixIrr[1], matrixIrr[5], matrixIrr[9],
matrixIrr[2], matrixIrr[6], matrixIrr[10] ) );
//quat.normalise();
Matrix3 rot;
Vector3 xcol, ycol, zcol;
quat.ToRotationMatrix( rot ); // creates a 3x3 rotation matrix from the Quaternion.
xcol = rot.GetColumn(0);
ycol = rot.GetColumn(1);
zcol = rot.GetColumn(2);
//matrixIrr2.makeIdentity();
// now fill the final matrix with the appropriate data:
matrixIrr2[0] = xcol.x;
matrixIrr2[1] = xcol.y;
matrixIrr2[2] = xcol.z;
matrixIrr2[3] = 0.0f;
matrixIrr2[4] = ycol.x;
matrixIrr2[5] = ycol.y;
matrixIrr2[6] = ycol.z;
matrixIrr2[7] = 0.0f;
matrixIrr2[8] = zcol.x;
matrixIrr2[9] = zcol.y;
matrixIrr2[10] = zcol.z;
matrixIrr2[11] = 0.0f;
vector3df result = matrixIrr2.getRotationDegrees();
but all that math pushes me out. May be there is some blackbox decision that handles all calculations and deals with quaternion's particular features internally? And whats wrong with that code?