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

  1. Path: sparky!uunet!dtix!darwin.sura.net!mips!sdd.hp.com!uakari.primate.wisc.edu!ames!purdue!bouma
  2. From: bouma@cs.purdue.EDU (William J. Bouma)
  3. Newsgroups: comp.graphics
  4. Subject: Re: Quaternion questions
  5. Message-ID: <19255@ector.cs.purdue.edu>
  6. Date: 14 Aug 92 00:25:50 GMT
  7. References: <1992Aug13.201513.9123@meteor.wisc.edu>
  8. Sender: news@cs.purdue.EDU
  9. Organization: Department of Computer Science, Purdue University
  10. Lines: 43
  11.  
  12.  
  13. In article <1992Aug13.201513.9123@meteor.wisc.edu>, brianp@meteor.wisc.edu (Brian Paul) writes:
  14.  
  15. |> Suppose I implement quaternions as a 4-element vector q[4] where:
  16. |>    q[0] = i axis
  17. |>    q[1] = j axis
  18. |>    q[2] = k axis
  19. |>    q[3] = rotation value
  20.  
  21. I am not sure what you mean here.  What is "i axis"?  When I use 
  22. quaternions q[0] always has cos(X/2) in it.  Where X is my rotation
  23. angle.
  24.  
  25. |> Is this the correct way to normalize a quaternion to unit length?
  26. |>    double mag = sqrt( q[0]*q[0] + q[1]*q[1] + q[2]*q[2] + q[3]*q[3] );
  27. |>    q[0] /= mag;
  28. |>    q[1] /= mag;
  29. |>    q[2] /= mag;
  30. |>    q[3] /= mag;
  31.  
  32. Yes!
  33.  
  34. |> How does one scale a quaternion?  In Baraff's notes on the bottom of
  35. |> page H23 there is the C++ expression:
  36. |>    quaternion qdot = .5 * (rb->omega * rb->q);
  37.  
  38. Scaling a quaternion is pretty meaningless.  It should always remain unit
  39. length.
  40.  
  41. This (rb->omega * rb->q) is not a quaternion multiplication.  omega (w)
  42. must be the angular velocity of your object.  The * operation here must
  43. form the matrix
  44.                  [ 0.0 -w[0] -w[1] -w[2]]
  45.                  [w[0]  0.0  -w[2]  w[1]]
  46.                  [w[1]  w[2]  0.0  -w[0]]
  47.                  [w[2] -w[1]  w[0]  0.0 ]
  48.  
  49. and then do a normal matrix multiplication on the left with q.
  50.  
  51. You don't have to normalize each time if you are using double precision,
  52. since the normalization is a bit costly.
  53. -- 
  54. Bill <bouma@cs.purdue.edu> 
  55.