Don Hatch (hatch++at++hell.asd.sgi.com)
Wed, 1 May 1996 17:31:04 -0700
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.
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:52:51 PDT