struct TAABox

template<typename T>

Axis aligned box represented by minimum and maximum point.

Public

Constructors

TAABox<T>

TAABox<T>()

TAABox<T>

TAABox<T>(const TAABox<T> &copy) = default

TAABox<T>

TAABox<T>(const TVector3<T> &min, const TVector3<T> &max)

TAABox

TAABox()

TAABox

TAABox(const TAABox<float> &copy) noexcept = default

TAABox

TAABox(const TVector3<float> &min, const TVector3<float> &max)

TAABox

TAABox()

TAABox

TAABox(const TAABox<double> &copy) = default

TAABox

TAABox(const TVector3<double> &min, const TVector3<double> &max)

Methods

~TAABox<T>

~TAABox<T>() = default

SetExtents

void SetExtents(const TVector3<T> &min, const TVector3<T> &max)

Sets the minimum and maximum corners.

Scale

void Scale(const TVector3<T> &s)

Scales the box around the center by multiplying its extents with the provided scale.

GetCorner

TVector3<T> GetCorner(Corner cornerToGet) const

Returns the coordinates of a specific corner.

Merge

void Merge(const TAABox<T> &rhs)

Merges the two boxes, creating a new bounding box that encapsulates them both.

Merge

void Merge(const TVector3<T> &point)

Expands the bounding box so it includes the provided point.

Transform

void Transform(const TMatrix4<T> &matrix)

Transforms the bounding box by the given matrix.

TransformAffine

void TransformAffine(const TMatrix4<T> &matrix)

Transforms the bounding box by the given matrix.

Intersects

bool Intersects(const TAABox<T> &b2) const

Returns true if this and the provided box intersect.

Intersects

bool Intersects(const TSphere<T> &s) const

Returns true if the sphere intersects the bounding box.

Intersects

bool Intersects(const TPlane<T> &p) const

Returns true if the plane intersects the bounding box.

Intersects

std::pair<bool, T> Intersects(const TRay<T> &ray) const

Ray / box intersection, returns a boolean result and nearest distance to intersection.

Intersects

bool Intersects(const TRay<T> &ray, T &d1, T &d2) const

Ray / box intersection, returns boolean result and near and far intersection distance.

GetCenter

TVector3<T> GetCenter() const

Center of the box.

GetSize

TVector3<T> GetSize() const

Size of the box (difference between minimum and maximum corners)

GetExtents

TVector3<T> GetExtents() const

Extents of the box (distance from center to one of the corners)

GetRadius

T GetRadius() const

Radius of a sphere that fully encompasses the box.

GetVolume

T GetVolume() const

Size of the volume in the box.

Contains

bool Contains(const TVector3<T> &v) const

Returns true if the provided point is inside the bounding box.

Contains

bool Contains(const TVector3<T> &v, T extra) const

Returns true if the provided point is inside the bounding box while expanding the bounds by in every direction.

Contains

bool Contains(const TAABox<T> &other) const

Returns true if the provided bounding box is completely inside the bounding box.

~TAABox

~TAABox<float>() noexcept = default

SetExtents

void SetExtents(const TVector3<float> &min, const TVector3<float> &max)

Sets the minimum and maximum corners.

Scale

void Scale(const TVector3<float> &s)

Scales the box around the center by multiplying its extents with the provided scale.

GetCorner

TVector3<float> GetCorner(Corner cornerToGet) const

Returns the coordinates of a specific corner.

Merge

void Merge(const TAABox<float> &rhs)

Merges the two boxes, creating a new bounding box that encapsulates them both.

Merge

void Merge(const TVector3<float> &point)

Expands the bounding box so it includes the provided point.

Transform

void Transform(const TMatrix4<float> &matrix)

Transforms the bounding box by the given matrix.

TransformAffine

void TransformAffine(const TMatrix4<float> &matrix)

Transforms the bounding box by the given matrix.

Intersects

bool Intersects(const TAABox<float> &b2) const

Returns true if this and the provided box intersect.

Intersects

bool Intersects(const TSphere<float> &s) const

Returns true if the sphere intersects the bounding box.

Intersects

bool Intersects(const TPlane<float> &p) const

