David Callanan
David Callanan

Reputation: 5968

devicemotion api device coordinate frame

The DeviceMotionEvent API appears to provide acceleration data with reference to the world's coordinate frame.

x - Represents the acceleration upon the x axis which is the west to east axis

y - Represents the acceleration upon the y axis which is the south to north axis

z - Represents the acceleration upon the z axis which is the down to up axis

However, I would like to use this data with reference to the device's coordinate frame.

Does this API offer this format?

Otherwise, is it possible to transform this data by obtaining the orientation from the DeviceOrientationEvent (which may not provide "absolute" data)?

absolute - A boolean that indicates whether or not the device is providing orientation data absolutely (that is, in reference to the Earth's coordinate frame) or using some arbitrary frame determined by the device.

If so, what mathematical formula would I have to use? It looks like I'd have to rotate the vector (x, y, z) by the device orientation angles, but I have no idea how to do this.

Upvotes: 1

Views: 116

Answers (0)

Related Questions