pfSphere(3pf) OpenGL Performer 3.2.2 libpr C Reference Pages pfSphere(3pf)NAME
pfMakeEmptySphere, pfSphereExtendByPt, pfSphereExtendBySphere,
pfSphereExtendByCyl, pfSphereAroundPts, pfSphereAroundSpheres,
pfSphereAroundCyls, pfSphereAroundBoxes, pfSphereContainsPt,
pfSphereContainsSphere, pfSphereContainsCyl, pfSphereContainsBox,
pfSphereIsectSeg, pfOrthoXformSphere - Set, transform and extend a sphere
FUNCTION SPECIFICATION
#include <Performer/pr.h>
void pfMakeEmptySphere(pfSphere *sph);
void pfSphereExtendByPt(pfSphere* dst, const pfVec3 pt);
void pfSphereExtendBySphere(pfSphere* dst, const pfSphere* sph);
void pfSphereExtendByCyl(pfSphere* dst, const pfCylinder* cyl);
void pfSphereAroundPts(pfSphere *dst, const pfVec3 *pts, int npt);
void pfSphereAroundSpheres(pfSphere *dst, const pfSphere **sphs,
int nsph);
void pfSphereAroundCyls(pfSphere *dst, const pfCylinders **sphs,
int ncyl);
void pfSphereAroundBoxes(pfSphere *dst, const pfBox **boxes, int nbox);
int pfSphereContainsPt(const pfSphere* sp, const pfVec3 pt);
int pfSphereContainsSphere(const pfSphere *sph1,
const pfSphere *sph2);
int pfSphereContainsCyl(const pfSphere *sph, const pfCylinder *cyl);
int pfSphereContainsBox(const pfSphere *sph, const pfBox *box);
int pfSphereIsectSeg(const pfSphere* sph, const pfSeg* seg, float* d1,
float* d2);
void pfOrthoXformSphere(pfSphere *dst, const pfSphere *sph,
const pfMatrix xform);
typedef struct
{
pfVec3 center;
float radius;
} pfSphere;
struct pfSphere
{
pfVec3 center;
Page 1
pfSphere(3pf) OpenGL Performer 3.2.2 libpr C Reference Pages pfSphere(3pf)
float radius;
};
DESCRIPTION
A pfSphere represents a sphere as a center and a radius. The routines
listed here provide means of creating and extending spheres for use as
bounding geometry. pfSphere is a public struct whose data members center
and radius may be operated on directly.
pfMakeEmptySphere sets sph so that it appears empty to extend and around
operations.
pfSphereExtendByPt, pfSphereExtendBySphere, and pfSphereExtendByCyl set
dst to a sphere which contains both dst and the point pt, the sphere sph
or the cylinder cyl, respectively.
pfSphereAroundPts, pfSphereAroundBoxes, pfSphereAroundSpheres and
pfSphereAroundCyls set dst to a sphere which contains a set of points,
boxes, spheres or cylinders, respectively. These routines are passed the
address of an array of pointers to the objects being bounded along with
the number of objects.
pfSphereContainsPt, returns TRUE or FALSE depending on whether the point
pt is in the interior of the specified sphere.
pfSphereContainsSphere, pfSphereContainsCyl and pfSphereContainsBox test
whether the sphere specified by the first argument contains a non-empty
portion of the volume specified by the secondsecond argument and the
sphere is empty.
PFIS_MAYBE:
The intersection of the second argument and the sphere might be
non-empty.
PFIS_MAYBE | PFIS_TRUE:
The intersection of the second argument and the sphere is
definitely non-empty.
PFIS_MAYBE | PFIS_TRUE | PFIS_ALL_IN:
The second argument is non-empty and lies entirely inside the
sphere.
pfSphereIsectSeg intersects the line segment seg with the volume of the
pfSphere sphere. The possible return values are:
PFIS_FALSE:
seg lies entirely in the exterior.
Page 2
pfSphere(3pf) OpenGL Performer 3.2.2 libpr C Reference Pages pfSphere(3pf)
PFIS_MAYBE | PFIS_TRUE | PFIS_START_IN:
The starting point of seg lies in the interior.
PFIS_MAYBE | PFIS_TRUE | PFIS_END_IN:
The ending point of seg lies in the interior.
PFIS_MAYBE | PFIS_TRUE | PFIS_ALL_IN | PFIS_START_IN | PFIS_END_IN:
Both end points of seg lie in the interior.
If d1 and d2 are non-NULL, on return from pfSphereIsectSeg they contain
the starting and ending positions of the line segment (0 <= d1 <= d2 <=
seg->length) intersected with the sphere.
pfOrthoXformSphere returns in dst the sphere sph transformed by the
orthogonal transform xform.
NOTES
The bit fields returned by the contains functions are structured so that
bitwise AND-ing the results of sequential tests can be used to compute
composite results, e.g. testing exclusion against a number of half
spaces.
Some of the extend and around operations are time consuming and should be
used sparingly. In general, the quality of a bound generated by a series
of extend operations will be no better, and sometimes much worse, than a
bound generated by a single around operation.
SEE ALSO
pfBox, pfCylinder, pfSeg, pfVec3
Page 3