esp::geo::OBB class

Constructors, destructors, conversion operators

OBB() defaulted explicit
OBB(const Mn::Vector3& center, const Mn::Vector3& dimensions, const Mn::Quaternion& rotation) explicit
OBB(const Mn::Range3D& aabb) explicit

Public functions

auto center() const -> Mn::Vector3
Returns centroid of this OBB.
auto sizes() const -> Mn::Vector3
Returns the dimensions of this OBB in its own frame of reference.
auto volume() const -> float
Return the volume of this bbox.
auto halfExtents() const -> Mn::Vector3
Returns half-extents of this OBB (dimensions)
auto rotation() const -> Mn::Quaternion
Returns quaternion representing rotation of this OBB.
auto worldToLocal() const -> const Mn::Matrix4&
Return Mn::Matrix4 from world coordinates to local [0,1]^3 coordinates.
auto localToWorld() const -> const Mn::Matrix4&
Return Mn::Matrix4 from local [0,1]^3 coordinates to world coordinates.
auto toAABB() const -> Mn::Range3D
Returns an axis aligned bounding box bounding this OBB.
auto distance(const Mn::Vector3& p) const -> float
auto closestPoint(const Mn::Vector3& p) const -> Mn::Vector3
Return closest point to p within OBB. If p is inside return p.
auto contains(const Mn::Vector3& p, float epsilon = 1e-6f) const -> bool
auto rotate(const Mn::Quaternion& rotation) -> OBB&
Rotate this OBB by the given rotation and return reference to self.

Protected functions

void recomputeTransforms()

Protected variables

Mn::Vector3 center_
Mn::Vector3 halfExtents_
Mn::Quaternion rotation_
Mn::Matrix4 localToWorld_
Mn::Matrix4 worldToLocal_

Function documentation

float esp::geo::OBB::distance(const Mn::Vector3& p) const

Returns distance to p from closest point on OBB surface (0 if point p is inside box)

bool esp::geo::OBB::contains(const Mn::Vector3& p, float epsilon = 1e-6f) const

Returns whether world coordinate point p is contained in this OBB within threshold distance epsilon