I want to rotate a quat representing a local rotation by a global axis rotation
currently I'm extracting the axes from a temp matrix which works but I think I'm missing a trick
' AL is the eular pitch yaw roll local rotation angles
q.FromEuler(AL)
m=q.toMatrix() ' local rotation
' A is the eular pitch yaw roll world rotation angles
qz.FromAxisAngle(A.z,m[2], m[6], m[10]) ' global Z axis rotation
qy.FromAxisAngle(A.y,m[1], m[5], m[9]) ' global Y axis rotation
qx.FromAxisAngle(A.x,m[0], m[4], m[8]) ' global X axis rotation
qz.multiply(qy) 'quat z=quat z * quat y
qz.multiply(qx) 'quat z=quat z * quat x
q.multiply(qz) 'local rotation quat * xyz quat
m=q.tomatrix() ' the local rotation rotated by the global rotation
glmultMatrixD(m)
does anyone know a better way of doing this?
|