Class AABB#
Defined in File AABB.h
Class Documentation#
-
class AABB#
Represents an Axis-Aligned Bounding Box using a pair of 3-vectors.
An AABB is defined by its minimum and maximum corners. This class provides functionality to combine two AABBs and to compute a new AABB after transformation.
Public Functions
-
AABB()#
Constructs an AABB with maximum and minimum values.
This is a default constructor that creates an “empty” AABB, which can be used as a starting point for combining other AABBs.
-
AABB(const Vec3 &min, const Vec3 &max, bool fix_minmax = true)#
Constructs an AABB from a minimum and a maximum corner.
- Parameters:
min – The minimum corner vector.
max – The maximum corner vector.
fix_minmax – If true, recompute min and max to ensure they are actually the minimum and maximum corners
-
std::string dumpString(const std::string &prefix = "", int precision = 6, bool exponential = false) const#
Returns a string representation of the AABB with options for formatting.
- Parameters:
prefix – A string to prepend to each line.
precision – The number of decimal places for floating-point values.
exponential – Whether to use exponential notation.
- Returns:
A string containing the min and max corners.
-
void dump(const std::string &prefix = "", int precision = 10, bool exponential = false) const#
Prints a string representation of the AABB with options for formatting.
- Parameters:
prefix – A string to prepend to each line.
precision – The number of decimal places for floating-point values.
exponential – Whether to use exponential notation.
-
AABB operator+(const AABB &other) const#
Combines this AABB with another AABB.
The resulting AABB will be a new box that encompasses both the original AABB and the ‘other’ AABB.
-
AABB &operator+=(const AABB &other)#
Combines this AABB with another AABB in-place.
The resulting AABB will be a new box that encompasses both the original AABB and the ‘other’ AABB.
-
AABB translate(const Vec3 &t) const#
Computes a new AABB by translating this AABB by a given vector.
- Parameters:
t – The 3-vector to translate by.
- Returns:
A new AABB that has been translated.
-
AABB rotate(const UnitQuaternion &q) const#
Computes a new AABB by rotating this AABB by a given unit quaternion.
- Parameters:
q – The unit quaternion to rotate by.
- Returns:
A new AABB that has been translated.
-
AABB scale(double s) const#
Computes a new AABB by scaling this AABB by a given scalar.
- Parameters:
s – The scalar to scale by.
- Returns:
A new AABB that has been scaled.
-
AABB()#