W3C home > Mailing lists > Public > public-geolocation@w3.org > March 2011

Euler angles, an optimal solution ?

From: João Eiras <joao.eiras@gmail.com>
Date: Mon, 14 Mar 2011 15:51:56 +0000
Message-ID: <AANLkTikLJOB2aduEvGZkOsGjSrC9Z7GzNuyZ0dh1=eFr@mail.gmail.com>
To: Geolocation API WG <public-geolocation@w3.org>
Hi!

The device orientation spec
http://dev.w3.org/geo/api/spec-source-orientation.html uses Euler
angles.

But is this an optimal solution ? While it seems trivial to
understand, manipulating angles is quite cumbersome, because before
being used, angles need to be converted into a transformation matrix
using something not trivial
http://en.wikipedia.org/wiki/Rotation_matrix#General_rotations
Context switching between all those arithemetic and trigonometric
operations, and machine code can hinder performance quite
significantly, given that a orientationchange event can be dispatched
a couple hundred times a second.

So, I would suggest one of the following:
 - provide a transformation matrix together with the 3 angles
 - provide an API to convert the 3 angles into a transformation matrix

Device orientation can too be represented using two vectors, v and n,
being v, parallel to the surface, say, pointing in the direction of
the y axis, and n perpendicular to the surface. n would give the
surface tilt and v the rotation along its z axis. So, the
transformation matrix could be multiplied against (0,1,0) or (0,0,1)
to get one of these two vectors, or used directly in any of the other
operations.

Thank you for your time.
Received on Monday, 14 March 2011 15:53:10 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:51:02 UTC