Raito 0.1
Loading...
Searching...
No Matches
Raito::Math::AABB Class Reference

#include <AABB.h>

Public Types

enum  IntersectionType { INSIDE , INTERSECT , OUTSIDE }
 Type returned from call to intersect. More...
 

Public Member Functions

 AABB ()
 Builds a null AABB.
 
 AABB (const V3 &center, glm::float32_t radius)
 
 AABB (const V3 &p1, const V3 &p2)
 Builds an AABB that contains the two points.
 
 AABB (const AABB &aabb)
 
 ~AABB ()=default
 
void SetNull ()
 Set the AABB as NULL (not set).
 
NODISCARD bool IsNull () const
 Returns true if AABB is NULL (not set).
 
void Extend (glm::float32_t val)
 Extend the bounding box on all sides by val.
 
void Extend (const V3 &p)
 Expand the AABB to include point p.
 
void Extend (const V3 &center, glm::float32_t radius)
 
void Extend (const AABB &aabb)
 Expand the AABB to encompass the given aabb.
 
void Extend (const V3 *pointsArray, int numCount)
 
void ExtendDisk (const V3 &center, const V3 &normal, glm::float32_t radius)
 
void Translate (const V3 &v)
 Translates AABB by vector v.
 
void Scale (const V3 &scale)
 
void Scale (const V3 &scale, const V3 &origin)
 
NODISCARD V3 GetCenter () const
 Retrieves the center of the AABB.
 
NODISCARD V3 GetDiagonal () const
 
NODISCARD glm::float32_t GetLongestEdge () const
 
NODISCARD glm::float32_t GetShortestEdge () const
 
NODISCARD V3 GetMin () const
 Retrieves the AABB's minimum point.
 
NODISCARD V3 GetMax () const
 Retrieves the AABB's maximum point.
 
NODISCARD bool Overlaps (const AABB &bb) const
 
NODISCARD IntersectionType Intersect (const AABB &bb) const
 
NODISCARD bool IsSimilarTo (const AABB &b, glm::float32_t diff=0.5) const
 
NODISCARD V3 Size () const
 Returns the side lengths of this AABB in x, y and z directions.
 
NODISCARD V3 HalfSize () const
 [similarOverload: Size]
 
NODISCARD V3 GetExtent () const
 

Member Enumeration Documentation

◆ IntersectionType

Type returned from call to intersect.

Enumerator
INSIDE 
INTERSECT 
OUTSIDE 

Constructor & Destructor Documentation

◆ AABB() [1/4]

Raito::Math::AABB::AABB ( )

Builds a null AABB.

◆ AABB() [2/4]

Raito::Math::AABB::AABB ( const V3 & center,
glm::float32_t radius )

Builds an AABB that encompasses a sphere.

Parameters
[in]centerCenter of the sphere.
[in]radiusRadius of the sphere.

◆ AABB() [3/4]

Raito::Math::AABB::AABB ( const V3 & p1,
const V3 & p2 )

Builds an AABB that contains the two points.

◆ AABB() [4/4]

Raito::Math::AABB::AABB ( const AABB & aabb)

◆ ~AABB()

Raito::Math::AABB::~AABB ( )
default

Member Function Documentation

◆ Extend() [1/5]

void Raito::Math::AABB::Extend ( const AABB & aabb)

Expand the AABB to encompass the given aabb.

◆ Extend() [2/5]

void Raito::Math::AABB::Extend ( const V3 & center,
glm::float32_t radius )

Expand the AABB to include a sphere centered at center and of radius radius.

Parameters
[in]centerCenter of sphere.
[in]radiusRadius of sphere.

◆ Extend() [3/5]

void Raito::Math::AABB::Extend ( const V3 & p)

Expand the AABB to include point p.

◆ Extend() [4/5]

void Raito::Math::AABB::Extend ( const V3 * pointsArray,
int numCount )

◆ Extend() [5/5]

void Raito::Math::AABB::Extend ( glm::float32_t val)

Extend the bounding box on all sides by val.

◆ ExtendDisk()

void Raito::Math::AABB::ExtendDisk ( const V3 & center,
const V3 & normal,
glm::float32_t radius )

Expand the AABB to include a disk centered at center, with normal normal, and radius radius. \xxx Untested – This function is not represented in our unit tests.

◆ GetCenter()

V3 Raito::Math::AABB::GetCenter ( ) const

Retrieves the center of the AABB.

◆ GetDiagonal()

V3 Raito::Math::AABB::GetDiagonal ( ) const

Retrieves the diagonal vector (computed as m_Max - m_Min). If the AABB is NULL, then a vector of all zeros is returned.

◆ GetExtent()

V3 Raito::Math::AABB::GetExtent ( ) const

◆ GetLongestEdge()

glm::float32_t Raito::Math::AABB::GetLongestEdge ( ) const

Retrieves the longest edge. If the AABB is NULL, then 0 is returned.

◆ GetMax()

NODISCARD V3 Raito::Math::AABB::GetMax ( ) const
inline

Retrieves the AABB's maximum point.

◆ GetMin()

NODISCARD V3 Raito::Math::AABB::GetMin ( ) const
inline

Retrieves the AABB's minimum point.

◆ GetShortestEdge()

glm::float32_t Raito::Math::AABB::GetShortestEdge ( ) const

Retrieves the shortest edge. If the AABB is NULL, then 0 is returned.

◆ HalfSize()

V3 Raito::Math::AABB::HalfSize ( ) const

[similarOverload: Size]

Returns Size()/2.

See also
Size(), HalfDiagonal().

◆ Intersect()

AABB::IntersectionType Raito::Math::AABB::Intersect ( const AABB & bb) const

Returns one of the intersection types. If either of the aabbs are invalid, then OUTSIDE is returned.

◆ IsNull()

NODISCARD bool Raito::Math::AABB::IsNull ( ) const
inline

Returns true if AABB is NULL (not set).

◆ IsSimilarTo()

bool Raito::Math::AABB::IsSimilarTo ( const AABB & b,
glm::float32_t diff = 0.5 ) const

Function from SCIRun. Here is a summary of SCIRun's description: Returns true if the two AABB's are similar. If diff is 1.0, the two bboxes have to have about 50% overlap each for x,y,z. If diff is 0.0, they have to have 100% overlap. If either of the two AABBs is NULL, then false is returned. \xxx Untested – This function is not represented in our unit tests.

◆ Overlaps()

bool Raito::Math::AABB::Overlaps ( const AABB & bb) const

Returns true if AABBs share a face overlap. \xxx Untested – This function is not represented in our unit tests.

◆ Scale() [1/2]

void Raito::Math::AABB::Scale ( const V3 & scale)

◆ Scale() [2/2]

void Raito::Math::AABB::Scale ( const V3 & scale,
const V3 & origin )

Scale the AABB by scale, centered around origin.

Parameters
[in]scale3D vector specifying scale along each axis.
[in]originOrigin of scaling operation. Most useful origin would be the center of the AABB.

◆ SetNull()

void Raito::Math::AABB::SetNull ( )
inline

Set the AABB as NULL (not set).

◆ Size()

V3 Raito::Math::AABB::Size ( ) const

Returns the side lengths of this AABB in x, y and z directions.

The returned vector is equal to the diagonal vector of this AABB, i.e. it spans from the minimum corner of the AABB to the maximum corner of the AABB.

See also
HalfSize(), Diagonal().

◆ Translate()

void Raito::Math::AABB::Translate ( const V3 & v)

Translates AABB by vector v.


The documentation for this class was generated from the following files: