To apply the maze style, you probably care more about the acceleration (gravity) vector than the axial orientation. This vector in the phoneโs coordinate system is defined by a combination of three dimensions of accelerometers, rather than rotation angles. In particular, only the readings x and y should influence the movement of the ball.
If you really need orientation, then 3 angular readings represent 3 Euler angles. However, I suspect that you probably do not need the corners themselves, but rather the R rotation matrix, which is returned by the getRotationMatrix () API. When you have this matrix, then - This is basically the calibration you are looking for. If you want to convert a vector into world coordinates into the coordinates of your device, you must multiply it by the inverse of this matrix (where in this special case inv ( R ) = transpose ( R ).
So, following the example I found in the documentation, if you want to convert the global gravity vector g ([0 0 g]) to the coordinates of the device, multiply it by inv ( R ),
g = inv ( R ) * g
(note that this should give you the same result as reading accelerometers)
Possible APIs to use here are the invertM () and multiplyMV () methods for the matrix class.
source share