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