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.