title: Quaternion rotation without Euler angles
body: <p>In <a href="https://stackoverflow.com/questions/12206908/#comment16350007_12206908">this comment</a> it was strongly suggested that we should never use Euler angles. I understand that there are some limitation to Euler angles, most notably gimbal lock, but I'd like to know the best technique, or the set of techniques, that one typically uses in the absence of Euler angles?</p>
  
  <p>Most dicussions on this topic involve converting from an Euler angle to a quaternion and that is a simple thing to do. But the only way I have ever read about doing rotation without Euler angles at all is to create a quaternion from two vectors as described by the article "The Shortest Arc Quaternion" by Stan Melax in "Game Programming Gems", using this technique:</p>
  
  <pre><code>template &lt;typename T&gt;
  inline QuaternionT&lt;T&gt; QuaternionT&lt;T&gt;::CreateFromVectors(const Vector3&lt;T&gt;&amp; v0, const Vector3&lt;T&gt;&amp; v1)
  {
  
      Vector3&lt;T&gt; c = v0.Cross(v1);
      T d = v0.Dot(v1);
      T s = std::sqrt((1 + d) * 2);
  
      QuaternionT&lt;T&gt; q;
      q.x = c.x / s;
      q.y = c.y / s;
      q.z = c.z / s;
      q.w = s / 2.0f;
      return q;
  }
  </code></pre>
  
  <p>Is this the method referred to in the linked comment?</p>