pfSphere(3pf) OpenGL Performer 3.2.2 libpr C++ Reference Pages pfSphere(3pf)NAMEpfSphere - Set, transform and extend a sphere
FUNCTION SPECIFICATION
#include <Performer/pr/pfGeoMath.h>
void* pfSphere::operator new(size_t);
void* pfSphere::operator new(size_t, void *arena);
pfSphere::pfSphere();
pfSphere(const pfVec3& _center, float _radius);
void pfSphere::makeEmpty(void);
void pfSphere::extendBy(const pfVec3 &pt);
void pfSphere::extendBy(const pfSphere* sph);
void pfSphere::extendBy(const pfCylinder* cyl);
void pfSphere::around(const pfVec3 *pts, int npt);
void pfSphere::around(const pfSphere **sphs, int nsph);
void pfSphere::around(const pfBox **boxes, int nbox);
void pfSphere::around(const pfCylinder **cyls, int ncyl);
int pfSphere::contains(const pfVec3 &pt);
int pfSphere::contains(const pfSphere *sph2);
int pfSphere::contains(const pfCylinder *cyl);
int pfSphere::contains(const pfBox *box);
int pfSphere::isect(const pfSeg* seg, float* d1, float* d2);
void pfSphere::orthoXform(const pfSphere *sph, const pfMatrix &xform);
struct pfSphere
{
pfVec3 center;
float radius;
};
Page 1
pfSphere(3pf) OpenGL Performer 3.2.2 libpr C++ Reference Pages pfSphere(3pf)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.
The default constructor pfSphere() is empty and does no initialization.
There is also a constructor to directly initialize the center and radius
of the pfSphere. new(arena) allocates a pfSphere from the specified
memory arena, or from the heap if arena is NULL. new allocates a
pfSphere from the default memory arena (see pfGetSharedArena). pfSpheres
can also be created automatically on the stack or statically. pfSpheres
allocated with new can be deleted with delete or pfDelete.
pfSphere::makeEmpty sets the pfSphere so that it appears empty to extend
and around operations.
pfSphere::extendBy(const pfVec3 pt), pfSphere::extendBy(const pfSphere
*sph), and pfSphere::extendBy(const pfCylinder *cyl) set the pfSphere to
a sphere which contains both the pfSphere and the point pt, the sphere
sph or the cylinder cyl, respectively.
pfSphere::around(const pfVec3 *, int), pfSphere::around(const pfBox **,
int), pfSphere::around(const pfSphere **, int) and
pfCylinder::around(const pfCylinder **, int) set the pfSphere 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.
pfSphere::contains(const pfVec3 pt), returns TRUE or FALSE depending on
whether the point pt is in the interior of the specified sphere.
pfSphere::contains(const pfSphere *), pfSphere::contains(const pfCylinder
*) and pfSphere::contains(const pfBox *) test whether the sphere
contains a non-empty portion of the volume specified by the argument, a
sphere, a cylinder or a box, respectively.
The return value from the these functions is the OR of one or more bit
fields. The returned value may be:
PFIS_FALSE:
The intersection of the argument and the sphere is empty.
PFIS_MAYBE:
The intersection of the argument and the sphere might be non-
empty.
PFIS_MAYBE | PFIS_TRUE:
The intersection of the argument and the sphere is definitely
non-empty.
Page 2
pfSphere(3pf) OpenGL Performer 3.2.2 libpr C++ Reference Pages pfSphere(3pf)
PFIS_MAYBE | PFIS_TRUE | PFIS_ALL_IN:
The argument is non-empty and lies entirely inside the sphere.
pfSphere::isect 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.
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 pfSphere::isect they contain
the starting and ending positions of the line segment (0 <= d1 <= d2 <=
seg->length) intersected with the sphere.
pfSphere::orthoXform sets the pfSphere to be 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.
C++ does not support array deletion (i.e. delete[]) for arrays of objects
allocated new operators that take additional arguments. Hence, the array
deletion operator delete[] should not be used on arrays of objects
created with new(arena) pfVec3[n].
SEE ALSO
pfBox, pfCylinder, pfSeg, pfVec3
Page 3