title: How do you calculate the reflex angle given two vectors in 3D space?
body: <p>I want to calculate the angle between two vectors a and b. Lets assume these are at the origin. This can be done with</p>
  
  <pre><code>theta = arccos(a . b / |a| * |b|)
  </code></pre>
  
  <p>However arccos gives you the angle in [0, pi], i.e. it will never give you an angle greater than 180 degrees, which is what I want. So how do you find out when the vectors have gone past the 180 degree mark? In 2D I would simply let the sign of the y-component on one of the vectors determine what quadrant the vector is in. But what is the easiest way to do it in 3D?</p>
  
  <p>EDIT: I wanted to keep the question general but here we go. I'm programming this in c and the code I use to get the angle is <code>theta = acos(dot(a, b)/mag(a)*mag(b))</code> so how would you programmatically determine the orientation?</p>