Matrix needed to convert rotations for one coordinate system to another

c++, collada, matrix, rotation

Solution

I think that you need to multiply by two matrices to change the basis of your rotation matrix.

Indeed, the ColladaMatrix is the one that does ([col] mean in the collada coordinates, [gl] in the GL coordinates)

y[col] = R[col,col] x[col]

but if you want to use the GL matrix, you need to transform the x[col] into GL coordinates, then apply the rotation in the GL basis and finally come back to the Collada coordinates. So

y[col] = B[gl->col] R[gl,gl] B[col->gl] x[col]

So,

R[col,col] = B[gl->col] R[gl,gl] B[col->gl]

and here B[gl->col] and B[col->gl] are the same, so

                  [1 0 0                  [1 0 0
MatrixCollada  =   0 0 1   * MatrixGL *    0 0 1
                   0 1 0]                  0 1 0]

Hope it helps!

Remark: The same happen when diagonalizing a matrix (which is actually a change of basis), you need to pre- and post-multiply the matrix that you want to diagonalize.

Edit: I wrote the two coordinates systems for the matrices, because in general, a matrix can send a vector from a coordinate system to another one. This makes it more clear.

Problem

i have rotationmatrixes in a "selfmade" GL coordinate system, and want to apply them to a collada coordinate system. I know i need a Matrix to multiply the GL rotations to convert them into the collada coordinate system ( where Z is actually UP). The coordinate systems are shown in the picture here : i need the conversion from the left system to the right..for more understanding: ColladaMatrix=GLRotMatrix*NeededMatrix Does someone know the matrix i need?

Original source

Related problems