Android SensorManager.getOrientation() returns pitch between -PI/2 and PI/2

前端 未结 1 1194
孤城傲影
孤城傲影 2021-01-16 07:16

I am designing an app that needs to check the device\'s orientation (Azimuth, Pitch and Roll). I use the following code to achieve this:



        
相关标签:
1条回答
  • 2021-01-16 08:06

    Pitch is calculated as pitch = (float) Math.asin(-RMatrix[7]); The range of the arcsin function is [-PI/2, PI/2], so asin can only take value in between -PI/2 and PI/2.

    0 讨论(0)
提交回复
热议问题