AABB

Represents an axis-aligned bounding box. More...

#include

Inherited by SerializableAABB.

Public Types

enum type_reset { RESET }

Public Member Functions

ILINE AABB ()
Default AABB constructor (without initialisation).
ILINE AABB (type_reset)
AABB aabb(RESET) generates a reset aabb.
ILINE AABB (float radius)
ILINE AABB (const Vec3 &v)
ILINE AABB (const Vec3 &v, float radius)
ILINE AABB (const Vec3 &vmin, const Vec3 &vmax)
ILINE AABB (const AABB &aabb)
AABB (const Vec3 *points, int num)
ILINE void Reset ()
ILINE bool IsReset () const
ILINE float IsResetSel (float ifReset, float ifNotReset) const
ILINE bool IsEmpty () const
Check if bounding box is empty (Zero volume).
ILINE bool IsNonZero () const
Check if bounding box has valid, non zero volume.
ILINE Vec3 GetCenter () const
ILINE Vec3 GetSize () const
ILINE float GetRadius () const
ILINE float GetRadiusSqr () const
ILINE float GetVolume () const
ILINE void Add (const Vec3 &v)
void Add (const Vec3 &v, float radius)
ILINE void Add (const AABB &bb)
void Move (const Vec3 &v)
void Expand (Vec3 const &v)
void Augment (AABB const &bb)
Augment the box on all sides by a box.
void ClipToBox (AABB const &bb)
void ClipMoveToBox (AABB const &bb)
bool IsOverlapSphereBounds (const Vec3 &pos, float radius) const
Check if this bounding box overlap with bounding box of sphere.
bool IsContainSphere (const Vec3 &pos, float radius) const
Check if this bounding box contain sphere within itself.
bool IsContainPoint (const Vec3 &pos) const
Check if this bounding box contains a point within itself.
float GetDistanceSqr (Vec3 const &v) const
float GetDistance (Vec3 const &v) const
float GetFarDistance (Vec3 const &v) const
bool ContainsBox (AABB const &b) const
bool ContainsBox2D (AABB const &b) const
bool IsIntersectBox (const AABB &b) const
Check two bounding boxes for intersection.
ILINE void SetTransformedAABB (const Matrix34 &m34, const AABB &aabb)
ILINE void SetTransformedAABB (const QuatT &qt, const AABB &aabb)
template
ILINE void SetAABBfromOBB (const OBB_tpl< F > &obb)
Create an AABB using just the extensions of the OBB and ignore the orientation.
template
ILINE void SetAABBfromOBB (const Vec3 &wpos, const OBB_tpl< F > &obb, f32 scaling=1.0f)

Static Public Member Functions

static ILINE AABB CreateTransformedAABB (const Matrix34 &m34, const AABB &aabb)
static ILINE AABB CreateTransformedAABB (const QuatT &qt, const AABB &aabb)
template
static ILINE AABB CreateAABBfromOBB (const OBB_tpl< F > &obb)
template
static ILINE AABB CreateAABBfromOBB (const Vec3 &wpos, const OBB_tpl< F > &obb, f32 scaling=1.0f)
static ILINE AABB CreateAABBfromCone (const Cone &c)

Public Attributes

Vec3 min
Vec3 max
AUTO_STRUCT_INFO

Detailed Description

Represents an axis-aligned bounding box.

Member Function Documentation

◆ Reset()

ILINE void AABB::Reset ( )
inline

Reset Bounding box before calculating bounds. These values ensure that Add() functions work correctly for Reset bbs, without additional comparisons.

◆ SetAABBfromOBB()

template
ILINE void AABB::SetAABBfromOBB ( const Vec3 & wpos,
const OBB_tpl< F > & obb,
f32 scaling = 1.0f
)
inline

converts an OBB into an tight fitting AABB

Example: AABB aabb = AABB::CreateAABBfromOBB(wposition,obb,1.0f);

return values: expanded AABB in world-space

◆ SetTransformedAABB()

ILINE void AABB::SetTransformedAABB ( const Matrix34 & m34,
const AABB & aabb
)
inline

calculate the new bounds of a transformed AABB

Example: AABB aabb = AABB::CreateAABBfromOBB(m34,aabb);

return values: expanded AABB in world-space