Orientation and Scale of Acceleration
The device’s acceleration is measured in Gs. 1G is the force due to the earth’s gravity. (When the device is still, the accelerometer doesn’t know if it is moving at a constant velocity in the earth’s gravity well or if it is far out in space and accelerating upwards at 9.8 meters per second every second.)
While the application is running, hold the device vertically in front of your face as if you were using it. Check the console: the y-component of the acceleration is approximately -1, and the x- and z-components are approximately 0. If you lay the device on its back, the z-component of the acceleration is approximately -1, and the others are approximately 0. If you balance the device on the edge with the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access