Olivier Georg (ogeorg++at++imtsg14.epfl.ch)
Wed, 1 Oct 1997 11:07:27 -0600
At first I thought that since the pfHit array passed to 'isect' is a 2D array,
a element of that array would correspond to one particular intersection of the
geode by one particular segment. But it seems like it doesn't work. So what's
the use of such an array ?... It looks like no-one knows...
Then I wrote a discriminator callback, returning PFTRAV_CONT, which stores the
hit into a user data:
--------------------------------------------------------------------------------
#define MAX_HITS_PER_SEG 10
struct SSegSetUserData
{
pfHit hits[MAX_HITS_PER_SEG];
int nbIsects;
};
int isectCallback(pfHit* hit)
{
SSegSetUserData *userData =
(SSegSetUserData*)hit->getUserData();
if (userData->nbIsects<MAX_HITS_PER_SEG) {
userData->hits[userData->nbIsects] = *hit;
userData->nbIsects++;
}
return PFTRAV_CONT;
}
--------------------------------------------------------------------------------
and the 'isect' routine is called using:
--------------------------------------------------------------------------------
pfHit **hits[1]; // [1] since there's only 1
seg.
SSegSetUserData userData;
userData.nbIsects = 0;
pfSegSet segSet;
segSet.mode = PFTRAV_IS_PRIM;
segSet.userData = (void*)&userData;
segSet.segs[0].pos = posTransf;
segSet.segs[0].dir = dirTransf;
segSet.segs[0].length = 20;
segSet.activeMask = 0x00000001; // = 0...01_2, or only 1st seg.
segSet.isectMask = 0xFFFFFFFF; // all the geosets in the
geode.
segSet.bound = NULL;
segSet.discFunc = isectCallback;
mOwner->GetGeode()->isect(&segSet, hits); // isect the seg. w/ the geode.
--------------------------------------------------------------------------------
The segment is correctly transformed so that it uses the same coordinates
system
as the geoset. Now the problem is that I have far too many intersections to be
discriminated in my callback. I get the 2 correct ones, but in addition, I also
get rubbish. And when checking the flags for the hit, performer tells me all
the hit being discriminated are ok...
Have I missed something ? I really need your help, 'cos this is a crucial
stage in my project.
Thanks for any help,
Olivier
--
--------------------------------------------------------------------
| Olivier Georg \__ e-mail: ogeorg++at++imt12.epfl.ch |
| Rte de Chailly 159 \__ home: http://imtsg7.epfl.ch/~ogeorg |
| 1814 La Tour-de-Peilz \__ tel: +41 21 944 15 42 |
------------------------------\__-----------------------------------
| On ne peut pas tuer le temps \__ |
| Sans blesser un peu l'eternite \__ ________ __o |
| ( As if you could kill time ) \__ _____ _`\<,_ |
| ( without injuring eternity. ) \__ ___ (_)/ (_) |
| Henry David Thoreau \ |
--------------------------------------------------------------------
=======================================================================
List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/
Submissions: info-performer++at++sgi.com
Admin. requests: info-performer-request++at++sgi.com
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:56:03 PDT