Rotation ParameterizationsΒΆ

Simple example of how to convert a rotation matrix into equivalent formats.

ExampleRotationParameterizations.java

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
   public static void main(String[] args) {

       // Euler to rotation matrix
       DMatrixRMaj R = ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ,0.5,-1,-0.45,null);

       // matrix to Rodrigues
       Rodrigues_F64 rod = ConvertRotation3D_F64.matrixToRodrigues(R,(Rodrigues_F64)null);

       // Rodrigues to Quaternion
       Quaternion_F64 quat = ConvertRotation3D_F64.rodriguesToQuaternion(rod,null);

       // Quaternion to Rotation Matrix
       DMatrixRMaj T = ConvertRotation3D_F64.quaternionToMatrix(quat,null);

       // see if you get the same answer
       R.print();
       T.print();
   }