esp::geo::OBB class

Constructors, destructors, conversion operators

OBB() explicit
OBB(const vec3f& center, const vec3f& dimensions, const quatf& rotation) explicit
OBB(const box3f& aabb) explicit

Public functions

auto center() const -> vec3f
Returns centroid of this OBB.
auto sizes() const -> vec3f
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 -> vec3f
Returns half-extents of this OBB (dimensions)
auto rotation() const -> quatf
Returns quaternion representing rotation of this OBB.
auto worldToLocal() const -> const Transform&
Return Transform from world coordinates to local [0,1]^3 coordinates.
auto localToWorld() const -> const Transform&
Return Transform from local [0,1]^3 coordinates to world coordinates.
auto toAABB() const -> box3f
Returns an axis aligned bounding box bounding this OBB.
auto distance(const vec3f& p) const -> float
auto closestPoint(const vec3f& p) const -> vec3f
Return closest point to p within OBB. If p is inside return p.
auto contains(const vec3f& p, float epsilon = 1e-6f) const -> bool
auto rotate(const quatf& rotation) -> OBB&
Rotate this OBB by the given rotation and return reference to self.

Protected functions

void recomputeTransforms()

Protected variables

vec3f center_
vec3f halfExtents_
quatf rotation_
Transform localToWorld_
Transform worldToLocal_

Function documentation

float esp::geo::OBB::distance(const vec3f& 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 vec3f& p, float epsilon = 1e-6f) const

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