Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!mcgill-vision!snorkelwacker!usc!sdd.hp.com!decwrl!bacchus.pa.dec.com!shlump.nac.dec.com!ryn.esg.dec.com!allvax!jroth From: jroth@allvax.dec.com (Jim Roth) Newsgroups: comp.graphics Subject: Re: 4-Space Basis Rotation Matrices Summary: Skew matrices and generalized Euler angles Message-ID: <2494@ryn.esg.dec.com> Date: 11 Aug 90 01:45:37 GMT Sender: guest@ryn.esg.dec.com Organization: Digital Equipment Corporation Lines: 146 In article <1279@enuxha.eas.asu.edu>, hollasch@enuxha.eas.asu.edu (Steve Hollasch) writes... > > I'm writing a 4D wireframe-viewer and have run into the problem of >generating rotation matrices for the 4D viewpoint. What are the basis >rotation matrices in 4D? The 4-space viewpoint will be on the surface >of a hypersphere, and I want a set of basis rotations that can rotate >the point to any other point on the surface of that hypersphere. In >addition, the rotation needs to be parametric, since I'll be tying the >rotation angle to the cursor for a smooth rotation. Hence, I don't >want reflections or other improper rotations. > > I think that two rotation matrices are sufficient in 3-space; ^^^ Actually, 3 are necessary (think of Euler angles.) >consider spherical coordinates with a fixed radial length. If this is >true, I'd also like to know what the analogous 4-space rotation >matrices would be. > > So how do you find the set of 4-space rotation matrices? I can't >think of a way to rotate about the basis vectors in 4-space, since >traditional rotation matrices deal with rotations in a plane. One >suggested approach is to include each 3-space rotation matrix in a 4x4 >matric for each row/column pair replaced with the identity row/column, >e.g. ( S = sin(theta), C = cos(theta) ): > > +- -+ +- -+ +- -+ +- -+ > | 1 0 0 0 | | 1 0 0 0 | | 1 0 0 0 | | C 0 -S 0 | > | 0 C S 0 | | 0 C 0 -S | | 0 1 0 0 | | 0 1 0 0 | > | 0 -S C 0 | | 0 0 1 0 | | 0 0 C S | | S 0 C 0 | > | 0 0 0 1 | | 0 S 0 C | | 0 0 -S C | | 0 0 0 1 | > +- -+, +- -+, +- -+, +- -+, > > and so on, for a total of twelve matrices. ^^^^^^ Only 6 are necessary. > > Are these twelve matrices sufficient to parametrically rotate a 4D >viewpoint on the 4-sphere to any other viewpoint on the 4-sphere? Are >they all _necessary_ (like only needing two rotations in 3-space)? > The conceptual problem is that one cannot rotate "about" an axis; rather one can rotate "in a plane" or 2 dimensional subspace in n dimensions. More generally, an n dimensional orthogonal rotation can be expressed in terms of (n choose 2) parameters. In 3 space this happens to be 3 - a remarkable coincidence which allows us to think of axes of rotation and so on. One way to see this is that an n by n matrix has n^2 components; but we also require that the rows and colums be orthonormal, which cuts the degrees of freedom down to (n choose 2). The manifold of possible rotations can be thought of as an algebraic variety (hypersurface) in n^2 space. It is a Riemannian manifold, meaning roughly that one has the notion of distance, geodesics, and so forth. One way of decomposing your rotations is to have a set of (4 choose 2) or 6 plane rotation matrices, one for each possible pair of coordinate axes. (You do not need 12 matrices.) This is analogous to Euler angles in 3 space. Another is to "exponentiate" a general skew symmetric matrix. Choose a skew matrix with 6 free parameters and calculate the matrix series EXP(S) = I + S + S^2/2! + S^3/3! + ... where S is of the form | 0 p1 p2 p3 | | -p1 0 p4 p5 | | -p2 -p4 0 p6 | | -p3 -p5 -p6 0 | In 3 dimensions, such skew matrix has the 3 parameters representing a vector whose length is the angle of rotation in radians and whose direction is the axis of rotation. Try it, and you'll find that the resulting matrix is indeed a proper orthogonal rotation. In fact, you can go the other way and take the log of an orthogonal matrix and you'll wind up with a skew matrix giving the parameters for the rotation it represents. You can use the series O = I+X an orthogonal matrix as a sum of X and the identity S = LOG(I+X) = X - X^2/2 + X^3/3 - X^4/4 + ... An advantage of the exponential form is that you can parameterize it via O(t) = EXP(t*S) where S = a skew matrix and t is a parameter This lets you follow a geodesic arc on the group manifold. Note that S represents the tangent space to the manifold. If you wish to rotate by an angle in an arbitrary plane spanned by a pair of unit orthogonal vectors, say T and N, the matrix can be written t t t t I + (N N + T T ) (1-cos(t)) + (N T - T N ) sin(t) where you take the outer products of the unit vectors to make the matrices; the little "t" means transpose. It's worth remarking that there is a rational parameterization of rotations called the Cayley parameterization. One calculates S = (I-O)/(I+O) S = skew matrix, O = orthogonal matrix 1/(I+O) = matrix inverse The inverse is the same O = (I-S)/(I+S) In 3 space this can be used to parameterize rotations in terms of quaternions. Since the expression for O is homogenous, rewrite it as O = (q0*I - S)/(q0*I + S) | 0 q1 q2 | S = | -q1 0 q3 | | -q2 -q3 0 | Then the unit quaternion will be q0 = cos(theta/2), (q1,q2,q3) = sin(theta/2) * (unit vector along axis of rotation) There is a similar experssion in n-space, but without the nice geometric interpretation of axis of rotation that we have in 3-space. This is analogous to a conformal transformation in complex variables which maps the unit disc to the half plane; in n-space it involves stereographic projection of an n+1 sphere instead of the 2-sphere (Riemann sphere) of ordinary complex variables. Here's a little book that you may find interesting: "Matrix Groups" by M. Curtis, Springer Verlag Universitext 1984 Some of this subject matter is standard linear algebra. Strang's book is one of the best introductions for this. - Jim