Forked from mstefanko/Get tilt from accelerometer values
Created
April 5, 2011 08:21
-
-
Save codesburner/903238 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| double accX = -x/SensorManager.GRAVITY_EARTH; | |
| double accY = -y/SensorManager.GRAVITY_EARTH; | |
| double accZ = z/SensorManager.GRAVITY_EARTH; | |
| double totAcc = Math.sqrt((accX*accX)+(accY*accY)+(accZ*accZ)); | |
| double tiltX = Math.asin(accX/totAcc); | |
| double tiltY = Math.asin(accY/totAcc); | |
| double tiltZ = Math.asin(accZ/totAcc); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment