Path: chuka.playstation.co.uk!news From: Peter Passmore Newsgroups: scee.yaroze.programming.3d_graphics Subject: Re: RotMatrixBUG???? Date: Thu, 09 Jul 1998 08:20:01 +0100 Organization: PlayStation Net Yaroze (SCEE) Lines: 45 Message-ID: <35A46F21.2A41@mdx.ac.uk> References: <01bda686$31300120$4fa1f7c2@manolo> <359D8B5E.54DE@mdx.ac.uk> <35a427fd.88736196@news.scea.sony.com> NNTP-Posting-Host: staff-dialup1.mdx.ac.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 3.04 (Win95; I) >I'm still a little confused. Why do all the matrix multiplication >correcting with the "incremental" approach (what Peter was talking >about) when you can just store the current rotation vector (where >(a,b,c) represents the model a, b,and c degrees from its local x, y, >and z axes respectively thus far) and make a "consummate" matrix from >the (a,b,c) vector and RotMatrix, which gets put in the >GsCOORDINATE2.coord matrix -- resulting in the proper orientation of >the model (since the model is in the original orientation if the coord >matrix is the identity matrix, and changing the coord matrix into a >different matrix effectively changes its orientation)? The problem if you rotate around more than one axis is that _order counts_ eg: if you rotated around each axis in this order: rotateX(90) rotateY(90) rotateZ(90), you end up at adifferent orientation than if you did: rotateZ(90), rotateY(90), rotateX(90) - which is the point that James is addressing. Just storing the vector does not store the order and depending on your sequence of rotations you can end up with the situation that Emmanele describes as his first problem, the object does not rotate around it's own axes. If you keep on concatenating the new rotations into the the object's matrix the order is automatically encoded in the matrix - which solves the problem but leads to the matrix distortion previously discussed. >Now what do I have to do if I have a button for each rotation >direction, positive and negative around each axis, and i want to >rotate the object arbitrarily without using the "incremental" method? >Apparently I can't just increment/decrement the numbers in the (a,b,c) >vector when I push the corresponding buttons. Is it a problem to just rotate by small amounts each press? > Sorry if I'm >asking the same questions! Questions are not a problem, it's answers. BTW there is a nice tutorial about quaternions at http://gamasutra.com. (Quaternions are what you get into when you discover matrices have too many problems.) In passing the article mentions that a standard technique for sorting out distorted matrices called the Gram-Schmidt algorithm, which may be what the Japanese method is based on. Peter