Re: Intersection testing on scaled objects

New Message Reply Date view Thread view Subject view Author view

Jim Helman (jimh++at++surreal)
Thu, 16 Mar 95 21:49:47 -0800


intersect.c works fine with scales as far as I can tell. I
think this is just an issue of coordinate frames. The point
returned in the pfHit is in object coordinates. If you want
scene coordinates, as is appropriate for ground following in
intersect.c, you need to transform the returned point by the
xform returned in the pfHit, i.e.

        if (isect)
        {
                pfVec3 pnt, xpnt;
                pfMatrix xmat;
                pfQueryHit (*hits[0], PFQHIT_POINT, &pnt);
                pfQueryHit (*hits[0], PFQHIT_XFORM, xmat);
                pfXformPt3(xpnt, pnt, xmat);
                shared->zval = xpnt[PF_Z] + 0.5;
        }

rgds,

-jim helman

jimh++at++surreal.asd.sgi.com
415/390-1151


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:51:05 PDT

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