From: Paolo Farinelli (paolo++at++sgi.com)
Date: 04/14/2004 15:16:52
Hi Juan Manuel,
I tried compiling your few lines of code, and on my sytem
the printf result is 7, as you originally expected.
What could be causing your problem is that you don't seem
to initialize the values of your pfBox.
Try adding the following line to your code before extending
the pfBox: "pfMakeEmptyBox(&box);"
This is the program I tested,
(on irix) compile with: cc -o test test.c -lpf
#include <stdio.h>
#include <Performer/pf.h>
int main( int argc, char**argv )
{
pfBox box;
pfSphere sph;
pfBox *boxes[1];
pfVec3 pnt;
pfInit();
pfConfig();
// TRY ADDING pfMakeEmptyBox(&box); HERE!
pnt[0]=-2;
pnt[1]=-2;
pnt[2]=-2;
pfBoxExtendByPt(&box,pnt);
pnt[0]=2;
pnt[1]=2;
pnt[2]=2;
pfBoxExtendByPt(&box,pnt);
boxes[0]=&box;
pfSphereAroundBoxes(&sph, (const pfBox **)&boxes, 1);
printf("%i\n" , pfSphereContainsBox(&sph,&box));
pfExit();
}
Hope this helps.
Best Regards,
Paolo
Juan Manuel Cappi wrote:
>Hi,
> a couple of months ago I started to use the Performer framework and
>today I ran into something I don't understand and I guessed you could
>help me. The code I'm using is:
>
>pfBox box;
>pfSphere sph;
>pfBox *boxes[1];
>pfVec3 pnt;
>
>pnt[0]=-2;
>pnt[1]=-2;
>pnt[2]=-2;
>pfBoxExtendByPt(&box,pnt);
>
>pnt[0]=2;
>pnt[1]=2;
>pnt[2]=2;
>pfBoxExtendByPt(&box,pnt);
>
>boxes[0]=&box;
>
>pfSphereAroundBoxes(&sph, (const pfBox **)&boxes, 1);
>
>printf("%i\n" , pfSphereContainsBox(&sph,&box));
>
>
>The thing is that the printf output is the number 3, but, as I
>understand from the man pages, the result should be 7 (i.e., the box
>is contained entirely inside the sphere). Am i wrong? Any help would
>be appreciated.
>
>Regards,
> Juan
>
>
>-----------------------------------------------------------------------
> 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 : Wed Apr 14 2004 - 15:17:54 PDT