CGPdocs

bounding_box

Axis-aligned bounding box (corners p_min and p_max) of a mesh or a set of points.

Fields and methods

Members of the struct bounding_box. Most of what you do with a CGP type goes through the free functions listed below.

Fields

vec3 p_min = {0,0,0}Corner of the box with the smallest x, y and z coordinates, {0,0,0} by default.
vec3 p_max = {0,0,0}Corner of the box with the largest x, y and z coordinates, {0,0,0} by default.

Methods

void initialize(mesh const& m)Sets p_min and p_max to the smallest box containing every position of the mesh (the mesh must have at least one vertex).2 overloads src
void initialize(numarray<vec3> const& positions)Sets p_min and p_max to the smallest box containing every given position, and stops on an assertion if the array is empty. src
void extends(float d)Enlarges the box by d on every side (p_min - d, p_max + d); a negative d shrinks it.3 overloads src
void extends(float dx, float dy, float dz)Enlarges the box by dx, dy and dz on the sides along x, y and z respectively. src
void extends(vec3 const& d)Enlarges the box by d.x, d.y and d.z on the sides along x, y and z (p_min - d, p_max + d). src
Returns true if p is inside the box or on its boundary. src
Static function returning true if the two boxes overlap or touch along the three axes. src

Functions taking a bounding_box

None.

Functions returning a bounding_box

None.

Operators

None.

CGP - Computer Graphics Programming.