mav_BBCullToClipPlanes(3)

NAME
mav_BBCullToClipPlanes - Bounding box utility functions.

LEVEL
Maverik Level 2

SYNTAX
int mav_BBCullToClipPlanes(MAV_BB bb, MAV_clipPlanes cp);

int mav_BBGetCorner(MAV_vector v);

int mav_BBIntersectsLine(MAV_BB bb, MAV_line ln, MAV_objectIntersection *oi);

int mav_BBIntersectsBB(MAV_BB bb1, MAV_BB bb2);

int mav_BBInsideBB(MAV_BB bb1, MAV_BB bb2);

int mav_BBIntersectsClipPlanes(MAV_BB bb, int *clist, MAV_clipPlanes *cp);

void mav_BBAlign(MAV_BB in, MAV_matrix m, MAV_BB *out);

void mav_BBCompInit(MAV_BB *bb);

void mav_BBCompBB(MAV_BB in, MAV_BB *out);

void mav_BBCompPt(MAV_vector v, MAV_BB *bb);

DESCRIPTION

mav_BBCullToClipPlanes like mav_BBCull but uses the clip planes given rather than those which correspond to the current viewing frustum.

mav_BBGetCorner takes a vector v defining the normal to a plane, and returns an integer representing which corners of an axis-aligned box need to be tested when testing for intersection against that plane. This means that only 2 corners are tested for each box, instead of 8.

mav_BBIntersectsLine intersects  bounding box bb with line ln and returns the closest intersection point (if any) in oi. The result of the function is MAV_TRUE if an intersection was found, else MAV_FALSE.

mav_BBIntersectsBB  tests for intersects between bounding boxes bb1 and bb2. The result of the function is MAV_TRUE if they intersect, else MAV_FALSE.

mav_BBInsideBB  tests for both permutations of complete enclosure between bounding boxes bb1 and bb2. The result of the function is MAV_TRUE if one is inside the other, else MAV_FALSE.

mav_BBIntersectsClipPlanes intersects an axis-aligned box bb with a set of clip planes cp.  A return value of 0 indicates no intersection; of 1 indicates the box is entirely inside clip planes, 2 = box crosses clip planes.

mav_BBAlign takes the axis-aligned bounding box in, transforms it with matrix m, and then transforms it again to align it with the world coordinate axes.

The following functions are for computing the bounding box of a composite object.

mav_BBCompInit
    initialises the bounding box bb.

mav_BBCompBB
    calculates the enclosing bounding box of two separate bounding boxes, in and out. The resulting bounding box overwrites out.

mav_BBCompPt
    calculates the enclosing bounding box of bounding box bb and point v. The resulting bounding box overwrites bb.