home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!dtix!darwin.sura.net!mips!sdd.hp.com!uakari.primate.wisc.edu!ames!purdue!bouma
- From: bouma@cs.purdue.EDU (William J. Bouma)
- Newsgroups: comp.graphics
- Subject: Re: Quaternion questions
- Message-ID: <19255@ector.cs.purdue.edu>
- Date: 14 Aug 92 00:25:50 GMT
- References: <1992Aug13.201513.9123@meteor.wisc.edu>
- Sender: news@cs.purdue.EDU
- Organization: Department of Computer Science, Purdue University
- Lines: 43
-
-
- In article <1992Aug13.201513.9123@meteor.wisc.edu>, brianp@meteor.wisc.edu (Brian Paul) writes:
-
- |> 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
-
- I am not sure what you mean here. What is "i axis"? When I use
- quaternions q[0] always has cos(X/2) in it. Where X is my rotation
- angle.
-
- |> 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;
-
- Yes!
-
- |> 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);
-
- Scaling a quaternion is pretty meaningless. It should always remain unit
- length.
-
- This (rb->omega * rb->q) is not a quaternion multiplication. omega (w)
- must be the angular velocity of your object. The * operation here must
- form the matrix
- [ 0.0 -w[0] -w[1] -w[2]]
- [w[0] 0.0 -w[2] w[1]]
- [w[1] w[2] 0.0 -w[0]]
- [w[2] -w[1] w[0] 0.0 ]
-
- and then do a normal matrix multiplication on the left with q.
-
- You don't have to normalize each time if you are using double precision,
- since the normalization is a bit costly.
- --
- Bill <bouma@cs.purdue.edu>
-