Re: [Plib-users] Matrices and sgCoord
Brought to you by:
sjbaker
From: Fay J. F Dr C. U. 46 S. <joh...@eg...> - 2007-07-24 18:43:33
|
Dimitris, First, the PLIB-users e-mail reflector is exactly the right place to bring up questions as you have done. You are doing just fine here. The red book has quite a bit about transformations in Chapter 3 ("Viewing"). One relevant bit is a side note at the top of page 76 about the difference between a two-dimensional matrix and a one-dimensional array in C, about how the rows and columns can be switched between the two formulations, but I don't think this is your problem. More relevant to you, I think, is Appendix G ("Homogeneous Coordinates and Transformation Matrices"), starting on page 475. It describes an expression of coordinates in the form (x,y,z,w) (transposed to make a column vector). It also gives, on pages 478 and 479, the transformation matrices for each type of transformation. Are you familiar with the mechanics of multiplying matrices together, or of multiplying a matrix by a vector to get another vector? Based on the matrix multiplication I figure you should get the object moving directly towards or away from your origin if you have the "getSpeed ()" call in the bottom row; if you have it in the right-hand column the object should move in the y-direction. John F. Fay Technical Fellow Jacobs Technology TEAS Group 850-883-1294=20 -----Original Message----- From: pli...@li... [mailto:pli...@li...] On Behalf Of Dimitris Mexis Sent: Tuesday, July 24, 2007 1:27 PM To: PLIB Users Subject: Re: [Plib-users] Matrices and sgCoord >Dimitris, > Hello and welcome to the PLIB community. I didn't reply to your >first request because SSG is not my strong point. Thank you for the invitation in the PLIB community, and please tell me if by replying to plib-users list I am ok with proper responding in the list. > If I may ask, are you writing a trireme simulation? If so, I >invite you to look (if you haven't already) at the "Triereis" project. >It uses PLIB as well. Ehm...In deed I am writing a game for trireme warfare, but it is not a simulation exactly, and I haven't started now. It's going to be something like Pirates. I did saw the project days ago(triereis), but i didn't see any code. Last I can't abandon Methos, it's an old project of me and it is a dream I wish to finish it up. > The question about the transformation matrix with "getSpeed" in >the bottom row instead of the last column is a tricky question for me. >Just by doing the mathematics, it seems to me that you are changing only >the "w" coordinate of the point (have you read the OpenGL "red book" on What exactly should I read ? I have the red book borrowed from my uni, about 1.4 opengl. Can you give me a hint ? If i must look sth specifically...? >the subject?), which would make the object move either directly towards >or directly away from the origin. Whether this is right or wrong I do >not know without further study. Well neither do I feel strong in math :-) and I don't really know if it's right as algorithm...But it should as matrix multiplication be workable enough. If you compile the code, you may see the results...Funny ones... >John F. Fay >Technical Fellow >Jacobs Technology TEAS Group >850-883-1294=20 -----Original Message----- From: pli...@li... [mailto:pli...@li...] On Behalf Of Dimitris Mexis Sent: Tuesday, July 24, 2007 9:26 AM To: pli...@li... Subject: [Plib-users] Matrices and sgCoord The following code has been a success in order to make the object move at a constant speed. sgCoord stigma; void GLObject::setStigma( sgMat4 & objDst){ sgSetCoord( & stigma, objDst); } GLObject::move(){ //The rotation matrix for moving around trireme. sgMat4 RotateMatrix =3D { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0,( getSpeed()), 0, 1 }; =20 sgMakeCoordMat4( SHIPSRC, &trireme->getStigma()); sgMultMat4( SHIPDST, SHIPSRC, RotateMatrix); setStigma( SHIPDST); What I don;t understand is that I took the usual matrix and instead tweaking the last column element by the second row, I inversed it and put the getSpeed() which is <>0 in the bottom row! Why? this? I made then the matrix multiplications, and took the result to sgCoord. Is this right approach? Ok it works, but it worths? =20 ________________________________________________________________________ ____________ Need a vacation? Get great deals to amazing places on Yahoo! Travel. http://travel.yahoo.com/ ------------------------------------------------------------------------ - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ plib-users mailing list pli...@li... https://lists.sourceforge.net/lists/listinfo/plib-users ------------------------------------------------------------------------ - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ plib-users mailing list pli...@li... https://lists.sourceforge.net/lists/listinfo/plib-users =20 ________________________________________________________________________ ____________ Pinpoint customers who are looking for what you sell.=20 http://searchmarketing.yahoo.com/ ------------------------------------------------------------------------ - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ plib-users mailing list pli...@li... https://lists.sourceforge.net/lists/listinfo/plib-users |