From: Paolo Farinelli (paolo++at++sgi.com)
Date: 03/26/2004 14:06:24
Hi Davii,
(*hits[0])->query(PFQHIT_POINT, &(pnt[0]));
will query the point of intersection in local coordinates, i.e. it will
not include the transformations of pfSCSes and pfDCSes above it in the
scene graph.
However, you can use:
(*hits[0])->query(PFQHIT_XFORM, &(mat[0][0]));
to obtain the transformation matrix you need (above, mat is a pfMatrix).
You will then have to transform the point of intresection by this matrix:
pnt.xformPt(pnt,mat);
Hope this helps.
Best regards,
Paolo
daviii wrote:
>hello everyone!
>
>i have got a problem, whitch i can not solve:
>
>when i do an intersection test on loaded buildings that are put into my
>scene like this:
>
>pfDCS * v6 = new pfDCS();
>v6->setTrans(-50.0, 50.0 ,0.0);
>v6->setRot(90.0 ,0.0, 0.0);
>Shared->readNode = pfdLoadFile("models/Building1a.flt");
>v6->addChild(Shared->readNode);
>Shared->scene->addChild(v6);
>
>and i ask for the poin of intersection, it tells me, that the intersection
>happened somewhere near the origin.
>so somehow the intersection happens when i actually see the house, but it
>tells me, that the point of intersection was somewhere else.
>it is like i woulden`t have called setTrans and setRot...
>
>my intersection test looks like this:
>
>pfSegSet segset;
>pfHit **hits[32];
>int isect;
>
>segset.activeMask = 1;
>segset.isectMask = 0x01;
>segset.discFunc = NULL;
>segset.mode = PFTRAV_IS_PRIM;
>
>segset.segs[0].pos.set(line.pos[0], line.pos[1], line.pos[2]);
>segset.segs[0].dir.set(line.dir[0], line.dir[1], line.dir[2]);
>segset.segs[0].length = line.length;
>
>isect = Shared->scene->isect(&segset, hits);
>
>
>pfVec3 pnt;
>(*hits[0])->query(PFQHIT_POINT, pnt.vec);
>
>
>
>does anyone know what it is that i do wrong?
>thank you very much!
>dave
>
>-----------------------------------------------------------------------
> List Archives, Info, FAQ: http://www.sgi.com/software/performer/
> Open Development Project: http://oss.sgi.com/projects/performer/
> Submissions: info-performer++at++sgi.com
> Admin. requests: info-performer-request++at++sgi.com
>-----------------------------------------------------------------------
>
>
>
>
-- Paolo Farinelli paolo++at++sgi.com Member of Technical Staff, OpenGL Performer 1-650-933-1808 Silicon Graphics 1600 Amphitheatre Pkwy, Mountain View, CA 94043
This archive was generated by hypermail 2b29 : Fri Mar 26 2004 - 14:06:49 PST