home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!olivea!news.bbn.com!usc!sdd.hp.com!uakari.primate.wisc.edu!zazen!daffy!uwvax!meteor!brianp
- From: brianp@meteor.wisc.edu (Brian Paul)
- Newsgroups: comp.graphics
- Subject: Quaternion questions
- Message-ID: <1992Aug13.201513.9123@meteor.wisc.edu>
- Date: 13 Aug 92 20:15:13 GMT
- Organization: University of Wisconsin, Meteorology and Space Science
- Lines: 45
-
-
- I'm trying to implement a rigid body simulation with the notes from
- my SIGGRAPH '92 course "An Introduction to Physically Based Modeling".
- I am using quaternions to represent object orientations and have a few
- questions:
-
- Suppose I implement quaternions as a 4-element vector q[4] where:
- q[0] = i axis
- q[1] = j axis
- q[2] = k axis
- q[3] = rotation value
-
- Is this the correct way to normalize a quaternion to unit length?
- double mag = sqrt( q[0]*q[0] + q[1]*q[1] + q[2]*q[2] + q[3]*q[3] );
- q[0] /= mag;
- q[1] /= mag;
- q[2] /= mag;
- q[3] /= mag;
-
-
- How does one scale a quaternion? In Baraff's notes on the bottom of
- page H23 there is the C++ expression:
- quaternion qdot = .5 * (rb->omega * rb->q);
-
- where rb->omega and rb->q are quaternions. If p is the product of
- the two quaternions then is .5 * p correctly computed by:
-
- p[0] *= 0.5;
- p[1] *= 0.5;
- p[2] *= 0.5;
- p[3] *= 0.5;
-
- But if p was of unit length before, it won't be after this operation.
- Therefore, won't the quaternion deviate from being a pure rotation since
- it no longer has unit length?
-
- The reason I have these questions is that I'm seeing some "drift" rotation
- when doing a "pure" Y-axis rotation. I've tried re-normalizing the
- quaternions at various stages and tried variations on the quaternion
- scale method without success. I have the Shoemake articles referenced by
- Baraff but I haven't found answers there either.
-
- Thanks
-
- -Brian Paul
-