pfSegsIsectNode difficulties

New Message Reply Date view Thread view Subject view Author view

Cindy Tonnesen (tonnesen++at++enews.nrl.navy.mil)
Thu, 2 Dec 93 13:39:12 -0500


I'm using the Performer 1.2 Beta Release -- and I'm trying to do something
I anticipated would not be too difficult: detecting intersections between
a line segment and objects in the scene. Currently, there's only one object
in the scene and one line segment to test intersections from.

Problems I'm having: pfSegsIsectNode() is currently always returning 1 - that
one line segment hit something. When by sight, it is obvious that the line
segment was no where near the object.
My code looks like:
...
pfGeode *root;
pfSeg seg;
pfHit **hits[1];
float nodehit;
_pfSegSet segSet;
long numHits;

...
root = LoadIcon("/srvr/icons/70.icon");
pfNodeTravMask(root, PFTRAV_ISECT, 0x01, PFTRAV_SELF |
        PFTRAV_DESCEND | PFTRAV_IS_CACHE, PF_SET);
/* I've also tried pfGSetIsectMask() in place of the above line;
 * both yield the same results.
 */
...

...
pfMakePtsSeg(&seg, vertics[0], vertices[1]);
segSet.typeId = NULL;
segSet.userData = NULL;
segSet.segs[0] = seg;
// set active mask to 0x01; set 0th bit to 1.
segSet.activeMask = 0x01;
segSet.isectMask = 0x01;
segSet.mode = PFTRAV_IS_GSET | PFTRAV_IS_GEODE | PFTRAV_IS_PRIM;
segSet.bcyl = NULL;
segSet.discFunc = NULL;

/* this function is always returning numHits = 1 */
numHits = pfSegsIsectNode(root, &segSet, hits);

if (numHits)
{
  nodehit = 0.0;
  pfQueryHit(hits[0][0], PFQHIT_GSET, &nodehit);
  if (nodehit != NULL)
  {
     /* intersection successful */
     processing...
  }
}

Part of the difficulty in getting this to work is that I only have man pages
as sent with the beta release as documentation, and there are NO examples
in it of using the intersection routines.
Any light anyone can shed on this would be highly appreciated - even if
you do not have the answer to my question, I would *highly* appreciate
some sample code that uses these routines successfully!

Thank you,
Cynthia Tonnesen
Naval Research Lab


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:06 PDT

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