Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>As others have already pointed out, your question should be revised. Let's call your vectors <code>a</code> and <code>b</code>. I assume that <code>length(a)==length(b) &gt; 0</code> otherwise I cannot answer the question.</p> <hr> <p>Calculate the <a href="http://en.wikipedia.org/wiki/Cross_product#Coordinate_notation" rel="nofollow noreferrer">cross product</a> of your vectors <code>v = a x b</code>; <code>v</code> gives the <strong>axis</strong> of rotation. By computing the <a href="http://en.wikipedia.org/wiki/Dot_product#Algebraic_definition" rel="nofollow noreferrer">dot product</a>, you can get the cosine of the <strong>angle</strong> you should rotate with <code>cos(angle)=dot(a,b)/(length(a)length(b))</code>, and with <code>acos</code> you can uniquely determine the angle (@Archie thanks for pointing out my earlier mistake). At this point you have the <strong>axis angle representation</strong> of your rotation.</p> <p>The remaining work is to convert this representation to the representation you are looking for: Euler angles. <a href="http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToEuler/index.htm" rel="nofollow noreferrer">Conversion Axis-Angle to Euler</a> is a way to do it, as you have found it. You have to handle the degenerate case when <code>v = [ 0, 0, 0]</code>, that is, when the angle is either 0 or 180 degrees.</p> <hr> <p>I personally don't like Euler angles, they screw up the stability of your app and they are not appropriate for interpolation, see also</p> <ul> <li><p><a href="https://stackoverflow.com/q/5577334/341970">Strange behavior with android orientation sensor</a></p></li> <li><p><a href="https://stackoverflow.com/q/5580283/341970">Interpolating between rotation matrices</a></p></li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload