Botcraft 1.21.4
Loading...
Searching...
No Matches
Botcraft::AABB Class Reference

#include <AABB.hpp>

Public Member Functions

 AABB (const Vector3< double > &center_, const Vector3< double > &half_size_)
 
 ~AABB ()
 
Vector3< double > GetMin () const
 
Vector3< double > GetMax () const
 
const Vector3< double > & GetCenter () const
 
const Vector3< double > & GetHalfSize () const
 
Vector3< double > GetClosestPoint (const Vector3< double > &pos) const
 Get the closest point in the AABB from a given point.
 
double GetVolume () const
 Get the volume of this AABB.
 
bool Collide (const AABB &b) const
 
bool Intersect (const Vector3< double > &origin, const Vector3< double > &direction) const
 
AABBInflate (const double d)
 
AABBTranslate (const Vector3< double > &t)
 
bool operator< (const AABB &other) const
 
bool operator== (const AABB &other) const
 

Private Attributes

Vector3< double > center
 
Vector3< double > half_size
 

Friends

template<typename T >
AABB operator+ (AABB box, const Vector3< T > &offset)
 

Detailed Description

Definition at line 7 of file AABB.hpp.

Constructor & Destructor Documentation

◆ AABB()

Botcraft::AABB::AABB ( const Vector3< double > &  center_,
const Vector3< double > &  half_size_ 
)

Definition at line 7 of file AABB.cpp.

References center, and half_size.

◆ ~AABB()

Botcraft::AABB::~AABB ( )

Definition at line 13 of file AABB.cpp.

Member Function Documentation

◆ Collide()

bool Botcraft::AABB::Collide ( const AABB b) const

◆ GetCenter()

const Vector3< double > & Botcraft::AABB::GetCenter ( ) const

◆ GetClosestPoint()

Vector3< double > Botcraft::AABB::GetClosestPoint ( const Vector3< double > &  pos) const

Get the closest point in the AABB from a given point.

Parameters
posThe reference point
Returns
Closest point to pos inside the AABB

Definition at line 38 of file AABB.cpp.

References GetMax(), and GetMin().

◆ GetHalfSize()

const Vector3< double > & Botcraft::AABB::GetHalfSize ( ) const

Definition at line 33 of file AABB.cpp.

References half_size.

Referenced by Botcraft::PhysicsManager::ApplyMovement(), and Botcraft::World::GetColliders().

◆ GetMax()

◆ GetMin()

◆ GetVolume()

double Botcraft::AABB::GetVolume ( ) const

Get the volume of this AABB.

Returns
size_x * size_y * size_z

Definition at line 55 of file AABB.cpp.

References half_size, Botcraft::Vector3< T >::x, Botcraft::Vector3< T >::y, and Botcraft::Vector3< T >::z.

◆ Inflate()

AABB & Botcraft::AABB::Inflate ( const double  d)

◆ Intersect()

bool Botcraft::AABB::Intersect ( const Vector3< double > &  origin,
const Vector3< double > &  direction 
) const

Definition at line 69 of file AABB.cpp.

References center, and half_size.

◆ operator<()

bool Botcraft::AABB::operator< ( const AABB other) const

Definition at line 104 of file AABB.cpp.

References center, and half_size.

◆ operator==()

bool Botcraft::AABB::operator== ( const AABB other) const

Definition at line 110 of file AABB.cpp.

References center, and half_size.

◆ Translate()

AABB & Botcraft::AABB::Translate ( const Vector3< double > &  t)

Definition at line 98 of file AABB.cpp.

References center.

Referenced by Botcraft::PhysicsManager::CollideOneAxis().

Friends And Related Symbol Documentation

◆ operator+

template<typename T >
AABB operator+ ( AABB  box,
const Vector3< T > &  offset 
)
friend

Definition at line 36 of file AABB.hpp.

Member Data Documentation

◆ center

Vector3<double> Botcraft::AABB::center
private

Definition at line 47 of file AABB.hpp.

Referenced by AABB(), Collide(), GetCenter(), GetMax(), GetMin(), Intersect(), operator<(), operator==(), and Translate().

◆ half_size

Vector3<double> Botcraft::AABB::half_size
private

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