njoubert / deviceorientationquaternions Goto Github PK
View Code? Open in Web Editor NEWThis is a small tech demo to convert HTML5 euler angles to quaternions, and calculate the rotational change from an initial device orientation to a current device orientation. The HTML5 deviceorientation API provides the current orientation of a mobile phone as a set of Euler Angles. It is difficult to compare two sets of Euler Angles to find the minimum rotation from one orientation to another, and suffers from Gimbal Lock. By converting deviceorientation Euler Angles into Quaternions, we enable simple and robust orientation comparison.