-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Game Physics Cookbook
By :
An Axis Aligned Bounding Box (AABB) is the 3D version of a rectangle. We will define a 3D AABB by a center point (position) and a half extent (size). The half extent of an Axis Aligned Bounding box represents half of the width, height and depth of the box. For example a box with half extents of (2, 3, 4) would be four units wide, six units tall and eight units deep.

We are going to create a new AABB structure, which will contain an origin and half extents. It's helpful to be able to get the minimum and maximum points of an AABB. We are going to implement helper functions to get both the min and max point of a given AABB. We are also going to implement a helper function to create an AABB given a min and a max point.
Follow these steps to implement a 3D Axis Aligned Bounding Box:
Define the AABB structure in Geometry3D.h:
typedef struct AABB {
Point origin;
vec3 size;
inline AABB() : size(1, 1, 1) { }
inline AABB(const Point&...