Re: [Plib-users] Matrices and sgCoord
Brought to you by:
sjbaker
From: Dimitris M. <dm...@ya...> - 2007-07-24 19:52:21
|
Thank you! For your so immediate answer :-)=0AApparently we have some diver= sification of versions regarding the book, I do have found the 475 page the= me on another page...around 698...But no problem, I see what you are tellin= g me....=0AFirst,to tell you, that I know about multiplying matrices, I hav= e done many of those in school and university ( about economics really ) :-= )=0AOn page110 for me, it says m[i][j] is in C the i column and j row whil= e in OpenGL it is i row and j column. The last one is the "mathematic way" = right? So T for me in the previous code, should be on the last column, no?= Or because I am programming C++ I am definetely ok?=0AIt;s bizzare...On the= page I see the 4 column with x,y,z,1 and in my code I see the last row....= But it works! What do I do if I want to make a firing flying weapon?=0A=0AW= ell as I found some voice to reply my concerns...could I continue with my q= uestions??=0AI am trying to work on picking and sellecting? Have you ever d= one it ?=0AI can't really pass glLoadName in my models...so if I could I wo= uld use the so many routines I see on google....but no luck!!!=0AI checked = out PrettyPollyEngine, and the code is undocumented and has many ins-and-ou= ts from various classes...so I get lost and lost...and more lost....=0A=0AI= s there an easy way to handle this? Can I pass LoadNames in the models?=0A= =0AI had the idea to make 3D coordinates of my models converted to 2D,but i= t fails... too...=0AI saw many theoretical links on net, but only microsoft= had some code to show how to deal with this...=0A:-(=0A=0A=0A----- Origina= l Message ----=0AFrom: Fay John F Dr CTR USAF 46 SK <joh...@eg....= mil>=0ATo: PLIB Users <pli...@li...>=0ASent: Tuesday, J= uly 24, 2007 9:43:24 PM=0ASubject: Re: [Plib-users] Matrices and sgCoord=0A= =0ADimitris,=0A=0A First, the PLIB-users e-mail reflector is exactly the= right=0Aplace to bring up questions as you have done. You are doing just = fine=0Ahere.=0A=0A The red book has quite a bit about transformations in= Chapter 3=0A("Viewing"). One relevant bit is a side note at the top of pa= ge 76=0Aabout the difference between a two-dimensional matrix and a=0Aone-d= imensional array in C, about how the rows and columns can be=0Aswitched bet= ween the two formulations, but I don't think this is your=0Aproblem.=0A=0A = More relevant to you, I think, is Appendix G ("Homogeneous=0ACoordinates= and Transformation Matrices"), starting on page 475. It=0Adescribes an ex= pression of coordinates in the form (x,y,z,w) (transposed=0Ato make a colum= n vector). It also gives, on pages 478 and 479, the=0Atransformation matri= ces for each type of transformation.=0A=0A Are you familiar with the mec= hanics of multiplying matrices=0Atogether, or of multiplying a matrix by a = vector to get another vector?=0ABased on the matrix multiplication I figure= you should get the object=0Amoving directly towards or away from your orig= in if you have the=0A"getSpeed ()" call in the bottom row; if you have it i= n the right-hand=0Acolumn the object should move in the y-direction.=0A=0AJ= ohn F. Fay=0ATechnical Fellow=0AJacobs Technology TEAS Group=0A850-883-1294= =0A=0A-----Original Message-----=0AFrom: pli...@li...urcefo= rge.net=0A[mailto:pli...@li...] On Behalf Of Di= mitris=0AMexis=0ASent: Tuesday, July 24, 2007 1:27 PM=0ATo: PLIB Users=0ASu= bject: Re: [Plib-users] Matrices and sgCoord=0A=0A>Dimitris,=0A=0A> Hell= o and welcome to the PLIB community. I didn't reply to your=0A>first reque= st because SSG is not my strong point.=0A=0AThank you for the invitation in= the PLIB community, and please tell me=0Aif by replying to plib-users list= I am ok with proper responding in the=0Alist.=0A=0A=0A> If I may ask, are= you writing a trireme simulation? If so, I=0A>invite you to look (if you = haven't already) at the "Triereis" project.=0A>It uses PLIB as well.=0A=0AE= hm...In deed I am writing a game for trireme warfare, but it is not a=0Asim= ulation exactly, and I haven't started now. It's going to be=0Asomething li= ke Pirates.=0AI did saw the project days ago(triereis), but i didn't see an= y code.=0ALast I can't abandon Methos, it's an old project of me and it is = a dream=0AI wish to finish it up.=0A=0A=0A=0A> The question about the tr= ansformation matrix with "getSpeed" in=0A>the bottom row instead of the las= t column is a tricky question for me.=0A>Just by doing the mathematics, it = seems to me that you are changing=0Aonly=0A>the "w" coordinate of the point= (have you read the OpenGL "red book" on=0A=0AWhat exactly should I read ? = I have the red book borrowed from my uni,=0Aabout 1.4 opengl.=0ACan you giv= e me a hint ? If i must look sth specifically...?=0A=0A>the subject?), whic= h would make the object move either directly towards=0A>or directly away fr= om the origin. Whether this is right or wrong I do=0A>not know without fur= ther study.=0A=0AWell neither do I feel strong in math :-) and I don't real= ly know if=0Ait's right as algorithm...But it should as matrix multiplicati= on be=0Aworkable enough.=0AIf you compile the code, you may see the results= ...Funny ones...=0A=0A>John F. Fay=0A>Technical Fellow=0A>Jacobs Technology= TEAS Group=0A>850-883-1294 =0A=0A-----Original Message-----=0AFrom: plib-u= ser...@li...=0A[mailto:pli...@li...urc= eforge.net] On Behalf Of Dimitris=0AMexis=0ASent: Tuesday, July 24, 2007 9:= 26 AM=0ATo: pli...@li...=0ASubject: [Plib-users] Matric= es and sgCoord=0A=0AThe following code has been a success in order to make = the object move=0Aat a constant speed.=0A=0AsgCoord stigma;=0A=0Avoid GLObj= ect::setStigma( sgMat4 & objDst){=0A sgSetCoord( & stigma, objDst);=0A}= =0A=0AGLObject::move(){=0A //The rotation matrix for moving around trire= me.=0A sgMat4 RotateMatrix =3D {=0A 1, 0, 0, 0,=0A 0, 1,= 0, 0,=0A 0, 0, 1, 0,=0A 0,( getSpeed()), 0, 1=0A };=0A = =0AsgMakeCoordMat4( SHIPSRC, &trireme->getStigma());=0AsgMultMat4( SHIPDST= , SHIPSRC, RotateMatrix);=0AsetStigma( SHIPDST);=0A=0AWhat I don;t understa= nd is that I took the usual matrix and instead=0Atweaking the last column e= lement by the second row,=0AI inversed it and put the getSpeed() which is <= >0 in the bottom row!=0AWhy? this?=0AI made then the matrix multiplications= , and took the result to sgCoord.=0AIs this right approach? Ok it works, bu= t it worths?=0A=0A=0A=0A=0A=0A =0A___________________________________= _____________________________________=0A____________=0ANeed a vacation? Get= great deals=0Ato amazing places on Yahoo! Travel.=0Ahttp://travel.yahoo.co= m/=0A=0A-------------------------------------------------------------------= -----=0A-=0AThis SF.net email is sponsored by: Splunk Inc.=0AStill grepping= through log files to find problems? Stop.=0ANow Search log events and con= figuration files using AJAX and a browser.=0ADownload your FREE copy of Spl= unk now >> http://get.splunk.com/=0A______________________________________= _________=0Aplib-users mailing list=0Ap...@li...=0Aht= tps://lists.sourceforge.net/lists/listinfo/plib-users=0A=0A----------------= --------------------------------------------------------=0A-=0AThis SF.net = email is sponsored by: Splunk Inc.=0AStill grepping through log files to fi= nd problems? Stop.=0ANow Search log events and configuration files using A= JAX and a browser.=0ADownload your FREE copy of Splunk now >> http://get.s= plunk.com/=0A_______________________________________________=0Aplib-users m= ailing list=0Ap...@li...=0Ahttps://lists.sourceforge.= net/lists/listinfo/plib-users=0A=0A=0A=0A=0A=0A =0A__________________= ______________________________________________________=0A____________=0APin= point customers who are looking for what you sell. =0Ahttp://searchmarketin= g.yahoo.com/=0A=0A---------------------------------------------------------= ---------------=0A-=0AThis SF.net email is sponsored by: Splunk Inc.=0AStil= l grepping through log files to find problems? Stop.=0ANow Search log even= ts and configuration files using AJAX and a browser.=0ADownload your FREE c= opy of Splunk now >> http://get.splunk.com/=0A____________________________= ___________________=0Aplib-users mailing list=0Ap...@li...urceforg= e.net=0Ahttps://lists.sourceforge.net/lists/listinfo/plib-users=0A=0A------= -------------------------------------------------------------------=0AThis = SF.net email is sponsored by: Splunk Inc.=0AStill grepping through log file= s to find problems? Stop.=0ANow Search log events and configuration files = using AJAX and a browser.=0ADownload your FREE copy of Splunk now >> http:= //get.splunk.com/=0A_______________________________________________=0Aplib-= users mailing list=0Ap...@li...=0Ahttps://lists.sourc= eforge.net/lists/listinfo/plib-users=0A=0A=0A=0A=0A=0A =0A___________= _________________________________________________________________________= =0AGet the Yahoo! toolbar and be alerted to new email wherever you're surfi= ng.=0Ahttp://new.toolbar.yahoo.com/toolbar/features/mail/index.php |