title: Converting quaternions to Euler angles. Problems with the range of Y angle
body: <p>I'm trying to write a 3d simulation in C++ using Irrlicht as graphic engine and ODE for physics. Then I'm using a function to convert ODE quaternions to Irrlicht Euler angles. In order to do this, I'm using this code. </p>
  
  <pre><code>void QuaternionToEuler(const dQuaternion quaternion, vector3df &amp;euler)
  {
      dReal w,x,y,z;
  
      w = quaternion[0];
      x = quaternion[1];
      y = quaternion[2];
      z = quaternion[3];
  
      double sqw = w*w;    
      double sqx = x*x;    
      double sqy = y*y;    
      double sqz = z*z; 
  
      euler.Z = (irr::f32) (atan2(2.0 * (x*y + z*w),(sqx - sqy - sqz + sqw)) * (180.0f/irr::core::PI));
      euler.X = (irr::f32) (atan2(2.0 * (y*z + x*w),(-sqx - sqy + sqz + sqw)) * (180.0f/irr::core::PI));          
      euler.Y = (irr::f32) (asin(-2.0 * (x*z - y*w)) * (180.0f/irr::core::PI));
  
  }
  </code></pre>
  
  <p>It works fine for drawing in the correct position and rotation but the problems come with the <code>asin</code> instruction. It only return values in the range of <code>0..90</code> - <code>0..-90</code> and I need to get a range from <code>0..360</code> degrees. At least I need to get a rotation in the range of <code>0..360</code> when I call <code>node-&gt;getRotation().Y</code>.</p>