Path: chuka.playstation.co.uk!scea!peter_alau@playstation.sony.com From: jamin1@psu.edu (Jamin Frederick) Newsgroups: scee.yaroze.programming.3d_graphics Subject: Re: Vectors and Matrices Mini Tutorial Date: Thu, 09 Jul 1998 20:14:14 GMT Organization: SCEA News Server Lines: 69 Message-ID: <35a5230a.92033316@news.scea.sony.com> References: <35A25BBF.F272A126@scee.sony.co.uk> <35a2e6c8.59132342@news.scea.sony.com> <35A349BF.1C739D7D@scee.sony.co.uk> <35a42c22.89797019@news.scea.sony.com> <35A48348.930D42AF@scee.sony.co.uk> NNTP-Posting-Host: JAMINFRE.hq.ensco.com X-Newsreader: Forte Free Agent 1.11/32.235 On Thu, 09 Jul 1998 09:46:00 +0100, James Russell wrote: >Jamin Frederick wrote: >> >> But isn't rotation around Z supposed to be (assuming theta goes from X >> to Y): >> >> cos(t) -sin(t) 0 >> sin(t) cos(t) 0 >> 0 0 1 >> >> You still have: >> >> cos(t) sin(t) 0 >> -sin(t) cos(t) 0 >> 0 0 1 > >They are both correct! It all depends on which side you are multiplying your 3D vector from. >Call your matrix (the top one) A, and my matrix (the bottom one) B, and the vector we're multiplying >by C. > >Assuming C is a 3x1 vector (3 down, 1 across), then A*C will give you another 3x1 vector which is >the rotation about the Z axis. > >But assuming C is a 1x3 vector(3 across, 1 down), then C*B will give you another 1x3 which is ALSO >the rotation about the Z axis! Proof: a b c x ax + by + cz d e f * y = dx + ey + fz g h i z gx + hy + iz a d g x y z * b e h = ax + by + cz dx + ey + fz gx + hy + iz c f i > > >In the first version of my tutorial I accidentally mixed both cases, multiplying the vector on the >_right_ of the matrix while having matrices which were designed to be multiplied with the vector on >the _left_. Now all the matrices in my tutorial are designed to be multiplied by a vector on the >left, which is the most common way I've seen in graphics books. > >If you have a matrix which was designed to be multiplied from the right and you want to turn it into >a matrix which can be multiplied from the left (or vice versa), then all you have to do is 'flip' >the matrix about the diagonal line running from top left to bottom right (Pedant note: this only >works for some matrices, but will work for the standard rotation, scaling and translation matrices >we know and love). By the proof, it looks like it should work for any arbitrary matrix. Jamin >And we can see that matrix A is just matrix B 'flipped', and vice versa. > >Cheers, > >James > >-- >== James_Russell@scee.sony.co.uk +44 (171) 447-1626 >== Developer Support Engineer - Sony Computer Entertainment Europe > >A diagnostic is someone who doesn't know if there are two Gods.