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