Skip to content

Commit

Permalink
Drop "-euler" from virtual sensor types
Browse files Browse the repository at this point in the history
As discussed in
https://github.com/w3c/deviceorientation/pull/124/files/738168e2d57e24e5094517700ab7d2b08ca2bfe4#r1414556615
we should use the same virtual sensor types for the device orientation part
of this spec as well as the Orientation Sensor spec, just like the same
virtual sensor types are used for device motion and the Generic Sensor
API-based specs like Accelerometer and Gyroscope.

Compared to device motion, however, we have an additional problem in that
device orientation data is provided in Euler angles and Orientation Sensor
uses quaternions.

The idea is to parse readings by reading alpha/beta/gamma keys from the
WebDriver extension command and use them in the "fire orientation event"
algorithm and skip using quaternions altogether. The Orientation Sensor spec
can then augment the "parse orientation data reading" algorithm with the
required steps to both 1) accept a "quaternion" key in the WebDriver
extension command (and convert it to Euler angles as well) and 2) derive a
quaternion from the alpha/beta/gamma Euler angles.
  • Loading branch information
rakuco committed Dec 5, 2023
1 parent 8bbd52b commit 9d91bcc
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ Therefore, instead of requiring implementations (and automation users) to provid
<h4 id="parse-orientation-data-reading-algorithm">Parse orientation data reading algorithm</h4>

<div algorithm>
To perform the <dfn>parse orientation data reading</dfn> algorithm, given a JSON {{Object}} <var>parameters</var>:
To perform the <dfn export>parse orientation data reading</dfn> algorithm, given a JSON {{Object}} <var>parameters</var>:

1. Let <var>alpha</var> be the result of invoking <a>get a property</a> from <var>parameters</var> with "<code>alpha</code>".
1. If <var>alpha</var> is not a {{Number}}, or its value is <strong>NaN</strong>, +∞, or −∞, return <strong>undefined</strong>.
Expand All @@ -692,21 +692,21 @@ Note: <var>reading</var> is defined as a <a>map</a> in the algorithm above to pr

</div>

<h4 id="absolute-orientation-euler">The "absolute-orientation-euler" virtual sensor type</h4>
<h4 id="absolute-orientation-virtuals-sensor">The "absolute-orientation" virtual sensor type</h4>

The <a>per-type virtual sensor metadata</a> <a>map</a> must have the following <a for=map>entry</a>:
:
: <a for=map>key</a>
:: "<code>absolute-orientation-euler</code>"
:: "<code><dfn export data-lt="absolute-orientation virtual sensor type">absolute-orientation</dfn></code>"
: <a for=map>value</a>
:: A <a>virtual sensor metadata</a> whose <a>reading parsing algorithm</a> is <a>parse orientation data reading</a>.

<h4 id="relative-orientation-euler">The "relative-orientation-euler" virtual sensor type</h4>
<h4 id="relative-orientation-virtual-sensor">The "relative-orientation" virtual sensor type</h4>

The <a>per-type virtual sensor metadata</a> <a>map</a> must have the following <a for=map>entry</a>:
:
: <a for=map>key</a>
:: "<code>relative-orientation-euler</code>"
:: "<code><dfn export data-lt="relative-orientation virtual sensor type">relative-orientation</dfn></code>"
: <a for=map>value</a>
:: A <a>virtual sensor metadata</a> whose <a>reading parsing algorithm</a> is <a>parse orientation data reading</a>.

Expand Down

0 comments on commit 9d91bcc

Please sign in to comment.