intersections: PLEASE HELP

New Message Reply Date view Thread view Subject view Author view

Olivier Georg (ogeorg++at++imtsg14.epfl.ch)
Wed, 1 Oct 1997 11:07:27 -0600


OK guys, I start being REALLY frustrated with these intersections.
My goal is to find ALL the intersections of a single segment (which I took long
enough) with a geode. The geode has only 1 geoset (later it has more than one,
and the problem is even worse. But let's start with one...)

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

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:56:03 PDT

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