Bounding Box


A general class to hold a series of polygons; this is often used for collision detection.

This class is a parent to c_TerrainBox and c_HitBox

Because this class is based on a 2 dimensional array, AllocateFirstIndices(…) and AllocateSecondIndices(…) must be run before verts can be filled. Failure to do so will likely result in errors.

void c_BoundBox::AllocateFirstIndices(int num)

Initializes the first bounds of the 2 dimensional array, with 'num' being this bound.

void c_BoundBox::AllocateSecondIndices(int ind, int num)

Initializes the second dimension of the array at index 'ind'. pBounds[ind] will become an array of size 'num'

void c_BoundBox::SetVertex(float px, float py, int iInd, int jInd);

Sets a chosen vertex (iInd, jInd_ with the location values in px and py.

int c_BoundBox::GetJlength(int j)

returns the length of the array pBounds[j]

SPoint c_BoundBox::GetAsSPoint(int iInd, int jInd)

returns an SPoint, representing the point found at pBounds[iInd, jInd].


SPoint **pBounds : The array of points manages by this class
int iLength : first boundary of the array
int * jLength : contains the second boundaries of the array