Returns true if the plane intersects the bounding box.

Intersects

std::pair<bool, float> Intersects(const TRay<float> &ray) const

Ray / box intersection, returns a boolean result and nearest distance to intersection.

Intersects

bool Intersects(const TRay<float> &ray, float &d1, float &d2) const

Ray / box intersection, returns boolean result and near and far intersection distance.

GetCenter

TVector3<float> GetCenter() const

Center of the box.

GetSize

TVector3<float> GetSize() const

Size of the box (difference between minimum and maximum corners)

GetExtents

TVector3<float> GetExtents() const

Extents of the box (distance from center to one of the corners)

GetRadius

float GetRadius() const

Radius of a sphere that fully encompasses the box.

GetVolume

float GetVolume() const

Size of the volume in the box.

Contains

bool Contains(const TVector3<float> &v) const

Returns true if the provided point is inside the bounding box.

Contains

bool Contains(const TVector3<float> &v, float extra) const

Returns true if the provided point is inside the bounding box while expanding the bounds by in every direction.

Contains

bool Contains(const TAABox<float> &other) const

Returns true if the provided bounding box is completely inside the bounding box.

~TAABox

~TAABox<double>() noexcept = default

SetExtents

void SetExtents(const TVector3<double> &min, const TVector3<double> &max)

Sets the minimum and maximum corners.

Scale

void Scale(const TVector3<double> &s)

Scales the box around the center by multiplying its extents with the provided scale.

GetCorner

TVector3<double> GetCorner(Corner cornerToGet) const

Returns the coordinates of a specific corner.

Merge

void Merge(const TAABox<double> &rhs)

Merges the two boxes, creating a new bounding box that encapsulates them both.

Merge

void Merge(const TVector3<double> &point)

Expands the bounding box so it includes the provided point.

Transform

void Transform(const TMatrix4<double> &matrix)

Transforms the bounding box by the given matrix.

TransformAffine

void TransformAffine(const TMatrix4<double> &matrix)

Transforms the bounding box by the given matrix.

Intersects

bool Intersects(const TAABox<double> &b2) const

Returns true if this and the provided box intersect.

Intersects

bool Intersects(const TSphere<double> &s) const

Returns true if the sphere intersects the bounding box.

Intersects

bool Intersects(const TPlane<double> &p) const

Returns true if the plane intersects the bounding box.

Intersects

std::pair<bool, double> Intersects(const TRay<double> &ray) const

Ray / box intersection, returns a boolean result and nearest distance to intersection.

Intersects

bool Intersects(const TRay<double> &ray, double &d1, double &d2) const

Ray / box intersection, returns boolean result and near and far intersection distance.

GetCenter

TVector3<double> GetCenter() const

Center of the box.

GetSize

TVector3<double> GetSize() const

Size of the box (difference between minimum and maximum corners)

GetExtents

TVector3<double> GetExtents() const

Extents of the box (distance from center to one of the corners)

GetRadius

double GetRadius() const

Radius of a sphere that fully encompasses the box.

GetVolume

double GetVolume() const

Size of the volume in the box.

Contains

bool Contains(const TVector3<double> &v) const

Returns true if the provided point is inside the bounding box.

Contains

bool Contains(const TVector3<double> &v, double extra) const

Returns true if the provided point is inside the bounding box while expanding the bounds by in every direction.

Contains

bool Contains(const TAABox<double> &other) const

Returns true if the provided bounding box is completely inside the bounding box.

Fields

Minimum

TVector3<T> Minimum

Maximum

TVector3<T> Maximum

Minimum

TVector3<float> Minimum

Maximum

TVector3<float> Maximum

Minimum

TVector3<double> Minimum

Maximum

TVector3<double> Maximum

Operators

operator==

bool operator==(const TAABox<T> &rhs) const

operator!=

bool operator!=(const TAABox<T> &rhs) const

operator==

bool operator==(const TAABox<float> &rhs) const

operator!=

bool operator!=(const TAABox<float> &rhs) const

operator==

bool operator==(const TAABox<double> &rhs) const

operator!=

bool operator!=(const TAABox<double> &rhs) const