Android: understanding remapCoordinateSystem function

I tried 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 documentationremapCoordinateSystem() , however I got lost.

Can someone explain to me what exactly they are doing getRotationMatrixand remapCoordinateSystem? Specifically SensorManager.AXIS_X, SensorManager.AXIS_MINUS_Z?

+3
source share
3 answers

I believe that it getRotationMatrix()returns a rotation matrix that converts the coordinate of the device into the coordinate of the world , as indicated in the Android documentation, and not β€œworld” to β€œdevice”.

I, R , ,

+3

, getRotationMatrix() @Noname. remapCoordinateSystem() SensorManager.AXIS_X, SensorManager.AXIS_MINUS_Z.

remapCoordinateSystem() , X, Y, Z-AXIS, SensorManager.AXIS_X, SensorManager.AXIS_MINUS_Z - . , . Y SensorManager.AXIS_MINUS_Z FYI. , :

SensorManager.remapCoordinateSystem(RTmp, SensorManager.AXIS_Y, SensorManager.AXIS_MINUS_X, Rot);

, .

+1

, , . (: 4 ):

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

:

I would say that you are on the right track using the documentation. As you can see, getRotationMatrix pulls out the current rotation matrix needed to convert the world coordinate system to the current coordinate system of the device. Additionally, the remapcoordinateSystem converts this coordinate system to a given rotation matrix. But, as stated above, from the context it is difficult to say why you are doing this.

0
source

Source: https://habr.com/ru/post/1795226/


All Articles