From: harry.gaines@stpete.honeywell.com (Harry T. Gaines) Newsgroups: sci.math Subject: Re: Looking for general 3D rotation matrix... Date: 19 Apr 1995 22:09:09 GMT In article <3mrog7$hf7@lectura.CS.Arizona.EDU>, scott@CS.Arizona.EDU (Scott E Gilbert) says: > > > >I've been trying to solve this problem for about a week, and without much >success. What I need is a linear transformation that gives me a rotation >of some angle about an arbitrary vector in 3-space. (This problem has come >up in a graphics program I am workin on...) > Let a be an angle and x be a column 3-vector. Also let u be the unit column 3-vector u = x/norm(x). Then the rotation matrix you seek is R(a,x) = cos a I + (1 - cos a ) u u' + sin a {u} , where I denotes the identity matrix, the prime denotes transpose, and the braces in the last term denote the skew-symmetric matrix associated with the enclosed vector, [(0, u3, -u2),(-u3, 0, u1),(u2, -u1, 0)] . This is the "alias" version of a rotation matrix. Applied to the column vector of components of a vector in an orthogonal frame, it gives the column of the components of the same vector in the frame obtained from the first frame by the rotation. The "alibi" version that gives he components in the _same_ coordinate frame of the rotated vector is just the transpose. In the formula above, just change the sign of the last term. Notice that if u is (1, 0, 0)' or (0, 1, 0)' or (0, 0, 1)', then the formula simplifies to the corresponding canonical rotation matrix. Hope this helps. Harry