Re: [Plib-users] Help for code that is not documented and isconfusing
Brought to you by:
sjbaker
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!!! |