home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / graphics / 9011 < prev    next >
Encoding:
Internet Message Format  |  1992-08-20  |  2.0 KB

  1. Path: sparky!uunet!olivea!hal.com!decwrl!concert!borg!debussy!taylorr
  2. From: taylorr@debussy.cs.unc.edu (Russell Taylor)
  3. Newsgroups: comp.graphics
  4. Subject: Re: Shoemake quaternion typos
  5. Message-ID: <14608@borg.cs.unc.edu>
  6. Date: 20 Aug 92 11:54:41 GMT
  7. References: <rd#n39#.spworley@netcom.com>
  8. Sender: news@cs.unc.edu
  9. Organization: The University of North Carolina at Chapel Hill
  10. Lines: 39
  11.  
  12. In article <rd#n39#.spworley@netcom.com> spworley@netcom.com (Steven) writes:
  13. >Anyone know about any typos in this (key) document?
  14. >
  15.     We found what I wouldn't call a typo, but is sometimes a problem to us:
  16. When doing a slerp, the code sometimes takes the "long way" around.  In other
  17. words, when interpolating between two orientations there is an ambiguity
  18. about "which way around the Earth" to travel, and the code does not resolve
  19. this ambiguity purposefully.
  20.     In particular, I think the long way is taken if the dot product of
  21. the two vectors you are interpolating between is negative but they lie in
  22. the same hemisphere.  Our solution is to dot the two and then negate one of
  23. the vectors (leaving the specified orientation the same).  The code to do this
  24. is inserted right after the cosOmega computation, and follows:
  25.  
  26. /* If the above dot product is negative, it would be better to
  27.  *  go between the negative of the initial and the final, so that
  28.  *  we take the shorter path.
  29.  */
  30. if ( cosOmega < 0.0 )
  31.     {
  32.     cosOmega *= -1;
  33.     for (i = X; i <= W; i++)
  34.             startQ[i] *= -1;
  35.     }
  36.  
  37.     Looking back, I don't see that this code will do any good if the
  38. two vectors are not in the same hemispheres, but we have not done interpolation
  39. between disparate vectors so it has not yet bitten us.
  40.  
  41.     As I recall, the code in the paper was presented as an example of how
  42. some things could be done, not as the end-all-be-all quaternion library, so
  43. the above comments are not a complaint and indeed we have found the code to
  44. be incredibly useful.
  45.  
  46.     Russell Taylor
  47.  
  48. -- 
  49. He who follows a path perpetuates that path.
  50. Practice random kindness and sensless acts of beauty.
  51.