This PR builds upon w3c/deviceorientation#124 by augmenting the "parse orientation data reading" algorithm and making it also support quaternions in addition to Euler angles.
From the third and biggest commit:
Both the Device Orientation API and the Orientation Sensor specifications
provide orientation data. Among other differences, the former provides the
data as a set of intrinsic Tait-Bryant Euler angles, whereas the latter uses
quaternions.
From an automation perspective, though, it makes sense to use the same
virtual sensor types for both APIs and take care of the conversions
internally.
The Device Orientation spec's Automation section defines steps for parsing a
user-provided reading as alpha, beta, gamma numbers that adhere to the
requirements laid out by the same spec. This commit augments the same "parse
orientation data reading" algorithm by also setting a "quaternion" entry in
the reading map that is derived from the user-provider Euler angles.
The Euler angles to quaternion algorithm has been copied from Chromium.
This PR builds upon w3c/deviceorientation#124 by augmenting the "parse orientation data reading" algorithm and making it also support quaternions in addition to Euler angles.
From the third and biggest commit:
Both the Device Orientation API and the Orientation Sensor specifications provide orientation data. Among other differences, the former provides the data as a set of intrinsic Tait-Bryant Euler angles, whereas the latter uses quaternions.
From an automation perspective, though, it makes sense to use the same virtual sensor types for both APIs and take care of the conversions internally.
The Device Orientation spec's Automation section defines steps for parsing a user-provided reading as alpha, beta, gamma numbers that adhere to the requirements laid out by the same spec. This commit augments the same "parse orientation data reading" algorithm by also setting a "quaternion" entry in the reading map that is derived from the user-provider Euler angles.
The Euler angles to quaternion algorithm has been copied from Chromium.
Preview | Diff