cee::BoundingBox

class BoundingBox

Axis-aligned bounding box.

The BoundingBox class defines an axis-aligned bounding box. The bounding box is defined as the smallest possible box surrounding a collection of points. There must be at least two separate points set for a valid bounding box.

When adding points to an existing bounding box, it will grow to surround the newly added points in addition to the existing. Single points or other bounding boxes can be added.

You can query an existing bounding box for minimum, maximum, center point, extent and radius.

The views bounding box can be retrieved by View::boundingBox().

See also

View

Public Functions

BoundingBox()

Constructs an empty bounding box object.

BoundingBox(const Vec3d &min, const Vec3d &max)

Constructs a bounding box defined by min and max.

BoundingBox(const BoundingBox &other)

Constructs a bounding box as a copy of other.

BoundingBox &operator=(const BoundingBox &rhs)

Assigns rhs to this bounding box and returns a reference to this bounding box.

BoundingBox operator+(const BoundingBox &rhs)

Adds rhs with this and return the product bounding box, leaving this unchanged.

void reset()

Resets the bounding box.

bool isValid() const

Returns false if no input has been given.

void add(const Vec3d &vertex)

Adds a point to the bounding box area.

The bounding box will grow to include the added point.

void add(const BoundingBox &bb)

Adds another bounding box to this bounding box area.

The bounding box will grow to include the added bounding box.

Vec3d minimum() const

Returns the bounding box’s minimum point.

Vec3d maximum() const

Returns the bounding box’s maximum point.

Vec3d center() const

Returns the computed center of the bounding box.

Vec3d extent() const

Returns the total size of the bounding box.

double radius() const

Returns the radius as half the length of the box’s diagonal.

void transform(const Mat4d &matrix)

Transforms the bounding box according to matrix.