Gan Wang (rock.csd.sgi.com!sgi.com!uunet.uu.net!ds9!cavalier!gan)
Tue, 25 Mar 1997 10:15:23 -0500
Here is one...
#define SEG_LENGTH 10000.0
/* initialize only once */
pfSegSet segset;
segset.mode = PFTRAV_IS_PRIM|PFTRAV_IS_NORM|PFTRAV_IS_CULL_BACK;
segset.activeMask = 1;
segset.isectMask = 0x1;
segset.bound = NULL;
segset.discFunc = NULL;
...
/* in the run time loop */
pfHit **hits[32];
pfGetChanView(chan, pos, dir);
pfMakePolarSeg(
&segset.segs[0],
pos,
dir[PF_H],
dir[PF_P],
SEG_LENGTH);
/* you may have to do this or isect may not work - this could be a pfbug... */
pfGSetIsectMask(gset, 0x1, PFTRAV_SELF, PF_SET);
isect = pfGSetIsectSegs(gset, &segset, hits);
if (isect)
{
pfVec3 tpoint, vpoint;
pfMatrix mat;
pfQueryHit(*hits[0], PFQHIT_POINT, &tpoint);
pfQueryHit(*hits[0], PFQHIT_XFORM, mat);
pfXformPt3(vpoint, tpoint, mat);
or whatever you want to do with the isect result...
}
Hope it helps.
Cheers,
Gan
>
> Tracy Hunt
> hunt++at++gts.elan.af.mil
> =======================================================================
> List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/
> Submissions: info-performer++at++sgi.com
> Admin. requests: info-performer-request++at++sgi.com
>-- End of excerpt from Tracy Hunt
--Gan Wang
Cambridge Research Associates Voice: 703-790-0505 ext.7210 1430 Spring Hill Road, Suite 200 Fax: 703-790-0370 McLean, VA 22102 E-mail: gan++at++cambridge.com ======================================================================= 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:54:56 PDT