Strange results with the QuaternionSlerp function

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Strange results with the QuaternionSlerp function

      I was going through chapter 14 and tried the various 3D math stuff and had a prblem with the selrp function.

      Here is what I'm using:
      Rotation: Y Axis
      Start: 0 rads
      Last: pi/2 rads, and pi rads
      Percent: 0.5
      Vertex: 1,0,0

      Results with 90 degrees is a CW rotation (if looking down on Y) to approx. (.7, 0, -.7)

      Results with 180 degrees is a CCW rotation to (0,0,1)

      Results with -180 = (0,0,-1): what I was expecting from 180

      Am I missing something?
    • RE: Strange results with the QuaternionSlerp function

      I'm not entirely sure I understand your problem - is it the direction of rotation that you didn't expect, or was it the final rotation that was unexpected?

      It might help for you to grab some annotated screenshots so we could see what's going on...3D issues are rarely made clear by writing them down!
      Mr.Mike
      Author, Programmer, Brewer, Patriot
    • Ah I see - Quaternion Spherical Interpolation (SLERP) isn't defined for exactly 180 degree rotations - so very small differences in precision will result in different behaviors.

      If you want to rotate something 180 degrees, I'd break it up into two parts so you define the path you want things to take.
      Mr.Mike
      Author, Programmer, Brewer, Patriot