Android: understanding the function remapCoordinateSystem


I have been trying to understand these 2 lines of code

SensorManager.getRotationMatrix(RTmp, I, grav, mag); 
SensorManager.remapCoordinateSystem(RTmp, SensorManager.AXIS_X,SensorManager.AXIS_MINUS_Z, Rot);

I read the documentation of remapCoordinateSystem(), however I am lost.

Can anyone explain to me what exactly getRotationMatrix and remapCoordinateSystem do? Specially the SensorManager.AXIS_X, SensorManager.AXIS_MINUS_Z?

Best Solution

I believe getRotationMatrix() returns a rotation matrix that converts device coordinate to world coordinate, as mentioned in android documentation, not "world" to "device".

Computes the inclination matrix I as well as the rotation matrix R transforming a vector from the device coordinate system to the world's coordinate system which is defined as a direct orthonormal basis, where