w3c / orientation-sensor

Orientation Sensor
https://www.w3.org/TR/orientation-sensor/
Other
12 stars 21 forks source link

Should OrientationSensor interface provide Euler angles? #43

Open alexshalamov opened 7 years ago

alexshalamov commented 7 years ago

All modern 3D JavaScript frameworks support quaternions and rotation matrices to represent rotation, however, sometimes, it might be useful to have Euler angles representation, so that web developers would not need to do manual conversion.

interface OrientationSensor : Sensor {
  readonly attribute FrozenArray<double>? quaternion;
  readonly attribute double? yaw;
  readonly attribute double? pitch;
  readonly attribute double? roll;
  void populateMatrix(RotationMatrixType targetMatrix);
};
anssiko commented 7 years ago

Sounds good. My assumption is we want to facilitate migration of legacy web content to this new API, and as such should align this feature with the Device Orientation API on details such as:

It should be noted the Device Orientation API states:

the angles [alpha, beta and gamma] do not match the roll-pitch-yaw convention used in vehicle dynamics

@alexshalamov can you clarify whether this would be an issue. Also fix any false assumption I may have made.

The conventions checklist is borrowed from the practical definition of Euler angles conventions from an aerospace engineer. The Device Orientation API spec references Euler angles wikipedia entry, but I found it lacking in terms of conventions.

anssiko commented 6 years ago

Marked as "Level 2" per WG call decision.