pfBox(3pf) OpenGL Performer 3.2.2 libpr C Reference Pages pfBox(3pf)NAME
pfMakeEmptyBox, pfBoxExtendByPt, pfBoxExtendByBox, pfBoxAroundPts,
pfBoxAroundBoxes, pfBoxAroundSpheres, pfBoxAroundCyls, pfBoxContainsPt,
pfBoxContainsBox, pfBoxContainsSphere, pfBoxIsectSeg, pfXformBox -
Operate on axis-aligned bounding boxes
FUNCTION SPECIFICATION
#include <Performer/pr.h>
void pfMakeEmptyBox(pfBox *box);
void pfBoxExtendByPt(pfBox *dst, const pfVec3 pt);
void pfBoxExtendByBox(pfBox *dst, const pfBox *box);
void pfBoxAroundPts(pfBox *dst, const pfVec3 *pts, int npt);
void pfBoxAroundBoxes(pfBox* dst, const pfBox **boxes, int nbox);
void pfBoxAroundSpheres(pfBox *dst, const pfSphere **sphs, int nsph);
void pfBoxAroundCyls(pfBox *dst, const pfCylinder **sphs, int ncyl);
int pfBoxContainsPt(const pfBox* box, const pfVec3 pt);
int pfBoxContainsBox(const pfBox *box1, const pfBox *box2);
int pfBoxContainsSphere(const pfBox* box, const pfSphere *sphere);
int pfBoxIsectSeg(const pfBox* box, const pfSeg* seg, float* d1,
float* d2);
void pfXformBox(pfBox *dst, const pfBox *box, const pfMatrix xform);
typedef struct
{
pfVec3 min;
pfVec3 max;
} pfBox;
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
public struct whose data members min and max may be operated on directly.
pfMakeEmptyBox sets dst to appear empty to extend operations.
Page 1
pfBox(3pf) OpenGL Performer 3.2.2 libpr C Reference Pages pfBox(3pf)
pfBoxExtendByPt extends the size of box dst to include the point pt.
pfBoxExtendByBox extends the size of box dst to include the box box.
pfBoxAroundPts, pfBoxAroundBoxes pfBoxAroundCyls and pfBoxAroundSpheres
set dst 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.
pfBoxContainsPt returns TRUE or FALSE depending on whether the point pt
is in the interior of the specified box.
The return value from pfBoxContainsBox is the OR of one or more bit
fields. The returned value may be:
PFIS_FALSE:
The intersection of the second box argument and the first box
is empty.
PFIS_MAYBE | PFIS_TRUE:
The intersection of the second box argument and the first box
is definitely non-empty.
PFIS_MAYBE | PFIS_TRUE | PFIS_ALL_IN:
The second box argument is non-empty and lies entirely inside
the first box.
The return value from pfBoxContainsSphere 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.
pfBoxIsectSeg intersect the line segment seg with the volume of an axis-
aligned box box. 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.
Page 2
pfBox(3pf) OpenGL Performer 3.2.2 libpr C Reference Pages pfBox(3pf)
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 pfBoxIsectSeg they contain the
starting and ending positions of the line segment (0 <= d1 <= d2 <= seg-
>length) intersected with the specified volume.
pfXformBox sets dst 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