Intersection

New Message Reply Date view Thread view Subject view Author view

Marco Crocetta (onyx++at++datamat.it)
Fri, 10 Feb 95 11:58:55 MET


Hi,

I need some help for the following problem.

I need to know the true distance of the nearest part of a model in
my Performer scene (think about a laser rangefinder).
I thought that the easiest solution would be in using the
pfSegsIsectNode() call but as I tried a got some results that are
not clear...

This is a fragment of my code:

.....
/*Initialize default direction*/
segset.mode = PFTRAV_IS_PRIM|PFTRAV_IS_CULL_BACK;
pfSetVec3(segset.segs[0].dir, 0.0f, 1.0f, 0.0f);

/*Update direction following the eyepoint direction*/
pfSinCos(Shared->viewCoord.hpr[PF_H],&s,&c);
pfSetVec3(segset.segs[0].dir, -s, c, 0.0f);
segset.segs[0].length = 50000.0f;
isect = pfSegsIsectNode(Shared->scene, &segset, hits);
if (isect)
{

pfQueryHit (*hits[0], PFQHIT_SEG, &segset.segs[0].length);
pfQueryHit (*hits[0], PFQHIT_POINT, &pnt);
....

}

In my application the eyepoint is not moving (x,y,z are fixed) but
the entire scene is attached to a pfDCS that is modified at run-time
according to the eyepoint desidered motion.

These are the questions:

1) In the pnt vector I find the intersection point coords
   referred to the model origin ?
   (is this what the ref manual means when it says "...all are in
        local coordinates..."?)

2) Which distance is stored in the lenght field of the
   segset structure?i Which is the relationship between
   this value, the intersected point, the model origin, and
   the eyepoint origin?

3) How can I find in a straight manner the true distance
   of the intersected point from my eyepoint?

Thanks very much in advance!

--------------------------------
Marco Crocetta
DATAMAT SpA, Rome
e-mail:onyx++at++datamat.it
--------------------------------


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:50:57 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.