Path: chuka.playstation.co.uk!news From: sceetech Newsgroups: scee.yaroze.programming.libraries Subject: Re: Rotation Matrix Functions : The Solution? Date: Thu, 10 Apr 1997 09:19:38 +0100 Organization: SCEE Lines: 40 Message-ID: <334CA29A.539A@interactive.sony.com> References: <01bc4074$bd79ee80$d603e8c3@fred> <334A0C83.5959@micronetics.com> <3348D96D.289@interactive.sony.com> <334b2016.21064909@news.playstation.co.uk> <01bc4448$a37ddc80$0b16e8c3@fred> <334BA817.4A3C@interactive.sony.com> <01bc454b$1c8e8fe0$5214e8c3@fred> Reply-To: ps_yaroze@interactive.sony.com NNTP-Posting-Host: 194.203.13.10 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 3.01 (Win95; I) Michael Enoch wrote: > > > Take the rows (or columns) one at a time calculate the length > > sqrt(x*x+y*y+z*z) > > and divide the x,y,z by the length > > > > The problem is that 4096 is one and sqrt is slow. > > All this means is that before the divide you have to multiply by 4096, > > and for the sqrt, only doing one row in a frame and not every frame. > > > > Stuart > > Thanks for the explanation, I made this from it and tried it within my > code: > > length=sqrt(Matrix->m[i][0]*Matrix->m[i][0]+ > Matrix->m[i][1]*Matrix->m[i][1]+ > Matrix->m[i][2]*Matrix->m[i][2]); > Matrix->m[i][0]=(Matrix->m[i][0]*ONE)/length; > Matrix->m[i][1]=(Matrix->m[i][1]*ONE)/length; > Matrix->m[i][2]=(Matrix->m[i][2]*ONE)/length; > > I repeated it 3 times changing i to equal 0,1,or 2 for the rows, I wasn't > too bothered about speed at the moment so I just did all 3 rows every > frame. What I was wondering is whether I got it right? The reason I ask is > that the object still changes shape/whatever slightly. Am I just being > picky or have I done something wrong? It doesn't seem as bad as before but > I thought I'd ask anyway to make sure. > > Thanks for your trouble, > Mike. You get this problem because of maths inaccuracies on the PS ( because of the 16 bit values ) The normalisation process will oscillate is you use it continuously. The solution is only to normalise the matrix when you change the orientation of your scene/object. Then, when the picture is still you won't see any changes occuring. Colin.