plib-users Mailing List for PLIB (Page 7)
Brought to you by:
sjbaker
You can subscribe to this list here.
2000 |
Jan
|
Feb
(24) |
Mar
(54) |
Apr
(29) |
May
(58) |
Jun
(29) |
Jul
(675) |
Aug
(46) |
Sep
(40) |
Oct
(102) |
Nov
(39) |
Dec
(40) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(45) |
Feb
(23) |
Mar
(30) |
Apr
(64) |
May
(28) |
Jun
(61) |
Jul
(55) |
Aug
(35) |
Sep
(24) |
Oct
(23) |
Nov
(21) |
Dec
(67) |
2002 |
Jan
(98) |
Feb
(23) |
Mar
(13) |
Apr
(23) |
May
(43) |
Jun
(45) |
Jul
(54) |
Aug
(5) |
Sep
(56) |
Oct
(17) |
Nov
(53) |
Dec
(26) |
2003 |
Jan
(67) |
Feb
(36) |
Mar
(22) |
Apr
(35) |
May
(26) |
Jun
(35) |
Jul
(10) |
Aug
(49) |
Sep
(17) |
Oct
(3) |
Nov
(30) |
Dec
(10) |
2004 |
Jan
(12) |
Feb
(18) |
Mar
(52) |
Apr
(50) |
May
(22) |
Jun
(13) |
Jul
(16) |
Aug
(23) |
Sep
(21) |
Oct
(29) |
Nov
(6) |
Dec
(26) |
2005 |
Jan
(9) |
Feb
(19) |
Mar
(13) |
Apr
(19) |
May
(12) |
Jun
(8) |
Jul
(6) |
Aug
(10) |
Sep
(22) |
Oct
(3) |
Nov
(6) |
Dec
(17) |
2006 |
Jan
(10) |
Feb
(8) |
Mar
(5) |
Apr
(5) |
May
(6) |
Jun
(8) |
Jul
(8) |
Aug
(13) |
Sep
(2) |
Oct
(1) |
Nov
(9) |
Dec
(6) |
2007 |
Jan
(3) |
Feb
(4) |
Mar
(12) |
Apr
(2) |
May
(6) |
Jun
|
Jul
(22) |
Aug
|
Sep
(9) |
Oct
(13) |
Nov
|
Dec
|
2008 |
Jan
(1) |
Feb
(6) |
Mar
(2) |
Apr
(4) |
May
(15) |
Jun
(28) |
Jul
(8) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2009 |
Jan
(5) |
Feb
(5) |
Mar
|
Apr
|
May
(3) |
Jun
|
Jul
(1) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2010 |
Jan
|
Feb
|
Mar
(2) |
Apr
(7) |
May
(4) |
Jun
(2) |
Jul
(5) |
Aug
|
Sep
|
Oct
(3) |
Nov
|
Dec
|
2011 |
Jan
(7) |
Feb
(2) |
Mar
(1) |
Apr
|
May
(4) |
Jun
|
Jul
|
Aug
|
Sep
(3) |
Oct
(1) |
Nov
(4) |
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(4) |
Nov
|
Dec
|
2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2019 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2024 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Sherif O. <she...@ya...> - 2007-09-29 10:38:14
|
Hello all, is it possible to use the plib with visual basic under windows, and if not what do you suggest? thanks Sherif Omran --------------------------------- Tonight's top picks. What will you watch tonight? Preview the hottest shows on Yahoo! TV. |
From: Peijing <est...@si...> - 2007-09-03 16:11:08
|
Hi, I'm new to plib and I need to create a rectangular polygon with a = triangular hole like this: _______ | | =20 |__/\___| but I do not know how to do this with plibs. I've got some examples from = the opengl redbook and I'm looking for a plib equivalent of it.=20 Could someone enlighten me regarding how to go about doing this or any = online references I can refer to? The opengl code is such: GLUtesselator *tobj; =20 GLdouble rect[4][3] =3D {50.0, 50.0, 0.0, 200.0, 50.0, 0.0, 200.0, 200.0, 0.0, 50.0, 200.0, 0.0}; GLdouble tri[3][3] =3D {75.0, 75.0, 0.0, 125.0, 175.0, 0.0, 175.0, 75.0, 0.0}; =20 glClearColor(0.0, 0.0, 0.0, 0.0); startList =3D glGenLists(2); tobj =3D gluNewTess(); gluTessCallback(tobj, GLU_TESS_VERTEX,=20 glVertex3dv); gluTessCallback(tobj, GLU_TESS_BEGIN,=20 beginCallback); gluTessCallback(tobj, GLU_TESS_END,=20 endCallback); gluTessCallback(tobj, GLU_TESS_ERROR,=20 errorCallback); /* rectangle with triangular hole inside */ glNewList(startList, GL_COMPILE); glShadeModel(GL_FLAT); =20 gluTessBeginPolygon(tobj, NULL); gluTessBeginContour(tobj); gluTessVertex(tobj, rect[0], rect[0]); gluTessVertex(tobj, rect[1], rect[1]); gluTessVertex(tobj, rect[2], rect[2]); gluTessVertex(tobj, rect[3], rect[3]); gluTessEndContour(tobj); gluTessBeginContour(tobj); gluTessVertex(tobj, tri[0], tri[0]); gluTessVertex(tobj, tri[1], tri[1]); gluTessVertex(tobj, tri[2], tri[2]); gluTessEndContour(tobj); gluTessEndPolygon(tobj); glEndList(); gluDeleteTess(tobj); Any help is appreciated.=20 Thanks, EL |
From: Paolo L. <p.l...@ci...> - 2007-07-27 07:50:30
|
Dimitris,=20 > -----Messaggio originale----- > Da: pli...@li...=20 > [mailto:pli...@li...] Per conto=20 > di Dimitris Mexis > Inviato: gioved=EC 26 luglio 2007 17.04 > A: PLIB Users > Oggetto: Re: [Plib-users] R: R: R: Matrices and sgCoord >=20 > Paolo, > The code worked almost without any problem... > I do wish only if you could provide more information what=20 > these functions do... > not the general idea, but how the mechanism works... > Can you give details? Please be more specific. What functions, mechanism do you refer to? =20 > Especially, this Vtx and Leaf thing is something that I don't=20 > catch up... ssgLeaf is an abstract class for holding actual geometric data (i.e. triangles or other graphics primitives in terms of vertices, normals, triangle indices into the vertex array, colors), and a pointer to the "state" (i.e. the material in terms of OpenGL modes activated, texture, = and other attributes). Among derived classes the most modern and efficient = is the ssgVtxArray, which implements primitive drawing in terms of OpenGL Vertex Arrays, which is a fast way to transfer and draw geometry in = OpenGL especially when used in conjuction with display lists (VBO, Vertex = Buffer Objects, are even faster in immediate mode yet don't take advantage of = being put in the graphics memory in form of display list, and are not = presently implemented in Plib SSG). There are methods to put your geometry into a ssgLeaf/ssgVtxArray, as = well as to query whatever Leaf data. In a Leaf you can have control of the = pre- and the post-draw stages through user-definable callbacks, which, along = with a similar mechanism for states, allows to implement custom advanced rendering techniques or object highlighting (e.g. when you pick it). Multitexturing is not natively supported in SSG but one can write = compact pre/post-draw callbacks for doing it, just look at the Steve's 'water' = demo. There could be much more to say about all the key classes in SSG, but I think the best place to go for learning, after the Web docs, is the = ssg.h file (and the sg.h too). > Also! > Is this code part of PLIB ? or Should I mention you OR=20 > SOMEBODY ELSE in the code ? or somewhere else? Ah, probably you are replying in the "Matrices and sgCoord" thread with = the "Help for code that is not documented and isconfusing" thread in mind = (then focused on object picking), isn't it? Is this the code do you refer to? It would be appropriate to equip SSG with native picking functions = (object, or other lower level primitives). There are good reasons for letting = them away from SSG, but even for putting them into SSG or in the SSG = Auxiliary library. Anyway for me don't worry about credits. > Thank you! You're welcome, Paolo > ----- Original Message ---- > From: Paolo Leoncini <p.l...@ci...> > To: PLIB Users <pli...@li...> > Sent: Wednesday, July 25, 2007 2:51:22 PM > Subject: [Plib-users] R: R: R: Matrices and sgCoord >=20 > Dimistris,=20 >=20 > > -----Messaggio originale----- > > Da: pli...@li...=20 > > [mailto:pli...@li...] Per conto=20 > > di Dimitris Mexis > > Inviato: mercoled=EC 25 luglio 2007 12.39 > > A: PLIB Users > > Oggetto: Re: [Plib-users] R: R: Matrices and sgCoord > >=20 > > No there was not in your code but in plib I have found these=20 > > functions and I don't understand them : > > void orthoXform ( sgMat4 m ) in Sphere code, and in sg.h > > void sgXformVec3 ( sgVec3 dst, sgMat4 mat ) ; > > void sgXformVec3 ( sgVec3 dst, sgVec3 src, sgMat4 mat ) ; > >=20 > > void sgXformPnt3 ( sgVec3 dst, sgMat4 mat ) ; > > void sgXformPnt3 ( sgVec3 dst, sgVec3 src, sgMat4 mat ) ; > >=20 > > void sgFullXformPnt3 ( sgVec3 dst, sgMat4 mat ) ; void=20 > > sgFullXformPnt3 ( sgVec3 dst, sgVec3 src, sgMat4 mat ) ; > >=20 > > void sgXformVec4 ( sgVec4 dst, sgMat4 mat ) ; > > void sgXformVec4 ( sgVec4 dst, sgVec4 src, sgMat4 mat ) ; > >=20 > > void sgXformPnt4 ( sgVec4 dst, sgMat4 mat ) ; > > void sgXformPnt4 ( sgVec4 dst, sgVec4 src, sgMat4 mat ) ; > >=20 > > void sgFullXformPnt4 ( sgVec4 dst, sgMat4 mat ) ; void=20 > > sgFullXformPnt4 ( sgVec4 dst, sgVec4 src, sgMat4 mat ) ; > >=20 > > ????? >=20 > Ok, these are all functions, not class methods. Just try to=20 > read 'transform' > in place of 'xform', and you'll get a plenty of ways to=20 > transform a point or > a vector, 3- or 4-dims, by a transformation matrix. >=20 > For example, sgXformVec3 will multiply a sgVec3 by the 3x3=20 > rotation section > of a sgMat4, whilst sgXformPnt3 does what sgXformVec3 does + adds the > matrix's translation row to the resuling vector (i.e. treats=20 > it as an actual > 'point'). >=20 > The 'Full' versions transform vecs and pnts 'homogeneously'. >=20 > Paolo >=20 >=20 > > ----- Original Message ---- > > From: Paolo Leoncini <p.l...@ci...> > > To: PLIB Users <pli...@li...> > > Sent: Wednesday, July 25, 2007 1:30:17 PM > > Subject: [Plib-users] R: R: Matrices and sgCoord > >=20 > > Dimitris,=20 > >=20 > > > -----Messaggio originale----- > > > Da: pli...@li... > > > [mailto:pli...@li...] Per conto di=20 > > > Dimitris Mexis > > > Inviato: mercoled=EC 25 luglio 2007 11.47 > > > A: PLIB Users > > > Oggetto: Re: [Plib-users] R: Matrices and sgCoord > > >=20 > > > Thank you Paolo, for the clarification, so it is right to=20 > > handle the=20 > > > last row, and it wasn't accident. > > > I liked your second option of working with the coords. > > > By the way...What is an xform? What do the function do in=20 > > plib about=20 > > > sgxform*? > > > They are not matrices right? ( plib has sgMat for them...no?) > >=20 > > 'xform' is a way 3D graphics programmers use to refer to=20 > > 2D/3D transformations in variable names ('x' stands for=20 > > 'trans'). There should be also a class method in SG (IIRC=20 > > XformVec3 and XformPnt) with this prefix. > > Using it makes me feeling a very english/american 3D programmer. > >=20 > > There's no sgxform in the code I wrote, unless an error were=20 > > introduced when the e-mail systems formatted my message. > >=20 > > > Thank you > >=20 > > Greetings, > >=20 > > Paolo > >=20 > >=20 > > > ----- Original Message ---- > > > From: Paolo Leoncini <p.l...@ci...> > > > To: PLIB Users <pli...@li...> > > > Sent: Wednesday, July 25, 2007 12:33:55 PM > > > Subject: [Plib-users] R: Matrices and sgCoord > > >=20 > > > Dimitris, > > >=20 > > > > -----Messaggio originale----- > > > > Da: pli...@li... > > > > [mailto:pli...@li...] Per conto di=20 > > > > Dimitris Mexis > > > > Inviato: marted=EC 24 luglio 2007 16.26 > > > > A: pli...@li... > > > > Oggetto: [Plib-users] Matrices and sgCoord > > > >=20 > > > > The following code has been a success in order to make the > > > object move > > > > at a constant speed. > > > >=20 > > > > sgCoord stigma; > > > >=20 > > > > void GLObject::setStigma( sgMat4 & objDst){ > > > > sgSetCoord( & stigma, objDst); > > > > } > > > >=20 > > > > 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); > > > >=20 > > > > What I don;t understand is that I took the usual matrix=20 > > and instead=20 > > > > 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? > > >=20 > > > I hope to have understood correctly your perplexity. > > >=20 > > > First, SSG has a different coord reference system wrt OpenGL.=20 > > > Both have the same handness, so x+ is along right in both,=20 > > yet OpenGL=20 > > > is y+ -up, z+ -going outside the screen, whilst SSG is z+ -up, y+=20 > > > -going into the screen. > > >=20 > > > Second, SG's sgMat4 is a 4x4 homogeneous matrix for specifying=20 > > > projection, viewing, modelling and/or object position. For old,=20 > > > nostalgic programmers, it's a-la-IrisGL. > > > The fourth row is the translation. > > >=20 > > > Then, when your ship moves on the sea plane, it actually=20 > > moves on the=20 > > > x-y plane (z=3D0), and hence elements of a sgMat4 ship_xform=20 > > to change=20 > > > are ship_xform [3][0], ship_xform[3][1] (ship_xform[3] can=20 > > be pointed=20 > > > to by a > > > sgVec3 to set a transformation vector xyz). > > >=20 > > > That's the reason why you put getSpeed() for setting=20 > > > RotateMatrix[3][1]. In a un-rotated viewing, you should see=20 > > the ship=20 > > > entering/exiting into/out the screen. > > >=20 > > > > I made then the matrix multiplications, and took the result to=20 > > > > sgCoord. > > > > Is this right approach? Ok it works, but it worths? > > >=20 > > > You don't specify what you do with sgCoord stigma after the=20 > > last set.=20 > > > If you need to move it I assume your ship is a > > >=20 > > > ssgTransform *ship; > > >=20 > > > So you'll probably call > > >=20 > > > ship->setTransform( /* sgCoord* */ stigma ); // one of=20 > > the several=20 > > > ship->forms > > > to set a xform > > >=20 > > >=20 > > > Alternatively I could have done this way: > > >=20 > > > void move_ship( ssgTransform *ship ) > > > { > > > sgMat4 ship_xform; > > > ship->getTransform( ship_xform ); > > > sgVec3 ship_pos =3D { 0, getSpeed(), 0 }; // don't know if=20 > > getSpeed=20 > > > is directly callable, or an object method > > > sgAddVec3( ship_xform[3], ship_pos ); // just increment=20 > > > the position > > > coords, resembles sgMultMat4 for the translation part only > > > ship->setTransform( ship_xform ); // set the updated=20 > > > matrix back to > > > the object > > > } > > >=20 > > > Greetings, > > >=20 > > > Paolo Leoncini > > >=20 > > >=20 > > > -------------------------------------------------------------- > > > ----------- > > > 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=20 > > > browser. > > > Download your FREE copy of Splunk now >> http://get.splunk.com/=20 > > > _______________________________________________ > > > plib-users mailing list > > > pli...@li... > > > https://lists.sourceforge.net/lists/listinfo/plib-users > > >=20 > > >=20 > > >=20 > > >=20 > > >=20 > > > =20 > > > ______________________________________________________________ > > > ______________________ > > > Take the Internet to Go: Yahoo!Go puts the Internet in your > > > pocket: mail, news, photos & more.=20 > > > http://mobile.yahoo.com/go?refer=3D1GNXIC > > >=20 > > > -------------------------------------------------------------- > > > ----------- > > > 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=20 > > > browser. > > > Download your FREE copy of Splunk now >> http://get.splunk.com/=20 > > > _______________________________________________ > > > plib-users mailing list > > > pli...@li... > > > https://lists.sourceforge.net/lists/listinfo/plib-users > > >=20 > >=20 > >=20 > > -------------------------------------------------------------- > > ----------- > > 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=20 > > 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 > >=20 > >=20 > >=20 > >=20 > > =20 > > ______________________________________________________________ > > ______________________ > > Fussy? Opinionated? Impossible to please? Perfect. Join=20 > > Yahoo!'s user panel and lay it on us.=20 > > http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=3D7=20 > >=20 > >=20 > > -------------------------------------------------------------- > > ----------- > > 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=20 > > 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 >=20 >=20 > -------------------------------------------------------------- > ----------- > 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=20 > 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 >=20 >=20 >=20 >=20 > =20 > ______________________________________________________________ > ______________________ > Be a better Globetrotter. Get better travel answers from=20 > someone who knows. Yahoo! Answers - Check it out. > http://answers.yahoo.com/dir/?link=3Dlist&sid=3D396545469 >=20 > -------------------------------------------------------------- > ----------- > 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=20 > 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 |
From: Dimitris M. <dm...@ya...> - 2007-07-26 15:03:38
|
Paolo,=0AThe code worked almost without any problem...=0AI do wish only if = you could provide more information what these functions do...=0Anot the gen= eral idea, but how the mechanism works...=0ACan you give details?=0A=0AEspe= cially, this Vtx and Leaf thing is something that I don't catch up...=0A=0A= Also!=0AIs this code part of PLIB ? or Should I mention you OR SOMEBODY ELS= E in the code ? or somewhere else?=0A=0AThank you!=0A=0A----- Original Mess= age ----=0AFrom: Paolo Leoncini <p.l...@ci...>=0ATo: PLIB Users <plib= -u...@li...>=0ASent: Wednesday, July 25, 2007 2:51:22 PM= =0ASubject: [Plib-users] R: R: R: Matrices and sgCoord=0A=0ADimistris, = =0A=0A> -----Messaggio originale-----=0A> Da: pli...@li...ur= ceforge.net =0A> [mailto:pli...@li...] Per cont= o =0A> di Dimitris Mexis=0A> Inviato: mercoled=EC 25 luglio 2007 12.39=0A> = A: PLIB Users=0A> Oggetto: Re: [Plib-users] R: R: Matrices and sgCoord=0A> = =0A> No there was not in your code but in plib I have found these =0A> func= tions and I don't understand them :=0A> void orthoXform ( sgMat4 m ) in Sph= ere code, and in sg.h=0A> void sgXformVec3 ( sgVec3 dst, sgMat4 mat ) = ;=0A> void sgXformVec3 ( sgVec3 dst, sgVec3 src, sgMat4 mat ) ;=0A> = =0A> void sgXformPnt3 ( sgVec3 dst, sgMat4 mat ) ;=0A> void sgXformPn= t3 ( sgVec3 dst, sgVec3 src, sgMat4 mat ) ;=0A> =0A> void sgFullXformP= nt3 ( sgVec3 dst, sgMat4 mat ) ; void =0A> sgFullXformPnt3 ( sgVec3 dst, s= gVec3 src, sgMat4 mat ) ;=0A> =0A> void sgXformVec4 ( sgVec4 dst, sgMa= t4 mat ) ;=0A> void sgXformVec4 ( sgVec4 dst, sgVec4 src, sgMat4 mat )= ;=0A> =0A> void sgXformPnt4 ( sgVec4 dst, sgMat4 mat ) ;=0A> void sg= XformPnt4 ( sgVec4 dst, sgVec4 src, sgMat4 mat ) ;=0A> =0A> void sgFul= lXformPnt4 ( sgVec4 dst, sgMat4 mat ) ; void =0A> sgFullXformPnt4 ( sgVec4= dst, sgVec4 src, sgMat4 mat ) ;=0A> =0A> ?????=0A=0AOk, these are all func= tions, not class methods. Just try to read 'transform'=0Ain place of 'xform= ', and you'll get a plenty of ways to transform a point or=0Aa vector, 3- o= r 4-dims, by a transformation matrix.=0A=0AFor example, sgXformVec3 will mu= ltiply a sgVec3 by the 3x3 rotation section=0Aof a sgMat4, whilst sgXformPn= t3 does what sgXformVec3 does + adds the=0Amatrix's translation row to the = resuling vector (i.e. treats it as an actual=0A'point').=0A=0AThe 'Full' ve= rsions transform vecs and pnts 'homogeneously'.=0A=0APaolo=0A=0A=0A> ----- = Original Message ----=0A> From: Paolo Leoncini <p.l...@ci...>=0A> To:= PLIB Users <pli...@li...>=0A> Sent: Wednesday, July 25= , 2007 1:30:17 PM=0A> Subject: [Plib-users] R: R: Matrices and sgCoord=0A= > =0A> Dimitris, =0A> =0A> > -----Messaggio originale-----=0A> > Da: plib-u= ser...@li...=0A> > [mailto:plib-users-bounces@lists.s= ourceforge.net] Per conto di =0A> > Dimitris Mexis=0A> > Inviato: mercoled= =EC 25 luglio 2007 11.47=0A> > A: PLIB Users=0A> > Oggetto: Re: [Plib-users= ] R: Matrices and sgCoord=0A> > =0A> > Thank you Paolo, for the clarificati= on, so it is right to =0A> handle the =0A> > last row, and it wasn't accide= nt.=0A> > I liked your second option of working with the coords.=0A> > By t= he way...What is an xform? What do the function do in =0A> plib about =0A> = > sgxform*?=0A> > They are not matrices right? ( plib has sgMat for them...= no?)=0A> =0A> 'xform' is a way 3D graphics programmers use to refer to =0A>= 2D/3D transformations in variable names ('x' stands for =0A> 'trans'). The= re should be also a class method in SG (IIRC =0A> XformVec3 and XformPnt) w= ith this prefix.=0A> Using it makes me feeling a very english/american 3D p= rogrammer.=0A> =0A> There's no sgxform in the code I wrote, unless an error= were =0A> introduced when the e-mail systems formatted my message.=0A> =0A= > > Thank you=0A> =0A> Greetings,=0A> =0A> Paolo=0A> =0A> =0A> > ----- Orig= inal Message ----=0A> > From: Paolo Leoncini <p.l...@ci...>=0A> > To:= PLIB Users <pli...@li...>=0A> > Sent: Wednesday, July = 25, 2007 12:33:55 PM=0A> > Subject: [Plib-users] R: Matrices and sgCoord= =0A> > =0A> > Dimitris,=0A> > =0A> > > -----Messaggio originale-----=0A> > = > Da: pli...@li...=0A> > > [mailto:plib-users-b= ou...@li...] Per conto di =0A> > > Dimitris Mexis=0A> > > = Inviato: marted=EC 24 luglio 2007 16.26=0A> > > A: pli...@li...urcef= orge.net=0A> > > Oggetto: [Plib-users] Matrices and sgCoord=0A> > > =0A> > = > The following code has been a success in order to make the=0A> > object m= ove=0A> > > at a constant speed.=0A> > > =0A> > > sgCoord stigma;=0A> > > = =0A> > > void GLObject::setStigma( sgMat4 & objDst){=0A> > > sgSetCoord= ( & stigma, objDst);=0A> > > }=0A> > > =0A> > > GLObject::move(){=0A> > > = //The rotation matrix for moving around trireme.=0A> > > sgMat4 Rota= teMatrix =3D {=0A> > > 1, 0, 0, 0,=0A> > > 0, 1, 0, 0,=0A= > > > 0, 0, 1, 0,=0A> > > 0,( getSpeed()), 0, 1=0A> > > = };=0A> > > =0A> > > sgMakeCoordMat4( SHIPSRC, &trireme->getStigma());= =0A> > sgMultMat4( SHIPDST,=0A> > > SHIPSRC, RotateMatrix); setStigma( SHIP= DST);=0A> > > =0A> > > What I don;t understand is that I took the usual mat= rix =0A> and instead =0A> > > tweaking the last column element by the secon= d row, I=0A> > inversed it and=0A> > > put the getSpeed() which is <>0 in t= he bottom row! Why? this?=0A> > =0A> > I hope to have understood correctly = your perplexity.=0A> > =0A> > First, SSG has a different coord reference sy= stem wrt OpenGL. =0A> > Both have the same handness, so x+ is along right i= n both, =0A> yet OpenGL =0A> > is y+ -up, z+ -going outside the screen, whi= lst SSG is z+ -up, y+ =0A> > -going into the screen.=0A> > =0A> > Second, S= G's sgMat4 is a 4x4 homogeneous matrix for specifying =0A> > projection, vi= ewing, modelling and/or object position. For old, =0A> > nostalgic programm= ers, it's a-la-IrisGL.=0A> > The fourth row is the translation.=0A> > =0A> = > Then, when your ship moves on the sea plane, it actually =0A> moves on th= e =0A> > x-y plane (z=3D0), and hence elements of a sgMat4 ship_xform =0A> = to change =0A> > are ship_xform [3][0], ship_xform[3][1] (ship_xform[3] can= =0A> be pointed =0A> > to by a=0A> > sgVec3 to set a transformation vector= xyz).=0A> > =0A> > That's the reason why you put getSpeed() for setting = =0A> > RotateMatrix[3][1]. In a un-rotated viewing, you should see =0A> the= ship =0A> > entering/exiting into/out the screen.=0A> > =0A> > > I made th= en the matrix multiplications, and took the result to =0A> > > sgCoord.=0A>= > > Is this right approach? Ok it works, but it worths?=0A> > =0A> > You d= on't specify what you do with sgCoord stigma after the =0A> last set. =0A> = > If you need to move it I assume your ship is a=0A> > =0A> > ssgTransform = *ship;=0A> > =0A> > So you'll probably call=0A> > =0A> > ship->setTransform= ( /* sgCoord* */ stigma ); // one of =0A> the several =0A> > ship->forms= =0A> > to set a xform=0A> > =0A> > =0A> > Alternatively I could have done t= his way:=0A> > =0A> > void move_ship( ssgTransform *ship )=0A> > {=0A> > = sgMat4 ship_xform;=0A> > ship->getTransform( ship_xform );=0A> > sgVec3= ship_pos =3D { 0, getSpeed(), 0 }; // don't know if =0A> getSpeed =0A> > = is directly callable, or an object method=0A> > sgAddVec3( ship_xform[3],= ship_pos ); // just increment =0A> > the position=0A> > coords, resembl= es sgMultMat4 for the translation part only=0A> > ship->setTransform( shi= p_xform ); // set the updated =0A> > matrix back to=0A> > the object= =0A> > }=0A> > =0A> > Greetings,=0A> > =0A> > Paolo Leoncini=0A> > =0A> > = =0A> > --------------------------------------------------------------=0A> >= -----------=0A> > This SF.net email is sponsored by: Splunk Inc.=0A> > Sti= ll grepping through log files to find problems? Stop.=0A> > Now Search log= events and configuration files using AJAX and a =0A> > browser.=0A> > Down= load your FREE copy of Splunk now >> http://get.splunk.com/ =0A> > ________= _______________________________________=0A> > plib-users mailing list=0A> >= pli...@li...=0A> > https://lists.sourceforge.net/lists= /listinfo/plib-users=0A> > =0A> > =0A> > =0A> > =0A> > =0A> > =0A> >= ______________________________________________________________=0A> > _____= _________________=0A> > Take the Internet to Go: Yahoo!Go puts the Internet= in your=0A> > pocket: mail, news, photos & more. =0A> > http://mobile.yaho= o.com/go?refer=3D1GNXIC=0A> > =0A> > --------------------------------------= ------------------------=0A> > -----------=0A> > This SF.net email is spons= ored by: Splunk Inc.=0A> > Still grepping through log files to find problem= s? Stop.=0A> > Now Search log events and configuration files using AJAX an= d a =0A> > browser.=0A> > Download your FREE copy of Splunk now >> http://g= et.splunk.com/ =0A> > _______________________________________________=0A> >= plib-users mailing list=0A> > pli...@li...=0A> > https= ://lists.sourceforge.net/lists/listinfo/plib-users=0A> > =0A> =0A> =0A> ---= -----------------------------------------------------------=0A> -----------= =0A> This SF.net email is sponsored by: Splunk Inc.=0A> Still grepping thro= ugh log files to find problems? Stop.=0A> Now Search log events and config= uration files using AJAX and =0A> a browser.=0A> Download your FREE copy of= Splunk now >> http://get.splunk.com/=0A> ________________________________= _______________=0A> plib-users mailing list=0A> pli...@li...urceforg= e.net=0A> https://lists.sourceforge.net/lists/listinfo/plib-users=0A> =0A> = =0A> =0A> =0A> =0A> =0A> ____________________________________________= __________________=0A> ______________________=0A> Fussy? Opinionated? Impos= sible to please? Perfect. Join =0A> Yahoo!'s user panel and lay it on us. = =0A> http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=3D7 =0A> =0A= > =0A> --------------------------------------------------------------=0A> -= ----------=0A> This SF.net email is sponsored by: Splunk Inc.=0A> Still gre= pping through log files to find problems? Stop.=0A> Now Search log events = and configuration files using AJAX and =0A> a browser.=0A> Download your FR= EE copy of Splunk now >> http://get.splunk.com/=0A> ______________________= _________________________=0A> plib-users mailing list=0A> plib-users@lists.= sourceforge.net=0A> https://lists.sourceforge.net/lists/listinfo/plib-users= =0A> =0A=0A=0A-------------------------------------------------------------= ------------=0AThis SF.net email is sponsored by: Splunk Inc.=0AStill grepp= ing through log files 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.sourceforge.net/lists/listinfo/plib-users=0A=0A=0A=0A=0A= =0A =0A______________________________________________________________= ______________________=0ABe a better Globetrotter. Get better travel answer= s from someone who knows. Yahoo! Answers - Check it out.=0Ahttp://answers.y= ahoo.com/dir/?link=3Dlist&sid=3D396545469 |
From: Dimitris M. <dm...@ya...> - 2007-07-25 12:07:35
|
What seems to me Paolo, Joe and Tinoshy, I have to work a bit, and I am wor= king on my next questions :-)=0A=0AThank you for your time, people...=0ADim= itris=0A=0A----- Original Message ----=0AFrom: Paolo Leoncini <p.leoncini@c= ira.it>=0ATo: PLIB Users <pli...@li...>=0ASent: Wednesd= ay, July 25, 2007 2:51:22 PM=0ASubject: [Plib-users] R: R: R: Matrices a= nd sgCoord=0A=0ADimistris, =0A=0A> -----Messaggio originale-----=0A> Da: pl= ib-...@li... =0A> [mailto:plib-users-bounces@list= s.sourceforge.net] Per conto =0A> di Dimitris Mexis=0A> Inviato: mercoled= =EC 25 luglio 2007 12.39=0A> A: PLIB Users=0A> Oggetto: Re: [Plib-users] R:= R: Matrices and sgCoord=0A> =0A> No there was not in your code but in plib= I have found these =0A> functions and I don't understand them :=0A> void o= rthoXform ( sgMat4 m ) in Sphere code, and in sg.h=0A> void sgXformVec3 = ( sgVec3 dst, sgMat4 mat ) ;=0A> void sgXformVec3 ( sgVec3 dst, sgVe= c3 src, sgMat4 mat ) ;=0A> =0A> void sgXformPnt3 ( sgVec3 dst, sgMat4 = mat ) ;=0A> void sgXformPnt3 ( sgVec3 dst, sgVec3 src, sgMat4 mat ) ;= =0A> =0A> void sgFullXformPnt3 ( sgVec3 dst, sgMat4 mat ) ; void =0A> sgF= ullXformPnt3 ( sgVec3 dst, sgVec3 src, sgMat4 mat ) ;=0A> =0A> void sgXfor= mVec4 ( sgVec4 dst, sgMat4 mat ) ;=0A> void sgXformVec4 ( sgVec4 d= st, sgVec4 src, sgMat4 mat ) ;=0A> =0A> void sgXformPnt4 ( sgVec4 dst,= sgMat4 mat ) ;=0A> void sgXformPnt4 ( sgVec4 dst, sgVec4 src, sgMat4 = mat ) ;=0A> =0A> void sgFullXformPnt4 ( sgVec4 dst, sgMat4 mat ) ; void = =0A> sgFullXformPnt4 ( sgVec4 dst, sgVec4 src, sgMat4 mat ) ;=0A> =0A> ????= ?=0A=0AOk, these are all functions, not class methods. Just try to read 'tr= ansform'=0Ain place of 'xform', and you'll get a plenty of ways to transfor= m a point or=0Aa vector, 3- or 4-dims, by a transformation matrix.=0A=0AFor= example, sgXformVec3 will multiply a sgVec3 by the 3x3 rotation section=0A= of a sgMat4, whilst sgXformPnt3 does what sgXformVec3 does + adds the=0Amat= rix's translation row to the resuling vector (i.e. treats it as an actual= =0A'point').=0A=0AThe 'Full' versions transform vecs and pnts 'homogeneousl= y'.=0A=0APaolo=0A=0A=0A> ----- Original Message ----=0A> From: Paolo Leonci= ni <p.l...@ci...>=0A> To: PLIB Users <pli...@li...= t>=0A> Sent: Wednesday, July 25, 2007 1:30:17 PM=0A> Subject: [Plib-users] = R: R: Matrices and sgCoord=0A> =0A> Dimitris, =0A> =0A> > -----Messaggio = originale-----=0A> > Da: pli...@li...=0A> > [ma= ilto:pli...@li...] Per conto di =0A> > Dimitris= Mexis=0A> > Inviato: mercoled=EC 25 luglio 2007 11.47=0A> > A: PLIB Users= =0A> > Oggetto: Re: [Plib-users] R: Matrices and sgCoord=0A> > =0A> > Thank= you Paolo, for the clarification, so it is right to =0A> handle the =0A> >= last row, and it wasn't accident.=0A> > I liked your second option of work= ing with the coords.=0A> > By the way...What is an xform? What do the funct= ion do in =0A> plib about =0A> > sgxform*?=0A> > They are not matrices righ= t? ( plib has sgMat for them...no?)=0A> =0A> 'xform' is a way 3D graphics p= rogrammers use to refer to =0A> 2D/3D transformations in variable names ('x= ' stands for =0A> 'trans'). There should be also a class method in SG (IIRC= =0A> XformVec3 and XformPnt) with this prefix.=0A> Using it makes me feeli= ng a very english/american 3D programmer.=0A> =0A> There's no sgxform in th= e code I wrote, unless an error were =0A> introduced when the e-mail system= s formatted my message.=0A> =0A> > Thank you=0A> =0A> Greetings,=0A> =0A> P= aolo=0A> =0A> =0A> > ----- Original Message ----=0A> > From: Paolo Leoncini= <p.l...@ci...>=0A> > To: PLIB Users <pli...@li...= t>=0A> > Sent: Wednesday, July 25, 2007 12:33:55 PM=0A> > Subject: [Plib-us= ers] R: Matrices and sgCoord=0A> > =0A> > Dimitris,=0A> > =0A> > > -----Me= ssaggio originale-----=0A> > > Da: pli...@li...= =0A> > > [mailto:pli...@li...] Per conto di =0A= > > > Dimitris Mexis=0A> > > Inviato: marted=EC 24 luglio 2007 16.26=0A> > = > A: pli...@li...=0A> > > Oggetto: [Plib-users] Matrice= s and sgCoord=0A> > > =0A> > > The following code has been a success in ord= er to make the=0A> > object move=0A> > > at a constant speed.=0A> > > =0A> = > > sgCoord stigma;=0A> > > =0A> > > void GLObject::setStigma( sgMat4 & obj= Dst){=0A> > > sgSetCoord( & stigma, objDst);=0A> > > }=0A> > > =0A> > >= GLObject::move(){=0A> > > //The rotation matrix for moving around trir= eme.=0A> > > sgMat4 RotateMatrix =3D {=0A> > > 1, 0, 0, 0,=0A= > > > 0, 1, 0, 0,=0A> > > 0, 0, 1, 0,=0A> > > 0,( g= etSpeed()), 0, 1=0A> > > };=0A> > > =0A> > > sgMakeCoordMat4( SHIPS= RC, &trireme->getStigma());=0A> > sgMultMat4( SHIPDST,=0A> > > SHIPSRC, Rot= ateMatrix); setStigma( SHIPDST);=0A> > > =0A> > > What I don;t understand i= s that I took the usual matrix =0A> and instead =0A> > > tweaking the last = column element by the second row, I=0A> > inversed it and=0A> > > put the g= etSpeed() which is <>0 in the bottom row! Why? this?=0A> > =0A> > I hope to= have understood correctly your perplexity.=0A> > =0A> > First, SSG has a d= ifferent coord reference system wrt OpenGL. =0A> > Both have the same handn= ess, so x+ is along right in both, =0A> yet OpenGL =0A> > is y+ -up, z+ -go= ing outside the screen, whilst SSG is z+ -up, y+ =0A> > -going into the scr= een.=0A> > =0A> > Second, SG's sgMat4 is a 4x4 homogeneous matrix for speci= fying =0A> > projection, viewing, modelling and/or object position. For old= , =0A> > nostalgic programmers, it's a-la-IrisGL.=0A> > The fourth row is t= he translation.=0A> > =0A> > Then, when your ship moves on the sea plane, i= t actually =0A> moves on the =0A> > x-y plane (z=3D0), and hence elements o= f a sgMat4 ship_xform =0A> to change =0A> > are ship_xform [3][0], ship_xfo= rm[3][1] (ship_xform[3] can =0A> be pointed =0A> > to by a=0A> > sgVec3 to = set a transformation vector xyz).=0A> > =0A> > That's the reason why you pu= t getSpeed() for setting =0A> > RotateMatrix[3][1]. In a un-rotated viewing= , you should see =0A> the ship =0A> > entering/exiting into/out the screen.= =0A> > =0A> > > I made then the matrix multiplications, and took the result= to =0A> > > sgCoord.=0A> > > Is this right approach? Ok it works, but it w= orths?=0A> > =0A> > You don't specify what you do with sgCoord stigma after= the =0A> last set. =0A> > If you need to move it I assume your ship is a= =0A> > =0A> > ssgTransform *ship;=0A> > =0A> > So you'll probably call=0A> = > =0A> > ship->setTransform( /* sgCoord* */ stigma ); // one of =0A> the = several =0A> > ship->forms=0A> > to set a xform=0A> > =0A> > =0A> > Alterna= tively I could have done this way:=0A> > =0A> > void move_ship( ssgTransfor= m *ship )=0A> > {=0A> > sgMat4 ship_xform;=0A> > ship->getTransform( sh= ip_xform );=0A> > sgVec3 ship_pos =3D { 0, getSpeed(), 0 }; // don't kno= w if =0A> getSpeed =0A> > is directly callable, or an object method=0A> > = sgAddVec3( ship_xform[3], ship_pos ); // just increment =0A> > the posi= tion=0A> > coords, resembles sgMultMat4 for the translation part only=0A> >= ship->setTransform( ship_xform ); // set the updated =0A> > matri= x back to=0A> > the object=0A> > }=0A> > =0A> > Greetings,=0A> > =0A> > Pao= lo Leoncini=0A> > =0A> > =0A> > -------------------------------------------= -------------------=0A> > -----------=0A> > This SF.net email is sponsored = by: Splunk Inc.=0A> > Still grepping through log files to find problems? S= top.=0A> > Now Search log events and configuration files using AJAX and a = =0A> > browser.=0A> > Download your FREE copy of Splunk now >> http://get.s= plunk.com/ =0A> > _______________________________________________=0A> > pli= b-users mailing list=0A> > pli...@li...=0A> > https://l= ists.sourceforge.net/lists/listinfo/plib-users=0A> > =0A> > =0A> > =0A> > = =0A> > =0A> > =0A> > _______________________________________________= _______________=0A> > ______________________=0A> > Take the Internet to Go:= Yahoo!Go puts the Internet in your=0A> > pocket: mail, news, photos & more= . =0A> > http://mobile.yahoo.com/go?refer=3D1GNXIC=0A> > =0A> > -----------= ---------------------------------------------------=0A> > -----------=0A> >= This SF.net email is sponsored by: Splunk Inc.=0A> > Still grepping throug= h log files to find problems? Stop.=0A> > Now Search log events and config= uration files using AJAX and a =0A> > browser.=0A> > Download your FREE cop= y of Splunk now >> http://get.splunk.com/ =0A> > __________________________= _____________________=0A> > plib-users mailing list=0A> > plib-users@lists.= sourceforge.net=0A> > https://lists.sourceforge.net/lists/listinfo/plib-use= rs=0A> > =0A> =0A> =0A> ---------------------------------------------------= -----------=0A> -----------=0A> This SF.net email is sponsored by: Splunk I= nc.=0A> Still grepping through log files to find problems? Stop.=0A> Now S= earch log events and configuration files using AJAX and =0A> a browser.=0A>= Download your FREE copy of Splunk now >> http://get.splunk.com/=0A> _____= __________________________________________=0A> plib-users mailing list=0A> = pli...@li...=0A> https://lists.sourceforge.net/lists/li= stinfo/plib-users=0A> =0A> =0A> =0A> =0A> =0A> =0A> _________________= _____________________________________________=0A> ______________________=0A= > Fussy? Opinionated? Impossible to please? Perfect. Join =0A> Yahoo!'s us= er panel and lay it on us. =0A> http://surveylink.yahoo.com/gmrs/yahoo_pane= l_invite.asp?a=3D7 =0A> =0A> =0A> -----------------------------------------= ---------------------=0A> -----------=0A> This SF.net email is sponsored by= : Splunk Inc.=0A> Still grepping through log files to find problems? Stop.= =0A> Now Search log events and configuration files using AJAX and =0A> a br= owser.=0A> Download your FREE copy of Splunk now >> http://get.splunk.com/= =0A> _______________________________________________=0A> plib-users mailing= list=0A> pli...@li...=0A> https://lists.sourceforge.ne= t/lists/listinfo/plib-users=0A> =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 configuration files using AJAX and a browser.= =0ADownload your FREE copy of Splunk now >> http://get.splunk.com/=0A_____= __________________________________________=0Aplib-users mailing list=0Aplib= -u...@li...=0Ahttps://lists.sourceforge.net/lists/listinfo= /plib-users=0A=0A=0A=0A=0A=0A ________________________________________= ____________________________________________=0APark yourself in front of a = world of choices in alternative vehicles. Visit the Yahoo! Auto Green Cente= r.=0Ahttp://autos.yahoo.com/green_center/ |
From: Paolo L. <p.l...@ci...> - 2007-07-25 11:51:43
|
Dimistris,=20 > -----Messaggio originale----- > Da: pli...@li...=20 > [mailto:pli...@li...] Per conto=20 > di Dimitris Mexis > Inviato: mercoled=EC 25 luglio 2007 12.39 > A: PLIB Users > Oggetto: Re: [Plib-users] R: R: Matrices and sgCoord >=20 > No there was not in your code but in plib I have found these=20 > functions and I don't understand them : > void orthoXform ( sgMat4 m ) in Sphere code, and in sg.h > void sgXformVec3 ( sgVec3 dst, sgMat4 mat ) ; > void sgXformVec3 ( sgVec3 dst, sgVec3 src, sgMat4 mat ) ; >=20 > void sgXformPnt3 ( sgVec3 dst, sgMat4 mat ) ; > void sgXformPnt3 ( sgVec3 dst, sgVec3 src, sgMat4 mat ) ; >=20 > void sgFullXformPnt3 ( sgVec3 dst, sgMat4 mat ) ; void=20 > sgFullXformPnt3 ( sgVec3 dst, sgVec3 src, sgMat4 mat ) ; >=20 > void sgXformVec4 ( sgVec4 dst, sgMat4 mat ) ; > void sgXformVec4 ( sgVec4 dst, sgVec4 src, sgMat4 mat ) ; >=20 > void sgXformPnt4 ( sgVec4 dst, sgMat4 mat ) ; > void sgXformPnt4 ( sgVec4 dst, sgVec4 src, sgMat4 mat ) ; >=20 > void sgFullXformPnt4 ( sgVec4 dst, sgMat4 mat ) ; void=20 > sgFullXformPnt4 ( sgVec4 dst, sgVec4 src, sgMat4 mat ) ; >=20 > ????? Ok, these are all functions, not class methods. Just try to read = 'transform' in place of 'xform', and you'll get a plenty of ways to transform a = point or a vector, 3- or 4-dims, by a transformation matrix. For example, sgXformVec3 will multiply a sgVec3 by the 3x3 rotation = section of a sgMat4, whilst sgXformPnt3 does what sgXformVec3 does + adds the matrix's translation row to the resuling vector (i.e. treats it as an = actual 'point'). The 'Full' versions transform vecs and pnts 'homogeneously'. Paolo > ----- Original Message ---- > From: Paolo Leoncini <p.l...@ci...> > To: PLIB Users <pli...@li...> > Sent: Wednesday, July 25, 2007 1:30:17 PM > Subject: [Plib-users] R: R: Matrices and sgCoord >=20 > Dimitris,=20 >=20 > > -----Messaggio originale----- > > Da: pli...@li... > > [mailto:pli...@li...] Per conto di=20 > > Dimitris Mexis > > Inviato: mercoled=EC 25 luglio 2007 11.47 > > A: PLIB Users > > Oggetto: Re: [Plib-users] R: Matrices and sgCoord > >=20 > > Thank you Paolo, for the clarification, so it is right to=20 > handle the=20 > > last row, and it wasn't accident. > > I liked your second option of working with the coords. > > By the way...What is an xform? What do the function do in=20 > plib about=20 > > sgxform*? > > They are not matrices right? ( plib has sgMat for them...no?) >=20 > 'xform' is a way 3D graphics programmers use to refer to=20 > 2D/3D transformations in variable names ('x' stands for=20 > 'trans'). There should be also a class method in SG (IIRC=20 > XformVec3 and XformPnt) with this prefix. > Using it makes me feeling a very english/american 3D programmer. >=20 > There's no sgxform in the code I wrote, unless an error were=20 > introduced when the e-mail systems formatted my message. >=20 > > Thank you >=20 > Greetings, >=20 > Paolo >=20 >=20 > > ----- Original Message ---- > > From: Paolo Leoncini <p.l...@ci...> > > To: PLIB Users <pli...@li...> > > Sent: Wednesday, July 25, 2007 12:33:55 PM > > Subject: [Plib-users] R: Matrices and sgCoord > >=20 > > Dimitris, > >=20 > > > -----Messaggio originale----- > > > Da: pli...@li... > > > [mailto:pli...@li...] Per conto di=20 > > > Dimitris Mexis > > > Inviato: marted=EC 24 luglio 2007 16.26 > > > A: pli...@li... > > > Oggetto: [Plib-users] Matrices and sgCoord > > >=20 > > > The following code has been a success in order to make the > > object move > > > at a constant speed. > > >=20 > > > sgCoord stigma; > > >=20 > > > void GLObject::setStigma( sgMat4 & objDst){ > > > sgSetCoord( & stigma, objDst); > > > } > > >=20 > > > 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); > > >=20 > > > What I don;t understand is that I took the usual matrix=20 > and instead=20 > > > 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? > >=20 > > I hope to have understood correctly your perplexity. > >=20 > > First, SSG has a different coord reference system wrt OpenGL.=20 > > Both have the same handness, so x+ is along right in both,=20 > yet OpenGL=20 > > is y+ -up, z+ -going outside the screen, whilst SSG is z+ -up, y+=20 > > -going into the screen. > >=20 > > Second, SG's sgMat4 is a 4x4 homogeneous matrix for specifying=20 > > projection, viewing, modelling and/or object position. For old,=20 > > nostalgic programmers, it's a-la-IrisGL. > > The fourth row is the translation. > >=20 > > Then, when your ship moves on the sea plane, it actually=20 > moves on the=20 > > x-y plane (z=3D0), and hence elements of a sgMat4 ship_xform=20 > to change=20 > > are ship_xform [3][0], ship_xform[3][1] (ship_xform[3] can=20 > be pointed=20 > > to by a > > sgVec3 to set a transformation vector xyz). > >=20 > > That's the reason why you put getSpeed() for setting=20 > > RotateMatrix[3][1]. In a un-rotated viewing, you should see=20 > the ship=20 > > entering/exiting into/out the screen. > >=20 > > > I made then the matrix multiplications, and took the result to=20 > > > sgCoord. > > > Is this right approach? Ok it works, but it worths? > >=20 > > You don't specify what you do with sgCoord stigma after the=20 > last set.=20 > > If you need to move it I assume your ship is a > >=20 > > ssgTransform *ship; > >=20 > > So you'll probably call > >=20 > > ship->setTransform( /* sgCoord* */ stigma ); // one of=20 > the several=20 > > ship->forms > > to set a xform > >=20 > >=20 > > Alternatively I could have done this way: > >=20 > > void move_ship( ssgTransform *ship ) > > { > > sgMat4 ship_xform; > > ship->getTransform( ship_xform ); > > sgVec3 ship_pos =3D { 0, getSpeed(), 0 }; // don't know if=20 > getSpeed=20 > > is directly callable, or an object method > > sgAddVec3( ship_xform[3], ship_pos ); // just increment=20 > > the position > > coords, resembles sgMultMat4 for the translation part only > > ship->setTransform( ship_xform ); // set the updated=20 > > matrix back to > > the object > > } > >=20 > > Greetings, > >=20 > > Paolo Leoncini > >=20 > >=20 > > -------------------------------------------------------------- > > ----------- > > 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=20 > > browser. > > Download your FREE copy of Splunk now >> http://get.splunk.com/=20 > > _______________________________________________ > > plib-users mailing list > > pli...@li... > > https://lists.sourceforge.net/lists/listinfo/plib-users > >=20 > >=20 > >=20 > >=20 > >=20 > > =20 > > ______________________________________________________________ > > ______________________ > > Take the Internet to Go: Yahoo!Go puts the Internet in your > > pocket: mail, news, photos & more.=20 > > http://mobile.yahoo.com/go?refer=3D1GNXIC > >=20 > > -------------------------------------------------------------- > > ----------- > > 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=20 > > browser. > > Download your FREE copy of Splunk now >> http://get.splunk.com/=20 > > _______________________________________________ > > plib-users mailing list > > pli...@li... > > https://lists.sourceforge.net/lists/listinfo/plib-users > >=20 >=20 >=20 > -------------------------------------------------------------- > ----------- > 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=20 > 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 >=20 >=20 >=20 >=20 > =20 > ______________________________________________________________ > ______________________ > Fussy? Opinionated? Impossible to please? Perfect. Join=20 > Yahoo!'s user panel and lay it on us.=20 > http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=3D7=20 >=20 >=20 > -------------------------------------------------------------- > ----------- > 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=20 > 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 |
From: Paolo L. <p.l...@ci...> - 2007-07-25 11:41:01
|
Dimitris,=20 > -----Messaggio originale----- > Da: pli...@li...=20 > [mailto:pli...@li...] Per conto=20 > di Dimitris Mexis > Inviato: luned=EC 23 luglio 2007 23.42 > A: pli...@li... > Oggetto: [Plib-users] Help for code that is not documented=20 > and is confusing > > [...] > > OR has anyone achieved to point and click an object ? This code works for picking an SSG node in a GLUT-based app (Project2d3d = and getPickedLeaf functions reported below): glutMouseFunc( mouseclick ); ... void mouseclick( int button, int state, int x, int y ) { if ( button =3D=3D GLUT_LEFT_BUTTON && !state ) { // pick only when = the left button is pressed float x3, y3, z3; if ( Project2d3d ( x, y, x3, y3, z3 ) ) { sgVec3 pick_pnt =3D {x3, y3, z3}; // pack them into a sgVec3 for use in getPickedLeaf ulSetError( UL_DEBUG, "picking point (%f,%f,%f)", x3, y3, z3 ); ssgEntityBinding *ebind =3D getPickedLeaf( pick_pnt, scene ); if ( ebind ) { // really picked a node // picked_entity is what the name says, ssgEntity *picked_entity =3D *(ebind->entity); // ebind->entity is a ssgEntity**, so setting it as ssgEntity* is handy = and more SSG-ish // *(ebind->nameOrPath) is its path along the scene graph, useful as far as it could not be unique! // make use of them ... } } } } ssgEntityBinding *getPickedEntity( sgVec3 center, ssgBranch *scene ) // // this function gets // - a 3D 'picked' point in the scene (typically returned by the = Project2d3d function), // - a scene graph root pointer, // and returns a pointer to ssgEntityBinding, which actually holds a (entity,path) pair for the picked node. // 'path' is useful when one wants the path to walk from the root to = reach that node, and it is not unique // (remember, it's a scene *graph*, not necessarily a tree, so a node = could have in general more than one parent) // { sgVec3 test_vec, cam_center, up =3D {0,0,1}; sgMat4 inv_cam_mat, cam_mat, _OpenGL2ssg; extern sgMat4 _ssgOpenGLAxisSwapMatrix; // defined in ssg.cxx // back to SSG coordinate system sgTransposeNegateMat4( _OpenGL2ssg, _ssgOpenGLAxisSwapMatrix ); ssgGetModelviewMatrix ( inv_cam_mat ); sgPostMultMat4( inv_cam_mat, _OpenGL2ssg ); // cam_mat is finally the current SSG camera sgTransposeNegateMat4( cam_mat, inv_cam_mat ); // rotate the world so to put the 'center' point at the center of the scene sgCopyVec3( cam_center, cam_mat[3] ); sgMakeLookAtMat4( cam_mat, cam_center, center, up ); // inv_cam_mat is reused here with a different meaning - it is now the inverse of cam_mat sgTransposeNegateMat4( inv_cam_mat, cam_mat ); sgSetVec3( test_vec, 0, 1, 0 ); static ssgLeaf *leaf; // its pointer must live outside the function call ssgHit *results, *hit; int num_hits =3D ssgLOS ( scene, test_vec, inv_cam_mat, &results ) ; if ( num_hits > 0 ) { float min_dst =3D -1000000.0f ; for ( int i =3D 0 ; i < num_hits ; i++ ) { ssgHit *h =3D &results [ i ] ; float dst =3D - h->plane[3] / h->plane[1]; if ( dst > 0 && dst < fabs(min_dst) ) { min_dst =3D dst; leaf =3D h->leaf; hit =3D h; } } if ( min_dst > 0 ) { static ssgEntityBinding ebind; static char path_string[1023], *name; strcpy( path_string, "" ); // ssgHit give us the node path for free, let's export it in string form for ( int i =3D 0; i < hit->getNumPathEntries(); i++ ) { strcat( path_string, "/" ); strcat( path_string, (name=3Dhit->getPathEntry(i)->getName()) ? name : "" ); } ebind.entity =3D (ssgEntity**)&leaf; ebind.nameOrPath =3D path_string; return &ebind; } } return NULL; } // Project2d3d is the function which will transform 2d into 3d = coordinates: int Project2d3d ( int x2, int y2, float& x3, float& y3, float& z3 ) { GLint viewport[4] ; GLdouble modvmatrix[16], projmatrix[16] ; glGetIntegerv ( GL_VIEWPORT, viewport ) ; /* OpenGL y starts at lower left, X/Windows y starts at top left */ GLdouble y2gl =3D viewport[3] - y2 ; /* Update the Modelview and Projectionmatrix */ glMatrixMode ( GL_MODELVIEW ) ; ssgLoadModelviewMatrix () ; glMatrixMode ( GL_PROJECTION ) ; ssgLoadProjectionMatrix () ; /* Use GL power to find the depth of the projection */ GLfloat z2 ; glReadPixels ( x2, y2gl, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &z2 ) ; if ( z2 >=3D 1 ) return 0; /* Some more GL magic. Get the projection and modelview matrices */ glGetDoublev ( GL_MODELVIEW_MATRIX, modvmatrix ) ; glGetDoublev ( GL_PROJECTION_MATRIX, projmatrix ) ; GLdouble dx, dy, dz ; /* convert screen coords to object coords. */ int retcode =3D gluUnProject ( x2, y2gl, z2, modvmatrix, projmatrix, viewport, &dx, &dy, &dz ) ; x3 =3D dx ; y3 =3D dy ; z3 =3D dz ; return retcode; } > Crying for help... > Dimitris >=20 > Thank you Don't cry. Just ask. Greetings, Paolo Leoncini |
From: Dimitris M. <dm...@ya...> - 2007-07-25 10:38:43
|
No there was not in your code but in plib I have found these functions and = I don't understand them :=0Avoid orthoXform ( sgMat4 m ) in Sphere code,=0A= and=0Ain sg.h=0A void sgXformVec3 ( sgVec3 dst, sgMat4 mat ) ;=0A void = sgXformVec3 ( sgVec3 dst, sgVec3 src, sgMat4 mat ) ;=0A=0A void sgXform= Pnt3 ( sgVec3 dst, sgMat4 mat ) ;=0A void sgXformPnt3 ( sgVec3 dst,= sgVec3 src, sgMat4 mat ) ;=0A=0A void sgFullXformPnt3 ( sgVec3 dst, sgMat4= mat ) ;=0A void sgFullXformPnt3 ( sgVec3 dst, sgVec3 src, sgMat4 mat ) ;= =0A=0A void sgXformVec4 ( sgVec4 dst, sgMat4 mat ) ;=0A void sgXformVec= 4 ( sgVec4 dst, sgVec4 src, sgMat4 mat ) ;=0A=0A void sgXformPnt4 (= sgVec4 dst, sgMat4 mat ) ;=0A void sgXformPnt4 ( sgVec4 dst, sgVec4 sr= c, sgMat4 mat ) ;=0A=0A void sgFullXformPnt4 ( sgVec4 dst, sgMat4 mat ) ;= =0A void sgFullXformPnt4 ( sgVec4 dst, sgVec4 src, sgMat4 mat ) ;=0A=0A????= ?=0A=0A----- Original Message ----=0AFrom: Paolo Leoncini <p.leoncini@cira.= it>=0ATo: PLIB Users <pli...@li...>=0ASent: Wednesday, = July 25, 2007 1:30:17 PM=0ASubject: [Plib-users] R: R: Matrices and sgCoo= rd=0A=0ADimitris, =0A=0A> -----Messaggio originale-----=0A> Da: plib-users-= bo...@li... =0A> [mailto:pli...@li...urcef= orge.net] Per conto =0A> di Dimitris Mexis=0A> Inviato: mercoled=EC 25 lugl= io 2007 11.47=0A> A: PLIB Users=0A> Oggetto: Re: [Plib-users] R: Matrices a= nd sgCoord=0A> =0A> Thank you Paolo, for the clarification, so it is right = to =0A> handle the last row, and it wasn't accident.=0A> I liked your secon= d option of working with the coords.=0A> By the way...What is an xform? Wha= t do the function do in =0A> plib about sgxform*?=0A> They are not matrices= right? ( plib has sgMat for them...no?)=0A=0A'xform' is a way 3D graphics = programmers use to refer to 2D/3D=0Atransformations in variable names ('x' = stands for 'trans'). There should be=0Aalso a class method in SG (IIRC Xfor= mVec3 and XformPnt) with this prefix.=0AUsing it makes me feeling a very en= glish/american 3D programmer.=0A=0AThere's no sgxform in the code I wrote, = unless an error were introduced when=0Athe e-mail systems formatted my mess= age.=0A=0A> Thank you=0A=0AGreetings,=0A=0APaolo=0A=0A=0A> ----- Original M= essage ----=0A> From: Paolo Leoncini <p.l...@ci...>=0A> To: PLIB User= s <pli...@li...>=0A> Sent: Wednesday, July 25, 2007 12:= 33:55 PM=0A> Subject: [Plib-users] R: Matrices and sgCoord=0A> =0A> Dimitr= is,=0A> =0A> > -----Messaggio originale-----=0A> > Da: plib-users-bounces@l= ists.sourceforge.net=0A> > [mailto:pli...@li...= ] Per conto di =0A> > Dimitris Mexis=0A> > Inviato: marted=EC 24 luglio 200= 7 16.26=0A> > A: pli...@li...=0A> > Oggetto: [Plib-user= s] Matrices and sgCoord=0A> > =0A> > The following code has been a success = in order to make the =0A> object move =0A> > at a constant speed.=0A> > =0A= > > sgCoord stigma;=0A> > =0A> > void GLObject::setStigma( sgMat4 & objDst)= {=0A> > sgSetCoord( & stigma, objDst);=0A> > }=0A> > =0A> > GLObject::m= ove(){=0A> > //The rotation matrix for moving around trireme.=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> > =0A> > sgMakeCoordMat4( SHIPSRC, &trireme->getStigma()); = =0A> sgMultMat4( SHIPDST, =0A> > SHIPSRC, RotateMatrix); setStigma( SHIPDST= );=0A> > =0A> > What I don;t understand is that I took the usual matrix and= instead =0A> > tweaking the last column element by the second row, I =0A> = inversed it and =0A> > put the getSpeed() which is <>0 in the bottom row! W= hy? this?=0A> =0A> I hope to have understood correctly your perplexity.=0A>= =0A> First, SSG has a different coord reference system wrt OpenGL. =0A> Bo= th have the same handness, so x+ is along right in both, =0A> yet OpenGL is= y+ -up, z+ -going outside the screen, whilst =0A> SSG is z+ -up, y+ -going= into the screen.=0A> =0A> Second, SG's sgMat4 is a 4x4 homogeneous matrix = for =0A> specifying projection, viewing, modelling and/or object =0A> posit= ion. For old, nostalgic programmers, it's a-la-IrisGL. =0A> The fourth row = is the translation.=0A> =0A> Then, when your ship moves on the sea plane, i= t actually =0A> moves on the x-y plane (z=3D0), and hence elements of a sgM= at4 =0A> ship_xform to change are ship_xform [3][0], ship_xform[3][1] =0A> = (ship_xform[3] can be pointed to by a=0A> sgVec3 to set a transformation ve= ctor xyz).=0A> =0A> That's the reason why you put getSpeed() for setting = =0A> RotateMatrix[3][1]. In a un-rotated viewing, you should see =0A> the s= hip entering/exiting into/out the screen.=0A> =0A> > I made then the matrix= multiplications, and took the result to =0A> > sgCoord.=0A> > Is this righ= t approach? Ok it works, but it worths?=0A> =0A> You don't specify what you= do with sgCoord stigma after the =0A> last set. If you need to move it I a= ssume your ship is a =0A> =0A> ssgTransform *ship;=0A> =0A> So you'll proba= bly call=0A> =0A> ship->setTransform( /* sgCoord* */ stigma ); // one of = the several =0A> ship->forms=0A> to set a xform=0A> =0A> =0A> Alternatively= I could have done this way:=0A> =0A> void move_ship( ssgTransform *ship )= =0A> {=0A> sgMat4 ship_xform;=0A> ship->getTransform( ship_xform );=0A>= sgVec3 ship_pos =3D { 0, getSpeed(), 0 }; // don't know if =0A> getSpee= d is directly callable, or an object method=0A> sgAddVec3( ship_xform[3],= ship_pos ); // just increment =0A> the position=0A> coords, resembles s= gMultMat4 for the translation part only=0A> ship->setTransform( ship_xfor= m ); // set the updated =0A> matrix back to=0A> the object=0A> }=0A>= =0A> Greetings,=0A> =0A> Paolo Leoncini=0A> =0A> =0A> --------------------= ------------------------------------------=0A> -----------=0A> This SF.net = email is sponsored by: Splunk Inc.=0A> Still grepping through log files to = find problems? Stop.=0A> Now Search log events and configuration files usi= ng AJAX and =0A> a browser.=0A> Download your FREE copy of Splunk now >> = =0A> http://get.splunk.com/ _______________________________________________= =0A> plib-users mailing list=0A> pli...@li...=0A> https= ://lists.sourceforge.net/lists/listinfo/plib-users=0A> =0A> =0A> =0A> =0A> = =0A> =0A> __________________________________________________________= ____=0A> ______________________=0A> Take the Internet to Go: Yahoo!Go puts = the Internet in your =0A> pocket: mail, news, photos & more. =0A> http://mo= bile.yahoo.com/go?refer=3D1GNXIC=0A> =0A> ---------------------------------= -----------------------------=0A> -----------=0A> This SF.net email is spon= sored by: Splunk Inc.=0A> Still grepping through log files to find problems= ? Stop.=0A> Now Search log events and configuration files using AJAX and = =0A> a browser.=0A> Download your FREE copy of Splunk now >> =0A> http://g= et.splunk.com/ _______________________________________________=0A> plib-use= rs mailing list=0A> pli...@li...=0A> https://lists.sour= ceforge.net/lists/listinfo/plib-users=0A> =0A=0A=0A------------------------= -------------------------------------------------=0AThis SF.net email is sp= onsored by: Splunk Inc.=0AStill grepping through log files to find problems= ? Stop.=0ANow Search log events and configuration files using AJAX and a b= rowser.=0ADownload your FREE copy of Splunk now >> http://get.splunk.com/= =0A_______________________________________________=0Aplib-users mailing lis= t=0Ap...@li...=0Ahttps://lists.sourceforge.net/lists/= listinfo/plib-users=0A=0A=0A=0A=0A=0A ________________________________= ____________________________________________________=0AFussy? Opinionated? = Impossible to please? Perfect. Join Yahoo!'s user panel and lay it on us. = http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=3D7 =0A |
From: Paolo L. <p.l...@ci...> - 2007-07-25 10:30:36
|
Dimitris,=20 > -----Messaggio originale----- > Da: pli...@li...=20 > [mailto:pli...@li...] Per conto=20 > di Dimitris Mexis > Inviato: mercoled=EC 25 luglio 2007 11.47 > A: PLIB Users > Oggetto: Re: [Plib-users] R: Matrices and sgCoord >=20 > Thank you Paolo, for the clarification, so it is right to=20 > handle the last row, and it wasn't accident. > I liked your second option of working with the coords. > By the way...What is an xform? What do the function do in=20 > plib about sgxform*? > They are not matrices right? ( plib has sgMat for them...no?) 'xform' is a way 3D graphics programmers use to refer to 2D/3D transformations in variable names ('x' stands for 'trans'). There should = be also a class method in SG (IIRC XformVec3 and XformPnt) with this = prefix. Using it makes me feeling a very english/american 3D programmer. There's no sgxform in the code I wrote, unless an error were introduced = when the e-mail systems formatted my message. > Thank you Greetings, Paolo > ----- Original Message ---- > From: Paolo Leoncini <p.l...@ci...> > To: PLIB Users <pli...@li...> > Sent: Wednesday, July 25, 2007 12:33:55 PM > Subject: [Plib-users] R: Matrices and sgCoord >=20 > Dimitris, >=20 > > -----Messaggio originale----- > > Da: pli...@li... > > [mailto:pli...@li...] Per conto di=20 > > Dimitris Mexis > > Inviato: marted=EC 24 luglio 2007 16.26 > > A: pli...@li... > > Oggetto: [Plib-users] Matrices and sgCoord > >=20 > > The following code has been a success in order to make the=20 > object move=20 > > at a constant speed. > >=20 > > sgCoord stigma; > >=20 > > void GLObject::setStigma( sgMat4 & objDst){ > > sgSetCoord( & stigma, objDst); > > } > >=20 > > 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());=20 > sgMultMat4( SHIPDST,=20 > > SHIPSRC, RotateMatrix); setStigma( SHIPDST); > >=20 > > What I don;t understand is that I took the usual matrix and instead=20 > > tweaking the last column element by the second row, I=20 > inversed it and=20 > > put the getSpeed() which is <>0 in the bottom row! Why? this? >=20 > I hope to have understood correctly your perplexity. >=20 > First, SSG has a different coord reference system wrt OpenGL.=20 > Both have the same handness, so x+ is along right in both,=20 > yet OpenGL is y+ -up, z+ -going outside the screen, whilst=20 > SSG is z+ -up, y+ -going into the screen. >=20 > Second, SG's sgMat4 is a 4x4 homogeneous matrix for=20 > specifying projection, viewing, modelling and/or object=20 > position. For old, nostalgic programmers, it's a-la-IrisGL.=20 > The fourth row is the translation. >=20 > Then, when your ship moves on the sea plane, it actually=20 > moves on the x-y plane (z=3D0), and hence elements of a sgMat4=20 > ship_xform to change are ship_xform [3][0], ship_xform[3][1]=20 > (ship_xform[3] can be pointed to by a > sgVec3 to set a transformation vector xyz). >=20 > That's the reason why you put getSpeed() for setting=20 > RotateMatrix[3][1]. In a un-rotated viewing, you should see=20 > the ship entering/exiting into/out the screen. >=20 > > I made then the matrix multiplications, and took the result to=20 > > sgCoord. > > Is this right approach? Ok it works, but it worths? >=20 > You don't specify what you do with sgCoord stigma after the=20 > last set. If you need to move it I assume your ship is a=20 >=20 > ssgTransform *ship; >=20 > So you'll probably call >=20 > ship->setTransform( /* sgCoord* */ stigma ); // one of the several=20 > ship->forms > to set a xform >=20 >=20 > Alternatively I could have done this way: >=20 > void move_ship( ssgTransform *ship ) > { > sgMat4 ship_xform; > ship->getTransform( ship_xform ); > sgVec3 ship_pos =3D { 0, getSpeed(), 0 }; // don't know if=20 > getSpeed is directly callable, or an object method > sgAddVec3( ship_xform[3], ship_pos ); // just increment=20 > the position > coords, resembles sgMultMat4 for the translation part only > ship->setTransform( ship_xform ); // set the updated=20 > matrix back to > the object > } >=20 > Greetings, >=20 > Paolo Leoncini >=20 >=20 > -------------------------------------------------------------- > ----------- > 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=20 > a browser. > Download your FREE copy of Splunk now >> =20 > http://get.splunk.com/ _______________________________________________ > plib-users mailing list > pli...@li... > https://lists.sourceforge.net/lists/listinfo/plib-users >=20 >=20 >=20 >=20 >=20 > =20 > ______________________________________________________________ > ______________________ > Take the Internet to Go: Yahoo!Go puts the Internet in your=20 > pocket: mail, news, photos & more.=20 > http://mobile.yahoo.com/go?refer=3D1GNXIC >=20 > -------------------------------------------------------------- > ----------- > 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=20 > a browser. > Download your FREE copy of Splunk now >> =20 > http://get.splunk.com/ _______________________________________________ > plib-users mailing list > pli...@li... > https://lists.sourceforge.net/lists/listinfo/plib-users >=20 |
From: Dimitris M. <dm...@ya...> - 2007-07-25 09:47:05
|
Thank you Paolo, for the clarification, so it is right to handle the last r= ow, and it wasn't accident.=0AI liked your second option of working with th= e coords.=0ABy the way...What is an xform? What do the function do in plib = about sgxform*?=0AThey are not matrices right? ( plib has sgMat for them...= no?)=0A=0AThank you=0A=0A----- Original Message ----=0AFrom: Paolo Leoncini= <p.l...@ci...>=0ATo: PLIB Users <pli...@li...>= =0ASent: Wednesday, July 25, 2007 12:33:55 PM=0ASubject: [Plib-users] R: M= atrices and sgCoord=0A=0ADimitris,=0A=0A> -----Messaggio originale-----=0A>= Da: pli...@li... =0A> [mailto:plib-users-bounc= es...@li...] Per conto =0A> di Dimitris Mexis=0A> Inviato: mar= ted=EC 24 luglio 2007 16.26=0A> A: pli...@li...=0A> Ogg= etto: [Plib-users] Matrices and sgCoord=0A> =0A> The following code has bee= n a success in order to make the =0A> object move at a constant speed.=0A> = =0A> sgCoord stigma;=0A> =0A> void GLObject::setStigma( sgMat4 & objDst){= =0A> sgSetCoord( & stigma, objDst);=0A> }=0A> =0A> GLObject::move(){=0A= > //The rotation matrix for moving around trireme.=0A> sgMat4 Rotat= eMatrix =3D {=0A> 1, 0, 0, 0,=0A> 0, 1, 0, 0,=0A> = 0, 0, 1, 0,=0A> 0,( getSpeed()), 0, 1=0A> };=0A> =0A> sgMa= keCoordMat4( SHIPSRC, &trireme->getStigma()); sgMultMat4( =0A> SHIPDST, SHI= PSRC, RotateMatrix); setStigma( SHIPDST);=0A> =0A> What I don;t understand = is that I took the usual matrix and =0A> instead tweaking the last column e= lement by the second row, I =0A> inversed it and put the getSpeed() which i= s <>0 in the bottom =0A> row! Why? this?=0A=0AI hope to have understood cor= rectly your perplexity.=0A=0AFirst, SSG has a different coord reference sys= tem wrt OpenGL. Both have the=0Asame handness, so x+ is along right in both= , yet OpenGL is y+ -up, z+ -going=0Aoutside the screen, whilst SSG is z+ -u= p, y+ -going into the screen.=0A=0ASecond, SG's sgMat4 is a 4x4 homogeneous= matrix for specifying projection,=0Aviewing, modelling and/or object posit= ion. For old, nostalgic programmers,=0Ait's a-la-IrisGL. The fourth row is = the translation.=0A=0AThen, when your ship moves on the sea plane, it actua= lly moves on the x-y=0Aplane (z=3D0), and hence elements of a sgMat4 ship_x= form to change are=0Aship_xform [3][0], ship_xform[3][1] (ship_xform[3] can= be pointed to by a=0AsgVec3 to set a transformation vector xyz).=0A=0AThat= 's the reason why you put getSpeed() for setting RotateMatrix[3][1]. In=0Aa= un-rotated viewing, you should see the ship entering/exiting into/out the= =0Ascreen.=0A=0A> I made then the matrix multiplications, and took the resu= lt =0A> to sgCoord.=0A> Is this right approach? Ok it works, but it worths?= =0A=0AYou don't specify what you do with sgCoord stigma after the last set.= If you=0Aneed to move it I assume your ship is a =0A=0AssgTransform *ship;= =0A=0ASo you'll probably call=0A=0Aship->setTransform( /* sgCoord* */ stigm= a ); // one of the several forms=0Ato set a xform=0A=0A=0AAlternatively I= could have done this way:=0A=0Avoid move_ship( ssgTransform *ship )=0A{=0A= sgMat4 ship_xform;=0A ship->getTransform( ship_xform );=0A sgVec3 ship_= pos =3D { 0, getSpeed(), 0 }; // don't know if getSpeed is=0Adirectly call= able, or an object method=0A sgAddVec3( ship_xform[3], ship_pos ); // j= ust increment the position=0Acoords, resembles sgMultMat4 for the translati= on part only=0A ship->setTransform( ship_xform ); // set the update= d matrix back to=0Athe object=0A}=0A=0AGreetings,=0A=0APaolo Leoncini=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 configurati= on 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://li= sts.sourceforge.net/lists/listinfo/plib-users=0A=0A=0A=0A=0A=0A =0A__= ___________________________________________________________________________= _______=0ATake the Internet to Go: Yahoo!Go puts the Internet in your pocke= t: mail, news, photos & more. =0Ahttp://mobile.yahoo.com/go?refer=3D1GNXIC |
From: Paolo L. <p.l...@ci...> - 2007-07-25 09:34:18
|
Dimitris, > -----Messaggio originale----- > Da: pli...@li...=20 > [mailto:pli...@li...] Per conto=20 > di Dimitris Mexis > Inviato: marted=EC 24 luglio 2007 16.26 > A: pli...@li... > Oggetto: [Plib-users] Matrices and sgCoord >=20 > The following code has been a success in order to make the=20 > object move at a constant speed. >=20 > sgCoord stigma; >=20 > void GLObject::setStigma( sgMat4 & objDst){ > sgSetCoord( & stigma, objDst); > } >=20 > 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(=20 > SHIPDST, SHIPSRC, RotateMatrix); setStigma( SHIPDST); >=20 > What I don;t understand is that I took the usual matrix and=20 > instead tweaking the last column element by the second row, I=20 > inversed it and put the getSpeed() which is <>0 in the bottom=20 > row! Why? this? I hope to have understood correctly your perplexity. First, SSG has a different coord reference system wrt OpenGL. Both have = the same handness, so x+ is along right in both, yet OpenGL is y+ -up, z+ = -going outside the screen, whilst SSG is z+ -up, y+ -going into the screen. Second, SG's sgMat4 is a 4x4 homogeneous matrix for specifying = projection, viewing, modelling and/or object position. For old, nostalgic = programmers, it's a-la-IrisGL. The fourth row is the translation. Then, when your ship moves on the sea plane, it actually moves on the = x-y plane (z=3D0), and hence elements of a sgMat4 ship_xform to change are ship_xform [3][0], ship_xform[3][1] (ship_xform[3] can be pointed to by = a sgVec3 to set a transformation vector xyz). That's the reason why you put getSpeed() for setting RotateMatrix[3][1]. = In a un-rotated viewing, you should see the ship entering/exiting into/out = the screen. > I made then the matrix multiplications, and took the result=20 > to sgCoord. > Is this right approach? Ok it works, but it worths? You don't specify what you do with sgCoord stigma after the last set. If = you need to move it I assume your ship is a=20 ssgTransform *ship; So you'll probably call ship->setTransform( /* sgCoord* */ stigma ); // one of the several = forms to set a xform Alternatively I could have done this way: void move_ship( ssgTransform *ship ) { sgMat4 ship_xform; ship->getTransform( ship_xform ); sgVec3 ship_pos =3D { 0, getSpeed(), 0 }; // don't know if getSpeed = is directly callable, or an object method sgAddVec3( ship_xform[3], ship_pos ); // just increment the = position coords, resembles sgMultMat4 for the translation part only ship->setTransform( ship_xform ); // set the updated matrix = back to the object } Greetings, Paolo Leoncini |
From: Dimitris M. <dm...@ya...> - 2007-07-24 21:25:16
|
I think that PLib is certainly a fine job, and being so alive after so many= years prooves that this lib is to continue.=0AI do not understand why an e= ngine like this hadn't so far to deal seriously with the problem of picking= and selecting.=0AFor me is very essential a solution to find. How could I = choose among many ships on the battlefield what I want and look up statisti= cs for example? With a combobox ? ( I had this alternative thinking ;-) But= this is no way a game-spirit solution right? It's..desktop solution.=0A=0A= If in anycase, I can help I would love to help.=0A=0AP.S. Plib needs docume= ntation if it is to go on...my opinion...As far as I see, a lot of you peop= le from the list must be pros in the 3D area...So you have a plus against p= eople like me :-( so docs are necessary...even more I think...=0A=0A=0A----= - Original Message ----=0AFrom: Tinoshi Kitazawa <ti...@li...>=0ATo: = PLIB Users <pli...@li...>=0ASent: Wednesday, July 25, 2= 007 12:10:59 AM=0ASubject: Re: [Plib-users] Help for code that is not docum= ented and isconfusing=0A=0A=0A=0A=0A =0A=0AHello,=0A=0A=0A=0AI've been dea= ling with point picking using plib a lot for my thesis...=0AIt is a pain...= I needed to have some Sim City like scenario' s builder=0Afor my flight si= mulator (select an object, and place it on the 3d map=0Ajust clicking with = the mouse...), and even if now it works fine, I'm=0Asure it is not optimize= d at all... :-) If you think this would help,=0AI'll probably try to find t= he code and send it to you on your private=0Aemail... Let me know!=0A=0A=0A= =0AP.S. Do you think this object picking thing is something to include in= =0Athe plib? ssgObjectPicker or something like that, that takes mouse=0Acoo= rds and returns the closest object/point of the scene we are=0Apointing to?= Maybe it is considered an high level feature plib will=0Anever implement, = what do you think about it?=0A=0A=0A=0ADimitris Mexis ha scritto:=0A=0A sg= SetVec3( HOTvec, 0.0f, 0.0f, -my_position[2] + HOT_TOLERANCE )=0Aif you do = -my_position look like my_position and even if you have setup my_position[0= ] and [1] as non-negative numbers the object spins around z axis looking fr= om me to the distance far away.=0AIf you touch the minus sign in my_positio= n[0] and [1] only and let the minus in the sgSetVec3, all seems ok...=0ABiz= zare..isn't it?=0A=0A----- Original Message ----=0AFrom: Fay John F Dr CTR = USAF 46 SK <joh...@eg...>=0ATo: PLIB Users <plib-users@lists.s= ourceforge.net>=0ASent: Tuesday, July 24, 2007 11:10:45 PM=0ASubject: Re: [= Plib-users] Help for code that is not documented and isconfusing=0A=0ADimit= ris,=0A=0A If you downloaded the PLIB package, the PointPicker is in the= =0A"examples" directory. (I shouldn't have called it a "demo"; I always=0A= get those confused.)=0A=0A I do not know what you mean by the sentence t= hat starts "I tried=0Aalso to inverse the elements of this matrix inv[..]".= Did you change=0Athe signs on the translation parts or did you try to exc= hange the=0Aindices on the left-hand side of the equals sign? What results= did you=0Aget?=0A=0AJohn F. Fay=0ATechnical Fellow=0AJacobs Technology TEA= S Group=0A850-883-1294 =0A=0A-----Original Message-----=0AFrom: plib-users-= bo...@li...=0A[mailto:pli...@li...urceforg= e.net] On Behalf Of Dimitris=0AMexis=0ASent: Tuesday, July 24, 2007 2:57 PM= =0ATo: PLIB Users=0ASubject: Re: [Plib-users] Help for code that is not doc= umented and=0Aisconfusing=0A=0AYes you are right, about the division, and t= he assumptions you made have=0Aa meaning.=0AThe PointPicker? I don;t have t= his tutorial!!! Can you send it to me=0Aplz?=0AI tried also to inverse the = elements of this matrix inv[..], only those=0Aapart from [2]. Because if yo= u touch the [2] dimension=0Athe result is awful...=0A=0AWhat to say, I am v= ery thankfull for your help, John.=0A=0A----- Original Message ----=0AFrom:= Fay John F Dr CTR USAF 46 SK <joh...@eg...>=0ATo: PLIB Users = <pli...@li...>=0ASent: Tuesday, July 24, 2007 10:41:34 = PM=0ASubject: Re: [Plib-users] Help for code that is not documented and is= =0Aconfusing=0A=0ADimitris,=0A=0A A few more answers:=0A=0A The "= PointPicker" demo program in PUI has a "point and=0Aclick" capability to se= lect an object. You start the program, click=0Atwice in the gray input box= , and then right-click on one of the square=0A"points" in the main window. = When you first start the program you have=0Ato click twice in the input bo= x before trying to select a point, but=0Aafter the first time you only need= to click once; I do not know why this=0Ais. The selected point turns red = and its point number appears in the=0Ainput box.=0A=0A In your code = snippet, I do not know why the inverse=0Amatrix is being used. I think the= minus signs are related to the fact=0Athat it is an inverse matrix; the re= d book on page 478 gives the matrix=0Ain question. I also don't know wheth= er "hot" is "height of terrain" or=0A"height over terrain". In the first c= ase it would be the altitude of=0Athe terrain above some zero point; in the= second case it would be the=0Aheight of your point over the terrain. I do= know that "hgt" is short=0Afor "height". The "for ( int i" loop is steppi= ng through all the hits=0Areturned by the "ssgHOT" call and finding the one= with the greatest=0Aheight. Again, I'm not sure why the code sets " hgt = =3D - h->plane[3] /=0Ah->plane[2]" since using the homogeneous coordinates = (page 476 of the=0Ared book) I would expect " hgt =3D - h->plane[2] / h->pl= ane[3]".=0A=0AJohn F. Fay=0ATechnical Fellow=0AJacobs Technology TEAS Group= =0A850-883-1294 =0A=0A-----Original Message-----=0AFrom: plib-users-bounces= @lists.sourceforge.net=0A[mailto:pli...@li...] = On Behalf Of Dimitris=0AMexis=0ASent: Monday, July 23, 2007 4:42 PM=0ATo: p= lib...@li...=0ASubject: [Plib-users] Help for code that = is not documented and is=0Aconfusing=0A=0AHello people, I am trying to stud= y plib and do some tricks with it, I=0Afound code for doing things. No dice= nt documentation though. So=0Aeverything I tried I did it blindly....=0ACan= some one help me with the code snippets below ?=0A=0AFIRST :=0A=0A /* L= ook for the nearest polygon *beneath* my_position */=0A float HOT_TOLERA= NCE =3D 1.0f;=0A ssgHit *results;=0A int num_hits;=0A float hot; = /* H.O.T =3D=3D Height Of Terrain */=0A sgVec3 HOTvec;=0A sgMat4 invm= at;=0A sgMakeIdentMat4( invmat );=0A invmat[3][0] =3D - my_position[0= ];=0A invmat[3][1] =3D - my_position[1];=0A invmat[3][2] =3D 0.0f;=0A= =0A sgSetVec3( HOTvec, 0.0f, 0.0f, -my_position[2] + HOT_TOLERANCE=0A);/= /FIXME I don't know why I use minus here!!=0A num_hits =3D ssgHOT( scene= , HOTvec, invmat, &results );=0A hot =3D DEEPEST_HELL;=0A for ( int i= =3D 0; i < num_hits; i++ ) {=0A ssgHit *h =3D &results[i];=0A = float hgt =3D - h->plane[3] / h->plane[2];=0A if ( hgt >=3D hot ) = {=0A hot =3D hgt;=0A if ( normal !=3D NULL )=0A = sgCopyVec3( normal, h->plane );=0A }=0A }=0A return = hot;=0A}=0A=0ABesides the fact that I took as "global constant" the code, I= didn;t=0Aunderstand why the inverse matrix! ?=0AWhat is supposed to do ?= =0A=0Alower You see a FIXME, it is mine, and yes what does this line do ?= =0AIf I have a 3000polygon coming against 5000 polygons of another surface,= =0Athe for loop, goes all this around to seek the collition?=0AWhat is, rea= lly ssgHit, and the division with float hgt ?=0A=0ANext I want to ask about= the code in PPE about picking...To tell you the=0Atruth I read OpenGL book= about glLoadName* but I don't see how that=0Awould fit here when I load a = model and not drawing vertices....=0AHas anyone tried to draw something in = 3D from his mouse click? e.g. the=0Aray and try to intercect with the objec= ts in the scenery?=0AOR has anyone achieved to point and click an object ? = I haven't seen=0Acode to do that from plib...apart ppe, which ppe neither c= ompiles nor=0Ahas some remarks to understand it's stuff...=0A=0ACrying for = help...=0ADimitris=0A=0AThank you=0A=0A=0A=0A=0A =0A_________________= _______________________________________________________=0A____________=0AMo= ody friends. Drama queens. Your life? Nope! - their life, your story.=0APla= y Sims Stories at Yahoo! Games.=0Ahttp://sims.yahoo.com/ =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 configuration files us= ing AJAX and a browser.=0ADownload your FREE copy of Splunk now >> http://= get.splunk.com/=0A_______________________________________________=0Aplib-us= ers mailing list=0Ap...@li...=0Ahttps://lists.sourcef= orge.net/lists/listinfo/plib-users=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 configuration files using AJAX and a browser.= =0ADownload your FREE copy of Splunk now >> http://get.splunk.com/=0A_____= __________________________________________=0Aplib-users mailing list=0Aplib= -u...@li...=0Ahttps://lists.sourceforge.net/lists/listinfo= /plib-users=0A=0A=0A=0A=0A=0A =0A____________________________________= ____________________________________=0A____________=0ANeed a vacation? Get = great deals=0Ato amazing places on Yahoo! Travel.=0Ahttp://travel.yahoo.com= /=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 conf= iguration files using AJAX and a browser.=0ADownload your FREE copy of Splu= nk now >> http://get.splunk.com/=0A_______________________________________= ________=0Aplib-users mailing list=0Ap...@li...=0Ahtt= ps://lists.sourceforge.net/lists/listinfo/plib-users=0A=0A-----------------= --------------------------------------------------------=0AThis SF.net emai= l is sponsored by: Splunk Inc.=0AStill grepping through log files to find p= roblems? Stop.=0ANow Search log events and configuration files using AJAX = and a browser.=0ADownload your FREE copy of Splunk now >> http://get.splun= k.com/=0A_______________________________________________=0Aplib-users maili= ng list=0Ap...@li...=0Ahttps://lists.sourceforge.net/= lists/listinfo/plib-users=0A=0A=0A=0A=0A=0A =0A______________________= ______________________________________________________________=0ASick sense= of humor? Visit Yahoo! TV's =0AComedy with an Edge to see what's on, when.= =0Ahttp://tv.yahoo.com/collections/222=0A=0A------------------------------= -------------------------------------------=0AThis SF.net email is sponsore= d by: Splunk Inc.=0AStill grepping through log files to find problems? Sto= p.=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=0Apli= b-...@li...=0Ahttps://lists.sourceforge.net/lists/listinf= o/plib-users=0A=0A =0A=0A=0A=0A-- =0A=0AVisitate www.tinoshi.altervista.or= g!=0AOgni giorno nuove strip!!!=0A=0A=0A=0A=0A=0A=0A=0A =0A__________= __________________________________________________________________________= =0AYahoo! oneSearch: Finally, mobile search =0Athat gives answers, not web = links. =0Ahttp://mobile.yahoo.com/mobileweb/onesearch?refer=3D1ONXIC |
From: Tinoshi K. <ti...@li...> - 2007-07-24 21:10:48
|
Hello, I've been dealing with point picking using plib a lot for my thesis... It is a pain... I needed to have some Sim City like scenario' s builder for my flight simulator (select an object, and place it on the 3d map just clicking with the mouse...), and even if now it works fine, I'm sure it is not optimized at all... :-) If you think this would help, I'll probably try to find the code and send it to you on your private email... Let me know! P.S. Do you think this object picking thing is something to include in the plib? ssgObjectPicker or something like that, that takes mouse coords and returns the closest object/point of the scene we are pointing to? Maybe it is considered an high level feature plib will never implement, what do you think about it? Dimitris Mexis ha scritto: > sgSetVec3( HOTvec, 0.0f, 0.0f, -my_position[2] + HOT_TOLERANCE ) > if you do -my_position look like my_position and even if you have setup my_position[0] and [1] as non-negative numbers the object spins around z axis looking from me to the distance far away. > If you touch the minus sign in my_position[0] and [1] only and let the minus in the sgSetVec3, all seems ok... > Bizzare..isn't it? > > ----- Original Message ---- > From: Fay John F Dr CTR USAF 46 SK <joh...@eg...> > To: PLIB Users <pli...@li...> > Sent: Tuesday, July 24, 2007 11:10:45 PM > Subject: Re: [Plib-users] Help for code that is not documented and isconfusing > > Dimitris, > > If you downloaded the PLIB package, the PointPicker is in the > "examples" directory. (I shouldn't have called it a "demo"; I always > get those confused.) > > I do not know what you mean by the sentence that starts "I tried > also to inverse the elements of this matrix inv[..]". Did you change > the signs on the translation parts or did you try to exchange the > indices on the left-hand side of the equals sign? What results did you > get? > > John F. Fay > Technical Fellow > Jacobs Technology TEAS Group > 850-883-1294 > > -----Original Message----- > From: pli...@li... > [mailto:pli...@li...] On Behalf Of Dimitris > Mexis > Sent: Tuesday, July 24, 2007 2:57 PM > To: PLIB Users > Subject: Re: [Plib-users] Help for code that is not documented and > isconfusing > > Yes you are right, about the division, and the assumptions you made have > a meaning. > The PointPicker? I don;t have this tutorial!!! Can you send it to me > plz? > I tried also to inverse the elements of this matrix inv[..], only those > apart from [2]. Because if you touch the [2] dimension > the result is awful... > > What to say, I am very thankfull for your help, John. > > ----- Original Message ---- > From: Fay John F Dr CTR USAF 46 SK <joh...@eg...> > To: PLIB Users <pli...@li...> > Sent: Tuesday, July 24, 2007 10:41:34 PM > Subject: Re: [Plib-users] Help for code that is not documented and is > confusing > > Dimitris, > > A few more answers: > > The "PointPicker" demo program in PUI has a "point and > click" capability to select an object. You start the program, click > twice in the gray input box, and then right-click on one of the square > "points" in the main window. When you first start the program you have > to click twice in the input box before trying to select a point, but > after the first time you only need to click once; I do not know why this > is. The selected point turns red and its point number appears in the > input box. > > In your code snippet, I do not know why the inverse > matrix is being used. I think the minus signs are related to the fact > that it is an inverse matrix; the red book on page 478 gives the matrix > in question. I also don't know whether "hot" is "height of terrain" or > "height over terrain". In the first case it would be the altitude of > the terrain above some zero point; in the second case it would be the > height of your point over the terrain. I do know that "hgt" is short > for "height". The "for ( int i" loop is stepping through all the hits > returned by the "ssgHOT" call and finding the one with the greatest > height. Again, I'm not sure why the code sets " hgt = - h->plane[3] / > h->plane[2]" since using the homogeneous coordinates (page 476 of the > red book) I would expect " hgt = - h->plane[2] / h->plane[3]". > > John F. Fay > Technical Fellow > Jacobs Technology TEAS Group > 850-883-1294 > > -----Original Message----- > From: pli...@li... > [mailto:pli...@li...] On Behalf Of Dimitris > Mexis > Sent: Monday, July 23, 2007 4:42 PM > To: pli...@li... > Subject: [Plib-users] Help for code that is not documented and is > confusing > > Hello people, I am trying to study plib and do some tricks with it, I > found code for doing things. No dicent documentation though. So > everything I tried I did it blindly.... > Can some one help me with the code snippets below ? > > FIRST : > > /* Look for the nearest polygon *beneath* my_position */ > float HOT_TOLERANCE = 1.0f; > ssgHit *results; > int num_hits; > float hot; /* H.O.T == Height Of Terrain */ > sgVec3 HOTvec; > sgMat4 invmat; > sgMakeIdentMat4( invmat ); > invmat[3][0] = - my_position[0]; > invmat[3][1] = - my_position[1]; > invmat[3][2] = 0.0f; > > sgSetVec3( HOTvec, 0.0f, 0.0f, -my_position[2] + HOT_TOLERANCE > );//FIXME I don't know why I use minus here!! > num_hits = ssgHOT( scene, HOTvec, invmat, &results ); > hot = DEEPEST_HELL; > for ( int i = 0; i < num_hits; i++ ) { > ssgHit *h = &results[i]; > float hgt = - h->plane[3] / h->plane[2]; > if ( hgt >= hot ) { > hot = hgt; > if ( normal != NULL ) > sgCopyVec3( normal, h->plane ); > } > } > return hot; > } > > Besides the fact that I took as "global constant" the code, I didn;t > understand why the inverse matrix! ? > What is supposed to do ? > > lower You see a FIXME, it is mine, and yes what does this line do ? > If I have a 3000polygon coming against 5000 polygons of another surface, > the for loop, goes all this around to seek the collition? > What is, really ssgHit, and the division with float hgt ? > > Next I want to ask about the code in PPE about picking...To tell you the > truth I read OpenGL book about glLoadName* but I don't see how that > would fit here when I load a model and not drawing vertices.... > Has anyone tried to draw something in 3D from his mouse click? e.g. the > ray and try to intercect with the objects in the scenery? > OR has anyone achieved to point and click an object ? I haven't seen > code to do that from plib...apart ppe, which ppe neither compiles nor > has some remarks to understand it's stuff... > > Crying for help... > Dimitris > > Thank you > > > > > > ________________________________________________________________________ > ____________ > Moody friends. Drama queens. Your life? Nope! - their life, your story. > Play Sims Stories at Yahoo! Games. > http://sims.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 > > > > > > > ________________________________________________________________________ > ____________ > 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 > > > > > > > ____________________________________________________________________________________ > Sick sense of humor? Visit Yahoo! TV's > Comedy with an Edge to see what's on, when. > http://tv.yahoo.com/collections/222 > > ------------------------------------------------------------------------- > 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 > > -- Visitate *_www.tinoshi.altervista.org_* <http://www.tinoshi.altervista.org>! Ogni giorno nuove strip!!! |
From: Dimitris M. <dm...@ya...> - 2007-07-24 20:26:20
|
sgSetVec3( HOTvec, 0.0f, 0.0f, -my_position[2] + HOT_TOLERANCE )=0Aif you d= o -my_position look like my_position and even if you have setup my_position= [0] and [1] as non-negative numbers the object spins around z axis looking = from me to the distance far away.=0AIf you touch the minus sign in my_posit= ion[0] and [1] only and let the minus in the sgSetVec3, all seems ok...=0AB= izzare..isn't it?=0A=0A----- Original Message ----=0AFrom: Fay John F Dr CT= R USAF 46 SK <joh...@eg...>=0ATo: PLIB Users <plib-users@lists= .sourceforge.net>=0ASent: Tuesday, July 24, 2007 11:10:45 PM=0ASubject: Re:= [Plib-users] Help for code that is not documented and isconfusing=0A=0ADim= itris,=0A=0A If you downloaded the PLIB package, the PointPicker is in t= he=0A"examples" directory. (I shouldn't have called it a "demo"; I always= =0Aget those confused.)=0A=0A I do not know what you mean by the sentenc= e that starts "I tried=0Aalso to inverse the elements of this matrix inv[..= ]". Did you change=0Athe signs on the translation parts or did you try to = exchange the=0Aindices on the left-hand side of the equals sign? What resu= lts did you=0Aget?=0A=0AJohn F. Fay=0ATechnical Fellow=0AJacobs Technology = TEAS Group=0A850-883-1294 =0A=0A-----Original Message-----=0AFrom: plib-use= rs-...@li...=0A[mailto:pli...@li...urcef= orge.net] On Behalf Of Dimitris=0AMexis=0ASent: Tuesday, July 24, 2007 2:57= PM=0ATo: PLIB Users=0ASubject: Re: [Plib-users] Help for code that is not = documented and=0Aisconfusing=0A=0AYes you are right, about the division, an= d the assumptions you made have=0Aa meaning.=0AThe PointPicker? I don;t hav= e this tutorial!!! Can you send it to me=0Aplz?=0AI tried also to inverse t= he elements of this matrix inv[..], only those=0Aapart from [2]. Because if= you touch the [2] dimension=0Athe result is awful...=0A=0AWhat to say, I a= m very thankfull for your help, John.=0A=0A----- Original Message ----=0AFr= om: Fay John F Dr CTR USAF 46 SK <joh...@eg...>=0ATo: PLIB Use= rs <pli...@li...>=0ASent: Tuesday, July 24, 2007 10:41:= 34 PM=0ASubject: Re: [Plib-users] Help for code that is not documented and = is=0Aconfusing=0A=0ADimitris,=0A=0A A few more answers:=0A=0A The= "PointPicker" demo program in PUI has a "point and=0Aclick" capability to = select an object. You start the program, click=0Atwice in the gray input b= ox, and then right-click on one of the square=0A"points" in the main window= . When you first start the program you have=0Ato click twice in the input = box before trying to select a point, but=0Aafter the first time you only ne= ed to click once; I do not know why this=0Ais. The selected point turns re= d and its point number appears in the=0Ainput box.=0A=0A In your cod= e snippet, I do not know why the inverse=0Amatrix is being used. I think t= he minus signs are related to the fact=0Athat it is an inverse matrix; the = red book on page 478 gives the matrix=0Ain question. I also don't know whe= ther "hot" is "height of terrain" or=0A"height over terrain". In the first= case it would be the altitude of=0Athe terrain above some zero point; in t= he second case it would be the=0Aheight of your point over the terrain. I = do know that "hgt" is short=0Afor "height". The "for ( int i" loop is step= ping through all the hits=0Areturned by the "ssgHOT" call and finding the o= ne with the greatest=0Aheight. Again, I'm not sure why the code sets " hgt= =3D - h->plane[3] /=0Ah->plane[2]" since using the homogeneous coordinates= (page 476 of the=0Ared book) I would expect " hgt =3D - h->plane[2] / h->p= lane[3]".=0A=0AJohn F. Fay=0ATechnical Fellow=0AJacobs Technology TEAS Grou= p=0A850-883-1294 =0A=0A-----Original Message-----=0AFrom: plib-users-bounce= s...@li...=0A[mailto:pli...@li...]= On Behalf Of Dimitris=0AMexis=0ASent: Monday, July 23, 2007 4:42 PM=0ATo: = pli...@li...=0ASubject: [Plib-users] Help for code that= is not documented and is=0Aconfusing=0A=0AHello people, I am trying to stu= dy plib and do some tricks with it, I=0Afound code for doing things. No dic= ent documentation though. So=0Aeverything I tried I did it blindly....=0ACa= n some one help me with the code snippets below ?=0A=0AFIRST :=0A=0A /* = Look for the nearest polygon *beneath* my_position */=0A float HOT_TOLER= ANCE =3D 1.0f;=0A ssgHit *results;=0A int num_hits;=0A float hot; = /* H.O.T =3D=3D Height Of Terrain */=0A sgVec3 HOTvec;=0A sgMat4 inv= mat;=0A sgMakeIdentMat4( invmat );=0A invmat[3][0] =3D - my_position[= 0];=0A invmat[3][1] =3D - my_position[1];=0A invmat[3][2] =3D 0.0f;= =0A=0A sgSetVec3( HOTvec, 0.0f, 0.0f, -my_position[2] + HOT_TOLERANCE=0A= );//FIXME I don't know why I use minus here!!=0A num_hits =3D ssgHOT( sc= ene, HOTvec, invmat, &results );=0A hot =3D DEEPEST_HELL;=0A for ( in= t i =3D 0; i < num_hits; i++ ) {=0A ssgHit *h =3D &results[i];=0A = float hgt =3D - h->plane[3] / h->plane[2];=0A if ( hgt >=3D hot= ) {=0A hot =3D hgt;=0A if ( normal !=3D NULL )=0A = sgCopyVec3( normal, h->plane );=0A }=0A }=0A retu= rn hot;=0A}=0A=0ABesides the fact that I took as "global constant" the code= , I didn;t=0Aunderstand why the inverse matrix! ?=0AWhat is supposed to do = ?=0A=0Alower You see a FIXME, it is mine, and yes what does this line do ?= =0AIf I have a 3000polygon coming against 5000 polygons of another surface,= =0Athe for loop, goes all this around to seek the collition?=0AWhat is, rea= lly ssgHit, and the division with float hgt ?=0A=0ANext I want to ask about= the code in PPE about picking...To tell you the=0Atruth I read OpenGL book= about glLoadName* but I don't see how that=0Awould fit here when I load a = model and not drawing vertices....=0AHas anyone tried to draw something in = 3D from his mouse click? e.g. the=0Aray and try to intercect with the objec= ts in the scenery?=0AOR has anyone achieved to point and click an object ? = I haven't seen=0Acode to do that from plib...apart ppe, which ppe neither c= ompiles nor=0Ahas some remarks to understand it's stuff...=0A=0ACrying for = help...=0ADimitris=0A=0AThank you=0A=0A=0A=0A=0A =0A_________________= _______________________________________________________=0A____________=0AMo= ody friends. Drama queens. Your life? Nope! - their life, your story.=0APla= y Sims Stories at Yahoo! Games.=0Ahttp://sims.yahoo.com/ =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 configuration files us= ing AJAX and a browser.=0ADownload your FREE copy of Splunk now >> http://= get.splunk.com/=0A_______________________________________________=0Aplib-us= ers mailing list=0Ap...@li...=0Ahttps://lists.sourcef= orge.net/lists/listinfo/plib-users=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 configuration files using AJAX and a browser.= =0ADownload your FREE copy of Splunk now >> http://get.splunk.com/=0A_____= __________________________________________=0Aplib-users mailing list=0Aplib= -u...@li...=0Ahttps://lists.sourceforge.net/lists/listinfo= /plib-users=0A=0A=0A=0A=0A=0A =0A____________________________________= ____________________________________=0A____________=0ANeed a vacation? Get = great deals=0Ato amazing places on Yahoo! Travel.=0Ahttp://travel.yahoo.com= /=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 conf= iguration files using AJAX and a browser.=0ADownload your FREE copy of Splu= nk now >> http://get.splunk.com/=0A_______________________________________= ________=0Aplib-users mailing list=0Ap...@li...=0Ahtt= ps://lists.sourceforge.net/lists/listinfo/plib-users=0A=0A-----------------= --------------------------------------------------------=0AThis SF.net emai= l is sponsored by: Splunk Inc.=0AStill grepping through log files to find p= roblems? Stop.=0ANow Search log events and configuration files using AJAX = and a browser.=0ADownload your FREE copy of Splunk now >> http://get.splun= k.com/=0A_______________________________________________=0Aplib-users maili= ng list=0Ap...@li...=0Ahttps://lists.sourceforge.net/= lists/listinfo/plib-users=0A=0A=0A=0A=0A=0A =0A______________________= ______________________________________________________________=0ASick sense= of humor? Visit Yahoo! TV's =0AComedy with an Edge to see what's on, when.= =0Ahttp://tv.yahoo.com/collections/222 |
From: Fay J. F Dr C. U. 46 S. <joh...@eg...> - 2007-07-24 20:10:56
|
Dimitris, If you downloaded the PLIB package, the PointPicker is in the "examples" directory. (I shouldn't have called it a "demo"; I always get those confused.) I do not know what you mean by the sentence that starts "I tried also to inverse the elements of this matrix inv[..]". Did you change the signs on the translation parts or did you try to exchange the indices on the left-hand side of the equals sign? What results did you get? 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 2:57 PM To: PLIB Users Subject: Re: [Plib-users] Help for code that is not documented and isconfusing Yes you are right, about the division, and the assumptions you made have a meaning. The PointPicker? I don;t have this tutorial!!! Can you send it to me plz? I tried also to inverse the elements of this matrix inv[..], only those apart from [2]. Because if you touch the [2] dimension the result is awful... What to say, I am very thankfull for your help, John. ----- Original Message ---- From: Fay John F Dr CTR USAF 46 SK <joh...@eg...> To: PLIB Users <pli...@li...> Sent: Tuesday, July 24, 2007 10:41:34 PM Subject: Re: [Plib-users] Help for code that is not documented and is confusing Dimitris, A few more answers: The "PointPicker" demo program in PUI has a "point and click" capability to select an object. You start the program, click twice in the gray input box, and then right-click on one of the square "points" in the main window. When you first start the program you have to click twice in the input box before trying to select a point, but after the first time you only need to click once; I do not know why this is. The selected point turns red and its point number appears in the input box. In your code snippet, I do not know why the inverse matrix is being used. I think the minus signs are related to the fact that it is an inverse matrix; the red book on page 478 gives the matrix in question. I also don't know whether "hot" is "height of terrain" or "height over terrain". In the first case it would be the altitude of the terrain above some zero point; in the second case it would be the height of your point over the terrain. I do know that "hgt" is short for "height". The "for ( int i" loop is stepping through all the hits returned by the "ssgHOT" call and finding the one with the greatest height. Again, I'm not sure why the code sets " hgt =3D - h->plane[3] / h->plane[2]" since using the homogeneous coordinates (page 476 of the red book) I would expect " hgt =3D - h->plane[2] / h->plane[3]". 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: Monday, July 23, 2007 4:42 PM To: pli...@li... Subject: [Plib-users] Help for code that is not documented and is confusing Hello people, I am trying to study plib and do some tricks with it, I found code for doing things. No dicent documentation though. So everything I tried I did it blindly.... Can some one help me with the code snippets below ? FIRST : /* Look for the nearest polygon *beneath* my_position */ float HOT_TOLERANCE =3D 1.0f; ssgHit *results; int num_hits; float hot; /* H.O.T =3D=3D Height Of Terrain */ sgVec3 HOTvec; sgMat4 invmat; sgMakeIdentMat4( invmat ); invmat[3][0] =3D - my_position[0]; invmat[3][1] =3D - my_position[1]; invmat[3][2] =3D 0.0f; sgSetVec3( HOTvec, 0.0f, 0.0f, -my_position[2] + HOT_TOLERANCE );//FIXME I don't know why I use minus here!! num_hits =3D ssgHOT( scene, HOTvec, invmat, &results ); hot =3D DEEPEST_HELL; for ( int i =3D 0; i < num_hits; i++ ) { ssgHit *h =3D &results[i]; float hgt =3D - h->plane[3] / h->plane[2]; if ( hgt >=3D hot ) { hot =3D hgt; if ( normal !=3D NULL ) sgCopyVec3( normal, h->plane ); } } return hot; } Besides the fact that I took as "global constant" the code, I didn;t understand why the inverse matrix! ? What is supposed to do ? lower You see a FIXME, it is mine, and yes what does this line do ? If I have a 3000polygon coming against 5000 polygons of another surface, the for loop, goes all this around to seek the collition? What is, really ssgHit, and the division with float hgt ? Next I want to ask about the code in PPE about picking...To tell you the truth I read OpenGL book about glLoadName* but I don't see how that would fit here when I load a model and not drawing vertices.... Has anyone tried to draw something in 3D from his mouse click? e.g. the ray and try to intercect with the objects in the scenery? OR has anyone achieved to point and click an object ? I haven't seen code to do that from plib...apart ppe, which ppe neither compiles nor has some remarks to understand it's stuff... Crying for help... Dimitris Thank you =20 ________________________________________________________________________ ____________ Moody friends. Drama queens. Your life? Nope! - their life, your story. Play Sims Stories at Yahoo! Games. http://sims.yahoo.com/ =20 ------------------------------------------------------------------------ - 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 ________________________________________________________________________ ____________ 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 |
From: Dimitris M. <dm...@ya...> - 2007-07-24 20:05:54
|
No don't send it! I found it, I didn't know it was there :-) sorry=0A=0A=0A= =0A=0A =0A___________________________________________________________= _________________________=0AGet the Yahoo! toolbar and be alerted to new em= ail wherever you're surfing.=0Ahttp://new.toolbar.yahoo.com/toolbar/feature= s/mail/index.php |
From: Dimitris M. <dm...@ya...> - 2007-07-24 19:58:39
|
Yes you are right, about the division, and the assumptions you made have a = meaning.=0AThe PointPicker? I don;t have this tutorial!!! Can you send it t= o me plz?=0AI tried also to inverse the elements of this matrix inv[..], on= ly those apart from [2]. Because if you touch the [2] dimension=0Athe resul= t is awful...=0A=0AWhat to say, I am very thankfull for your help, John.=0A= =0A----- Original Message ----=0AFrom: Fay John F Dr CTR USAF 46 SK <john.f= ay...@eg...>=0ATo: PLIB Users <pli...@li...>=0A= Sent: Tuesday, July 24, 2007 10:41:34 PM=0ASubject: Re: [Plib-users] Help f= or code that is not documented and is confusing=0A=0ADimitris,=0A=0A A f= ew more answers:=0A=0A The "PointPicker" demo program in PUI has a "= point and=0Aclick" capability to select an object. You start the program, = click=0Atwice in the gray input box, and then right-click on one of the squ= are=0A"points" in the main window. When you first start the program you ha= ve=0Ato click twice in the input box before trying to select a point, but= =0Aafter the first time you only need to click once; I do not know why this= =0Ais. The selected point turns red and its point number appears in the=0A= input box.=0A=0A In your code snippet, I do not know why the inverse= =0Amatrix is being used. I think the minus signs are related to the fact= =0Athat it is an inverse matrix; the red book on page 478 gives the matrix= =0Ain question. I also don't know whether "hot" is "height of terrain" or= =0A"height over terrain". In the first case it would be the altitude of=0A= the terrain above some zero point; in the second case it would be the=0Ahei= ght of your point over the terrain. I do know that "hgt" is short=0Afor "h= eight". The "for ( int i" loop is stepping through all the hits=0Areturned= by the "ssgHOT" call and finding the one with the greatest=0Aheight. Agai= n, I'm not sure why the code sets " hgt =3D - h->plane[3] /=0Ah->plane[2]" = since using the homogeneous coordinates (page 476 of the=0Ared book) I woul= d expect " hgt =3D - h->plane[2] / h->plane[3]".=0A=0AJohn F. Fay=0ATechnic= al Fellow=0AJacobs Technology TEAS Group=0A850-883-1294 =0A=0A-----Original= Message-----=0AFrom: pli...@li...=0A[mailto:pl= ib-...@li...] On Behalf Of Dimitris=0AMexis=0ASen= t: Monday, July 23, 2007 4:42 PM=0ATo: pli...@li...=0AS= ubject: [Plib-users] Help for code that is not documented and is=0Aconfusin= g=0A=0AHello people, I am trying to study plib and do some tricks with it, = I=0Afound code for doing things. No dicent documentation though. So=0Aevery= thing I tried I did it blindly....=0ACan some one help me with the code sni= ppets below ?=0A=0AFIRST :=0A=0A /* Look for the nearest polygon *beneat= h* my_position */=0A float HOT_TOLERANCE =3D 1.0f;=0A ssgHit *results= ;=0A int num_hits;=0A float hot; /* H.O.T =3D=3D Height Of Terrain *= /=0A sgVec3 HOTvec;=0A sgMat4 invmat;=0A sgMakeIdentMat4( invmat )= ;=0A invmat[3][0] =3D - my_position[0];=0A invmat[3][1] =3D - my_posi= tion[1];=0A invmat[3][2] =3D 0.0f;=0A=0A sgSetVec3( HOTvec, 0.0f, 0.0= f, -my_position[2] + HOT_TOLERANCE=0A);//FIXME I don't know why I use minus= here!!=0A num_hits =3D ssgHOT( scene, HOTvec, invmat, &results );=0A = hot =3D DEEPEST_HELL;=0A for ( int i =3D 0; i < num_hits; i++ ) {=0A = ssgHit *h =3D &results[i];=0A float hgt =3D - h->plane[3] / h->= plane[2];=0A if ( hgt >=3D hot ) {=0A hot =3D hgt;=0A = if ( normal !=3D NULL )=0A sgCopyVec3( normal, h->pl= ane );=0A }=0A }=0A return hot;=0A}=0A=0ABesides the fact that= I took as "global constant" the code, I didn;t=0Aunderstand why the invers= e matrix! ?=0AWhat is supposed to do ?=0A=0Alower You see a FIXME, it is mi= ne, and yes what does this line do ?=0AIf I have a 3000polygon coming again= st 5000 polygons of another surface,=0Athe for loop, goes all this around t= o seek the collition?=0AWhat is, really ssgHit, and the division with float= hgt ?=0A=0ANext I want to ask about the code in PPE about picking...To tel= l you the=0Atruth I read OpenGL book about glLoadName* but I don't see how = that=0Awould fit here when I load a model and not drawing vertices....=0AHa= s anyone tried to draw something in 3D from his mouse click? e.g. the=0Aray= and try to intercect with the objects in the scenery?=0AOR has anyone achi= eved to point and click an object ? I haven't seen=0Acode to do that from p= lib...apart ppe, which ppe neither compiles nor=0Ahas some remarks to under= stand it's stuff...=0A=0ACrying for help...=0ADimitris=0A=0AThank you=0A=0A= =0A=0A=0A =0A________________________________________________________= ________________=0A____________=0AMoody friends. Drama queens. Your life? N= ope! - their life, your story.=0APlay Sims Stories at Yahoo! Games.=0Ahttp:= //sims.yahoo.com/ =0A=0A--------------------------------------------------= ----------------------=0A-=0AThis SF.net email is sponsored by: Splunk Inc.= =0AStill grepping through log files to find problems? Stop.=0ANow Search l= og 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...u= rceforge.net=0Ahttps://lists.sourceforge.net/lists/listinfo/plib-users=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 configurati= on 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://li= sts.sourceforge.net/lists/listinfo/plib-users=0A=0A=0A=0A=0A=0A =0A__= ___________________________________________________________________________= _______=0ANeed a vacation? Get great deals=0Ato amazing places on Yahoo! Tr= avel.=0Ahttp://travel.yahoo.com/ |
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 |
From: Fay J. F Dr C. U. 46 S. <joh...@eg...> - 2007-07-24 19:41:40
|
Dimitris, A few more answers: The "PointPicker" demo program in PUI has a "point and click" capability to select an object. You start the program, click twice in the gray input box, and then right-click on one of the square "points" in the main window. When you first start the program you have to click twice in the input box before trying to select a point, but after the first time you only need to click once; I do not know why this is. The selected point turns red and its point number appears in the input box. In your code snippet, I do not know why the inverse matrix is being used. I think the minus signs are related to the fact that it is an inverse matrix; the red book on page 478 gives the matrix in question. I also don't know whether "hot" is "height of terrain" or "height over terrain". In the first case it would be the altitude of the terrain above some zero point; in the second case it would be the height of your point over the terrain. I do know that "hgt" is short for "height". The "for ( int i" loop is stepping through all the hits returned by the "ssgHOT" call and finding the one with the greatest height. Again, I'm not sure why the code sets " hgt =3D - h->plane[3] / h->plane[2]" since using the homogeneous coordinates (page 476 of the red book) I would expect " hgt =3D - h->plane[2] / h->plane[3]". 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: Monday, July 23, 2007 4:42 PM To: pli...@li... Subject: [Plib-users] Help for code that is not documented and is confusing Hello people, I am trying to study plib and do some tricks with it, I found code for doing things. No dicent documentation though. So everything I tried I did it blindly.... Can some one help me with the code snippets below ? FIRST : /* Look for the nearest polygon *beneath* my_position */ float HOT_TOLERANCE =3D 1.0f; ssgHit *results; int num_hits; float hot; /* H.O.T =3D=3D Height Of Terrain */ sgVec3 HOTvec; sgMat4 invmat; sgMakeIdentMat4( invmat ); invmat[3][0] =3D - my_position[0]; invmat[3][1] =3D - my_position[1]; invmat[3][2] =3D 0.0f; sgSetVec3( HOTvec, 0.0f, 0.0f, -my_position[2] + HOT_TOLERANCE );//FIXME I don't know why I use minus here!! num_hits =3D ssgHOT( scene, HOTvec, invmat, &results ); hot =3D DEEPEST_HELL; for ( int i =3D 0; i < num_hits; i++ ) { ssgHit *h =3D &results[i]; float hgt =3D - h->plane[3] / h->plane[2]; if ( hgt >=3D hot ) { hot =3D hgt; if ( normal !=3D NULL ) sgCopyVec3( normal, h->plane ); } } return hot; } Besides the fact that I took as "global constant" the code, I didn;t understand why the inverse matrix! ? What is supposed to do ? lower You see a FIXME, it is mine, and yes what does this line do ? If I have a 3000polygon coming against 5000 polygons of another surface, the for loop, goes all this around to seek the collition? What is, really ssgHit, and the division with float hgt ? Next I want to ask about the code in PPE about picking...To tell you the truth I read OpenGL book about glLoadName* but I don't see how that would fit here when I load a model and not drawing vertices.... Has anyone tried to draw something in 3D from his mouse click? e.g. the ray and try to intercect with the objects in the scenery? OR has anyone achieved to point and click an object ? I haven't seen code to do that from plib...apart ppe, which ppe neither compiles nor has some remarks to understand it's stuff... Crying for help... Dimitris Thank you =20 ________________________________________________________________________ ____________ Moody friends. Drama queens. Your life? Nope! - their life, your story. Play Sims Stories at Yahoo! Games. http://sims.yahoo.com/ =20 ------------------------------------------------------------------------ - 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 |
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 |
From: Dimitris M. <dm...@ya...> - 2007-07-24 18:26:48
|
>Dimitris,=0A=0A> Hello and welcome to the PLIB community. I didn't rep= ly to your=0A>first request because SSG is not my strong point.=0A=0AThank = you for the invitation in the PLIB community, and please tell me if by repl= ying to plib-users list I am ok with proper responding in the list.=0A=0A= =0A> If I may ask, are you writing a trireme simulation? If so, I=0A>invi= te you to look (if you haven't already) at the "Triereis" project.=0A>It us= es PLIB as well.=0A=0AEhm...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.=0AI did saw the project days ago(triereis), = but i didn't see any code.=0ALast I can't abandon Methos, it's an old proje= ct of me and it is a dream I wish to finish it up.=0A=0A=0A=0A> The ques= tion about the transformation matrix with "getSpeed" in=0A>the bottom row i= nstead of the last column is a tricky question for me.=0A>Just by doing the= mathematics, it seems to me that you are changing only=0A>the "w" coordina= te of the point (have you read the OpenGL "red book" on=0A=0AWhat exactly s= hould I read ? I have the red book borrowed from my uni, about 1.4 opengl.= =0ACan you give me a hint ? If i must look sth specifically...?=0A=0A>the s= ubject?), which would make the object move either directly towards=0A>or di= rectly away from the origin. Whether this is right or wrong I do=0A>not kn= ow without further study.=0A=0AWell neither do I feel strong in math :-) an= d I don't really know if it's right as algorithm...But it should as matrix = multiplication be workable enough.=0AIf you compile the code, you may see t= he results...Funny ones...=0A=0A>John F. Fay=0A>Technical Fellow=0A>Jacobs = Technology TEAS Group=0A>850-883-1294 =0A=0A-----Original Message-----=0AFr= om: pli...@li...=0A[mailto:plib-users-bounces@l= ists.sourceforge.net] On Behalf Of Dimitris=0AMexis=0ASent: Tuesday, July 2= 4, 2007 9:26 AM=0ATo: pli...@li...=0ASubject: [Plib-use= rs] Matrices and sgCoord=0A=0AThe following code has been a success in orde= r to make the object move=0Aat a constant speed.=0A=0AsgCoord stigma;=0A=0A= void GLObject::setStigma( sgMat4 & objDst){=0A sgSetCoord( & stigma, obj= Dst);=0A}=0A=0AGLObject::move(){=0A //The rotation matrix for moving aro= und trireme.=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= understand is that I took the usual matrix and instead=0Atweaking the last= column element by the second row,=0AI inversed it and put the getSpeed() w= hich is <>0 in the bottom row!=0AWhy? this?=0AI made then the matrix multip= lications, and took the result to sgCoord.=0AIs this right approach? Ok it = works, but it worths?=0A=0A=0A=0A=0A=0A =0A__________________________= ______________________________________________=0A____________=0ANeed a vaca= tion? Get great deals=0Ato amazing places on Yahoo! Travel.=0Ahttp://travel= .yahoo.com/=0A=0A----------------------------------------------------------= --------------=0A-=0AThis SF.net email is sponsored by: Splunk Inc.=0AStill= grepping through log files to find problems? Stop.=0ANow Search log event= s and configuration files using AJAX and a browser.=0ADownload your FREE co= py of Splunk now >> http://get.splunk.com/=0A_____________________________= __________________=0Aplib-users mailing list=0Ap...@li...urceforge= .net=0Ahttps://lists.sourceforge.net/lists/listinfo/plib-users=0A=0A-------= ------------------------------------------------------------------=0AThis S= F.net email is sponsored by: Splunk Inc.=0AStill grepping through log files= to find problems? Stop.=0ANow Search log events and configuration files u= sing AJAX and a browser.=0ADownload your FREE copy of Splunk now >> http:/= /get.splunk.com/=0A_______________________________________________=0Aplib-u= sers mailing list=0Ap...@li...=0Ahttps://lists.source= forge.net/lists/listinfo/plib-users=0A=0A=0A=0A=0A=0A =0A____________= ________________________________________________________________________=0A= Pinpoint customers who are looking for what you sell. =0Ahttp://searchmarke= ting.yahoo.com/ |
From: Fay J. F Dr C. U. 46 S. <joh...@eg...> - 2007-07-24 15:15:07
|
Dimitris, Hello and welcome to the PLIB community. I didn't reply to your first request because SSG is not my strong point. 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. 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 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. 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 |
From: Dimitris M. <dm...@ya...> - 2007-07-24 14:25:36
|
The following code has been a success in order to make the object move at a= constant speed.=0A=0AsgCoord stigma;=0A=0Avoid GLObject::setStigma( sgMat4= & objDst){=0A sgSetCoord( & stigma, objDst);=0A}=0A=0AGLObject::move(){= =0A //The rotation matrix for moving around trireme.=0A sgMat4 Rotate= Matrix =3D {=0A 1, 0, 0, 0,=0A 0, 1, 0, 0,=0A 0, 0, = 1, 0,=0A 0,( getSpeed()), 0, 1=0A };=0A =0AsgMakeCoordMat4( SH= IPSRC, &trireme->getStigma());=0AsgMultMat4( SHIPDST, SHIPSRC, RotateMatrix= );=0AsetStigma( SHIPDST);=0A=0AWhat I don;t understand is that I took the u= sual matrix and instead tweaking the last column element by the second row,= =0AI inversed it and put the getSpeed() which is <>0 in the bottom row! Why= ? this?=0AI made then the matrix multiplications, and took the result to sg= Coord.=0AIs this right approach? Ok it works, but it worths?=0A=0A=0A=0A=0A= =0A =0A______________________________________________________________= ______________________=0ANeed a vacation? Get great deals=0Ato amazing plac= es on Yahoo! Travel.=0Ahttp://travel.yahoo.com/ |
From: Dimitris M. <dm...@ya...> - 2007-07-23 21:41:53
|
Hello people, I am trying to study plib and do some tricks with it, I found= code for doing things. No dicent documentation though. So everything I tri= ed I did it blindly....=0ACan some one help me with the code snippets below= ?=0A=0AFIRST :=0A=0A /* Look for the nearest polygon *beneath* my_posit= ion */=0A float HOT_TOLERANCE =3D 1.0f;=0A ssgHit *results;=0A int= num_hits;=0A float hot; /* H.O.T =3D=3D Height Of Terrain */=0A sgV= ec3 HOTvec;=0A sgMat4 invmat;=0A sgMakeIdentMat4( invmat );=0A inv= mat[3][0] =3D - my_position[0];=0A invmat[3][1] =3D - my_position[1];=0A= invmat[3][2] =3D 0.0f;=0A=0A sgSetVec3( HOTvec, 0.0f, 0.0f, -my_posi= tion[2] + HOT_TOLERANCE );//FIXME I don't know why I use minus here!!=0A = num_hits =3D ssgHOT( scene, HOTvec, invmat, &results );=0A hot =3D DEEP= EST_HELL;=0A for ( int i =3D 0; i < num_hits; i++ ) {=0A ssgHit *= h =3D &results[i];=0A float hgt =3D - h->plane[3] / h->plane[2];=0A = if ( hgt >=3D hot ) {=0A hot =3D hgt;=0A if ( = normal !=3D NULL )=0A sgCopyVec3( normal, h->plane );=0A = }=0A }=0A return hot;=0A}=0A=0ABesides the fact that I took as "g= lobal constant" the code, I didn;t understand why the inverse matrix! ?=0AW= hat is supposed to do ?=0A=0Alower You see a FIXME, it is mine, and yes wha= t does this line do ?=0AIf I have a 3000polygon coming against 5000 polygon= s of another surface, the for loop, goes all this around to seek the collit= ion?=0AWhat is, really ssgHit, and the division with float hgt ?=0A=0ANext = I want to ask about the code in PPE about picking...To tell you the truth I= read OpenGL book about glLoadName* but I don't see how that would fit here= when I load a model and not drawing vertices....=0AHas anyone tried to dra= w something in 3D from his mouse click? e.g. the ray and try to intercect w= ith the objects in the scenery?=0AOR has anyone achieved to point and click= an object ? I haven't seen code to do that from plib...apart ppe, which pp= e neither compiles nor has some remarks to understand it's stuff...=0A=0ACr= ying for help...=0ADimitris=0A=0AThank you=0A=0A=0A=0A=0A =0A________= ___________________________________________________________________________= _=0AMoody friends. Drama queens. Your life? Nope! - their life, your story.= Play Sims Stories at Yahoo! Games.=0Ahttp://sims.yahoo.com/ |
From:
<coz...@gm...> - 2007-05-17 22:39:51
|
> I am trying to install plib-1.8.4 and I receive the following errors when= I > try to make: > > Making all in ssgAux > make[2]: Entering directory `/home/curtis/simulation/plib-1.8.4/src/ssgAu= x' > if g++ -DPACKAGE_NAME=3D\"\" -DPACKAGE_TARNAME=3D\"\" -DPACKAGE_VERSION= =3D\"\" > -DPACKAGE_STRING=3D\"\" -DPACKAGE_BUGREPORT=3D\"\" -DPACKAGE=3D\"plib\" > -DVERSION=3D\"1.8.4\" -DHAVE_LIBPTHREAD=3D1 -DHAVE_LIBGL=3D1 -DHAVE_LIBDL= =3D1 > -DSTDC_HEADERS=3D1 -DHAVE_SYS_TYPES_H=3D1 -DHAVE_SYS_STAT_H=3D1 -DHAVE_ST= DLIB_H=3D1 > -DHAVE_STRING_H=3D1 -DHAVE_MEMORY_H=3D1 -DHAVE_STRINGS_H=3D1 -DHAVE_INTTY= PES_H=3D1 > -DHAVE_STDINT_H=3D1 -DHAVE_UNISTD_H=3D1 -I. -I. -I../../src/sg -I../../s= rc/ssg > -I../../src/util -g -O2 -Wall -MT ssgaCelestialBody.o -MD -MP -MF > ".deps/ssgaCelestialBody.Tpo" -c -o ssgaCelestialBody.o > ssgaCelestialBody.cxx; \ > then mv -f ".deps/ssgaCelestialBody.Tpo" ".deps/ssgaCelestialBody.Po"; el= se > rm -f ".deps/ssgaCelestialBody.Tpo"; exit 1; fi > ssgaSky.h:107: error: extra qualification =E2ssgaCelestialBodyList::=E2 o= n > member =E2ssgaCelestialBodyList=E2 > ssgaSky.h:195: error: extra qualification =E2ssgaCloudLayerList::=E2 on m= ember > =E2ssgaCloudLayerList=E2 > make[2]: *** [ssgaCelestialBody.o] Error 1 > make[2]: Leaving directory `/home/curtis/simulation/plib-1.8.4/src/ssgAux= ' > make[1]: *** [all-recursive] Error 1 > make[1]: Leaving directory `/home/curtis/simulation/plib-1.8.4/src' > make: *** [all-recursive] Error 1 > > > Anyone know what I can do to fix this problem? *sigh* I don't want to seem rude, but please search the list before asking (I guess this should be in a FAQ or some doc though). Go to http://sourceforge.net/search/?ml_name=3Dplib-users&type_of_search=3D= mlists&group_id=3D382&words=3Dextra+qualification and check the search results. -Coz |