Re: volume 2 volume intersection

New Message Reply Date view Thread view Subject view Author view

Mario Veraart (rioj7++at++fel.tno.nl)
Fri, 20 Feb 1998 16:24:54 +0100 (MET)


>
> > > I'm doing a simple volume to volume intersection in Performer,
> > > a moving pfCylinder built around the bounding sphere of an object
> > > and other objects, looks like:
> > >
> > > // collision detection between one moving target and other static
> > > objects
> > > pfSegSet segset;
> > > pfHit **hits[32];
> > > int numHit = 0;
> > >
> > > pfSphere boundBall; // bounding box of the moving object
> > > getBound(&boundBall);
> > > pfCylinder *cylinder = new pfCylinder;
> > > pfSphere **list = (pfSphere **)pfMalloc(1 * sizeof(pfSphere *),NULL);
> > > list[0] = &boundBall;
> > > cylinder->around((const pfSphere **)list,1); // cylinder
> > >
> > > segset.mode = PFTRAV_IS_PATH | PFTRAV_IS_GSET | PFTRAV_IS_BCYL;
> > > segset.userData = (void *)NULL;
> > > segset.activeMask = 0x0; // or 0xFFFF????
> > > segset.isectMask = HITABLE; // Intersection mask
> > > segset.bound = (void *)cylinder;
> > > segset.discFunc = NULL;
> > > numHit = ((this->getParent(0))->getParent(0))->isect(&segset,hits);
> > > I'm not sure of the value for segset.activeMask in this case of a
> > > cylinder detection. When set as 0xFFFF, always hits detected; If set as 0, always no hit.
> > > Neither is correct. What's wrong with my code?
> >
> > When you do a pfNode::isect() you must at least specify one segment of
> > the pfSegSet::segs[i]. The segments you fill in must be marked in
> > the pfSegSet::activeMask. Every bit in the mask corresponds with one
> > segment in the segs array.
>
> I've followed the programming guide which says " If only a rough
> volume-volume intersection
> is required, you can specify a bounding cylinder in the pfSegSet
> "without" any line segments at all and request discriminator callbacks
> at the PFTRAV_IS_NODE or PFTRAV_IS_GSET level. "
> (last page of Ch.6) One point I found is PFTRAV_IS_NODE nonexsitant on
> my machine.

You are right. I had never read this paragraph.
I think the PFTRAV_IS_NODE is a typo and what they mean is PFTRAV_IS_GEODE.
You must setup a discriminator callback that accepts a pfHit* as
argument. And setup the mode of the pfSegSet to contain
PFTRAV_IS_GEODE and PFTRAV_IS_GSET. You will get a callback for every
bounding sphere and bounding box that is tested. I think you must keep
your own record of what is the last test you did because you haven't
defined a segment.
You can read a bit more in the man page of pfNode and pfGeoSet about
the pfNode::isect() function.
>
> My cylinder is not constructed from pfSegSets, it is from the bounding
> sphere of an object.
>
> If I have to define at lease one pfSeg for the moving cylinder, say
> segs[0],dose the "dir"
> mean the moving direction of the cylinder? and how to define "pos" in
> this case? or they
> are just meaningless?
A cylinder around one sphere always encoses more space than the
sphere. If you want to determine if an object would collide with the
scene in the near future it is a lot more specific to set up the
cylinder yourself and assign it to the pfSegSet::bound member.

>
> One relative question is the Bounding Sphere of a pfDCS. What is the
> coordinate system
> used to express the "center , radius", relative to scene root?

It is with regards to the coordinate system of the parent nodes.
If there is no parent that transforms the coordinate system it is in
scene coordinates.

The cylinder you specify must be in scene coordinates.

Mario
=======================================================================
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:48 PDT

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