pfBox(3pf) OpenGL Performer 3.2.2 libpr C++ Reference Pages pfBox(3pf)NAMEpfBox - Operate on axis-aligned bounding boxes
FUNCTION SPECIFICATION
#include <Performer/pr/pfGeoMath.h>
void* pfBox::operator new(size_t);
void* pfBox::operator new(size_t, void *arena);
pfBox::pfBox();
pfBox(const pfVec3& _min, const pfVec3& _max);
void pfBox::makeEmpty(void);
void pfBox::extendBy(const pfVec3 &pt);
void pfBox::extendBy(const pfBox *box);
void pfBox::around(const pfVec3 *pts, int npt);
void pfBox::around(const pfBox **boxes, int nbox);
void pfBox::around(const pfSphere **sphs, int nsph);
void pfBox::around(const pfCylinder **cyls, int ncyl);
int pfBox::contains(const pfVec3 &pt);
int pfBox::contains(const pfBox *box2);
int pfBox::contains(const pfSphere *sphere);
int pfBox::isect(const pfSeg* seg, float* d1, float* d2);
void pfBox::xform(const pfBox *box, const pfMatrix &xform);
struct pfBox
{
pfVec3 min;
pfVec3 max;
};
DESCRIPTION
A pfBox is an axis-aligned box which can be used for intersection tests
and for maintaining bounding information about geometry. A box
represents the axis-aligned hexahedral volume: (x, y, z) where min[0] <=
x <= max[0], min[1] <= y <= max[1] and min[2] <= z <= max[2]. pfBox is a
Page 1
pfBox(3pf) OpenGL Performer 3.2.2 libpr C++ Reference Pages pfBox(3pf)
public struct whose data members min and max may be operated on directly.
The default constructor pfBox() is empty and does no initialization.
There is also a constructor pfBox(const pfVec3& _min, const pfVec3& _max)
that will directly initialize the pfBox's max and min values. new(arena)
allocates a pfBox from the specified memory arena, or from the heap if
arena is NULL. new allocates a pfBox from the default memory arena (see
pfGetSharedArena). pfBoxes can also be created automatically on the
stack or statically. pfBoxes allocated with new can be deleted with
delete or pfDelete.
pfBox::makeEmpty sets the pfBox to appear empty to extend operations.
pfBox::extendBy extends the size of the pfBox to include the point pt.
pfBox::extendBy extends the size of the pfBox to include the box box.
The variations of the member function pfBox::around set the pfBox to be
an axis-aligned box encompassing the given primitives. npt, nbox, ncyls
and nsph are the number of points, boxes, and spheres in the respective
primitive lists.
pfBox::contains(const pfVec3, ...) returns TRUE or FALSE depending on
whether the point pt is in the interior of the specified box.
The return value from pfBox::contains(const pfBox*, ...) is the OR of one
or more bit fields. The returned value may be:
PFIS_FALSE:
The intersection of the box argument and the box is empty.
PFIS_MAYBE | PFIS_TRUE:
The intersection of the box argument and the box is definitely
non-empty.
PFIS_MAYBE | PFIS_TRUE | PFIS_ALL_IN:
The box argument is non-empty and lies entirely inside the
box.
The return value from pfBox::contains(const pfSphere*) is the OR of one
or more bit fields. The returned value may be:
PFIS_FALSE:
The intersection of the box and the sphere is empty, or the box
is empty.
PFIS_MAYBE | PFIS_TRUE:
The intersection of the box and the sphere is non-empty.
PFIS_MAYBE | PFIS_TRUE | PFIS_ALL_IN:
The sphere lies entirely inside the box, or the sphere is
empty.
Page 2
pfBox(3pf) OpenGL Performer 3.2.2 libpr C++ Reference Pages pfBox(3pf)
pfBox::isect intersect the line segment seg with the volume of an axis-
aligned pfBox. The possible return values include all of the above as
well as:
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 pfBox::isect they contain the
starting and ending positions of the line segment (0 <= d1 <= d2 <= seg-
>length) intersected with the specified volume.
pfBox::xform sets the pfBox to a box which contains box as transformed by
the matrix xform, i.e. a box around (box * xform). Because transformed
boxes must be axis-aligned, most rotations cause the box to grow, and the
transformation is not reversed by the inverse rotation.
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.
Because pfBoxes are axially aligned, they tend to grow when transformed.
Hence, they are best for static geometry or other cases in which the
bounding geometry does not need to be transformed.
SEE ALSO
pfSeg, pfSphere
Page 3