   Keyframed quaternion rotations going over 180 degrees
  Okay, I've just implemented an keyframed animation thing, but I've hit upon a potential future problem.I'm using quaternions for rotation currently and I've had my first experience with Slerp, but I wasn't aware of the limitation of not being able to slerp a rotation 360 degrees or more, and the additional limitation of not being able to rotate more than 180 degrees (Although it's possible to invert a quaternion in slerp to make it rotate in the other direction, how do I work out if I need to do this or not from 2 quaternions?)This poses a problem as I'm sure someone might animate something rotating 360 degrees on any axis in 3DS-MAX, export it to my file format, then find out it's not rotating, or not rotating the way that was expected.I'm sure people have come up against this problem before, how have you dealt with it? While it would be possible to attempt to identify possible problems like this during the MAX export and insert keyframes, but that feels like a half-assed solution and it wouldn't help with trying to do procudural animations in code, so I'd like to leave this as a last resort if possible.   
  you could do two seperate quat or you could do one.  the thing is, people usually code in a dot product check in there sperp routines.  this is to always force a rotation to go "the short way" that is, 180 degrees or less.  from slerping between two orientations p1 and p2.  there are two ways to do it  slerp(p1, p2) or slerp(-p1, p2).  one goes the short way and another the long way.  remember slerp goes between two points on the geocentric of a  4d-sphere  so there are two different ways to do this, think of a circle and two points on a circle.  the thing is, most quaternion slerp code slerp(p1,p2) and slerp(-p1,p2) are actually the same rotation. that is, they both go the short way.  you'd have to code it special to go the long way, or perhaps provide a flag to the funcion.  most of the time, you want the short way.Tim   ;  You might take a look at Dave Eberly's quaternion code here, in particular the function SlerpExtraSpins().   ;  Typically, you sample tightly enough that you get at least three samples per rotation. That way, you can always slerp the shortest way, and still get what you want. In reality, artists can't author multi-rotation slerps in animation packages anyway, so the data you have to work with will never need to express > 180 degree slerps.To slerp the shortest way, dot product the two 4-vectors with each other, and if the result is negative, negate all the values of one of them.   