Device Orientation: alternate representations and handling screen orientation changes

I published an article a couple of days ago covering advanced
manipulation of deviceorientation data and thought it may be of
general interest to this group:

'Practical application and usage of the W3C Device Orientation API':
http://dev.opera.com/articles/view/w3c-device-orientation-usage/

The article above covers three main points:

- Euler angles are good for _describing_ orientations in Euclidean
space but are actually poor for practical usage since they suffer from
gimbal lock at their poles and are hard to 'remap' as screen
orientation changes since they don't share the same ranges.
- Web developers can convert Tait-Bryan angles provided from
deviceorientation events in to more practical device orientation
representations such as Rotation Matrices and/or Quaternions and we
describe how that can be done.
- We need to account for screen orientation changes in any device
orientation representation we care to use to ensure our coordinate
frame always reflects the way a user is currently holding their
device.
- We can orient matrices and quaternions we've calculated herein to
match any required 'world' coordinate frame (e.g. how to make a
heads-up display for virtual reality and/or augmented reality use
cases) which is difficult to do with Tait-Bryan angles (because the
ranges don't re-wire themselves easily).

A virtual reality viewer demo based on the information provided in the
article is available @
http://people.opera.com/richt/release/demos/orientation/virtualreality/.

We are working to bring some of these concepts and examples to the W3C
Device Orientation Events API spec by adding additional worked
examples concerning the topics discussed in this article (and
summarised above). That work is currently happening over on the W3C
DeviceOrientation Github repo @
https://github.com/w3c/deviceorientation and additional participation
and feedback there would be welcome.

In this group it would be good to discuss whether UA implementations
could start handling screen orientation changes implicitly, how we may
be able to do that without breaking backward compatibility and whether
we want to consider inherently providing other alternate device
orientation representations such as Quaternions which may be better
suited to 3D web use cases.

Looking forward to hearing how others want to see this spec and API
evolve. We will have more spec changes to discuss soon based on work
happening @ https://github.com/w3c/deviceorientation.

- Rich

Received on Friday, 28 March 2014 18:02:39 UTC