using pfdSpatialize in libpfdu

New Message Reply Date view Thread view Subject view Author view

Dwight Meglan (dwight++at++ht.com)
Wed, 17 Apr 1996 16:20:37 -0400


I wrote a little test program last night to try to break up a scenegraph
into octrees using pfdSpatialize. Unfortunately, it only succeeds in being
killed after running for a while. It is my guess that it is recursing too
far and dying -- the source code for it (pfdSpatialize that is) shows that
the implementation is recursive. My next step is to add debug statements to
the source for pfdSpatialize and watch it do its magic -- I just linked to
libpfdu.so for my quick test last night. Before I go and figure out how to
do this:

Has anyone used pfdSpatialize and could you point out what I am doing wrong
in the following code snippet ?

--snip-- --snip-- --snip-- --snip-- --snip-- --snip-- --snip-- --snip--
--snip-- --snip-- --snip--

#include <stdio.h>
#include <stdlib.h>

#include <Performer/pf.h>
#include <Performer/pfdu.h>
#include <Performer/pf/pfGroup.h>
#include <Performer/pf/pfNode.h>
#include <Performer/pf/pfScene.h>

int main (int argc, char *argv[])
{
    pfInit();
    pfMultiprocess(PFMP_APPCULLDRAW);

    pfdInitConverter(argv[1]);

    pfConfig();
    pfNotifyLevel(PFNFY_FATAL | PFNFY_DEBUG);

    pfScene *scene = new pfScene();

    scene->addChild(pfdLoadFile(argv[1]));

    int ndiv= 100;
    if (argc > 3) ndiv= atoi(argv[3]);
    int ngset= 2;
    if (argc > 4) ngset= atoi(argv[4]);

    pfSphere bsphere;
    scene->getBound(&bsphere);
    float tol= bsphere.radius/ndiv;

    fprintf(stderr,"Spatializing with max Geode size of %f and max
numGeosets/Geode of %d into %s\n",
            tol,ngset,argv[2]);

    pfGroup* newScene= pfdSpatialize((pfGroup*)scene,tol,ngset);

    pfdStoreFile(newScene,argv[2]);

    pfExit();

    return 0;
}

--snip-- --snip-- --snip-- --snip-- --snip-- --snip-- --snip-- --snip--
--snip-- --snip-- --snip--

I have tried the above with many permutations including the following which
should generate a minimal octree:

breakup biggeoset.iv lotsogeosets.iv 2 10

I still get the process being killed -- usually by all the swap space being
consumed which makes me suspect that pfdSpatialize is recursing to
oblivion.

Thanks in advance for advice on this,
--dwight

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dwight Meglan, PhD | Developers of complete surgery simulation
Engineering Coordinator | training systems and surgery simulation
High Techsplanations, Inc. | creation software tools
6001 Montrose Rd., Suite 902 |
Rockville, MD 20852-4874 | "Witty, yet erudite saying goes here..."
301 984 3706 x38 |
301 984 2104 : FAX |
dwight++at++ht.com | http://www.ht.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:52:44 PDT

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