Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save codesburner/903238 to your computer and use it in GitHub Desktop.

Select an option

Save codesburner/903238 to your computer and use it in GitHub Desktop.
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