Re: pfdSpatialize

New Message Reply Date view Thread view Subject view Author view

Don Hatch (hatch++at++hell.asd.sgi.com)
Wed, 1 May 1996 17:31:04 -0700


On Apr 29, 12:54pm, Allen Bierbaum wrote:
> Subject: pfdSpatialize
>
> [ plain text
> Encoded with "quoted-printable" ] :
> Does anyone have a example of pfdSpatialize actually working> Every time I try it, it just keeps recursing.
>
> I need it because I have a very large scene, that I am performing a huge number of intersections with. The major bottleneck in my app right now is the intersections. I believe that if I can subdivide the scene into smaller geoSets, The intersections would perform substantially better.
>
> If anyone has an example... even one line, I would appreciate it.

There's a couple of bugs in pfdSpatialize that makes it recurse forever...
you can quick-fix the source code by making the following changes
(then look at the lsb loader source if you still want an example).

--- pfdSpatial.c Wed May 1 17:14:39 1996
***************
*** 68,76 ****
      /*
       * if fewer than geodeChild children and smaller than specified
       * geode dimension, return a single geode
       */
! if (ngset <= geodeChild && size2 < geodeSize*geodeSize)
      {
        pfGeode *geode = pfNewGeode();
        for (i = 0 ; i < ngset ; i++)
        {
--- 68,76 ----
      /*
       * if fewer than geodeChild children and smaller than specified
       * geode dimension, return a single geode
       */
! if (ngset <= 1 || ngset <= geodeChild && size2 < geodeSize*geodeSize)
      {
        pfGeode *geode = pfNewGeode();
        for (i = 0 ; i < ngset ; i++)
        {
***************
*** 127,145 ****
     /*
      * if only one octant active, arbitrarily subdivide
      */
      grp = pfNewGroup();
       
      if (active < 2)
      {
- int nper = PF_MAX2(ngset/4, 3);
- int which = 0;
        for (i = 0 ; i < 8 ; i++)
            pfResetList(lists[i]);
   
        for (i = 0 ; i < ngset ; i++)
        {
            pfGeoSet *gset = (pfGeoSet *)pfGet(gsets, i);
! if (i > (which+1)*nper)
! which++;
! pfAdd(lists[which], gset);
        }
      }
--- 127,141 ----
     /*
      * if only one octant active, arbitrarily subdivide
      */
      grp = pfNewGroup();
       
      if (active < 2)
      {
        for (i = 0 ; i < 8 ; i++)
            pfResetList(lists[i]);
   
        for (i = 0 ; i < ngset ; i++)
        {
            pfGeoSet *gset = (pfGeoSet *)pfGet(gsets, i);
! pfAdd(lists[i%4], gset);
        }
      }

A better fix would be to subdivide around the
average of the centers of all the geosets rather than
the center of the bounding box of their union;
then if it ever reaches a point where all the geosets are in one octant,
just put them all in one geode (it means all the centers
are the same, so there's no point in arbitrarily subdividing further).

Don

-- 
Don Hatch  hatch++at++sgi.com  (415) 933-5150  Silicon Graphics, Inc.

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

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