ACF $AcfVersion:0$
Public Member Functions | List of all members
i3d::CBox3d Class Reference

Definition of an axis-aligned bounding box (AABB) in 3D space. More...

#include <CBox3d.h>

Public Member Functions

 CBox3d ()
 Default constructor.
 
 CBox3d (const CVector3d &min, const CVector3d &max)
 Construct box from minimum and maximum corners.
 
bool IsEmpty () const
 Returns true if the box is in invalid/empty state.
 
const CVector3dGetMin () const
 Get minimum corner of the box.
 
void SetMin (const CVector3d &min)
 Set minimum corner of the box.
 
const CVector3dGetMax () const
 Get maximum corner of the box.
 
void SetMax (const CVector3d &max)
 Set maximum corner of the box.
 
CVector3d GetCenter () const
 Get center of the box.
 
CVector3d GetSize () const
 Get size (dimensions) of the box.
 
CVector3d GetExtent () const
 Get extent (half-size) of the box.
 
double GetVolume () const
 Calculate volume of the box.
 
double GetSurfaceArea () const
 Calculate surface area of the box.
 
bool Contains (const CVector3d &point, double tolerance=0.0) const
 Check if point is inside the box.
 
bool Intersects (const CBox3d &other) const
 Check if this box intersects another box.
 
void Include (const CVector3d &point)
 Expand box to include point.
 
void Include (const CBox3d &other)
 Expand box to include another box.
 
CVector3d GetClosestPoint (const CVector3d &point) const
 Get closest point on or inside box to given point.
 
void Reset ()
 Reset box to empty state.
 
bool Serialize (iser::IArchive &archive)
 Serialize this box to specified archive.
 
bool operator== (const CBox3d &box) const
 
bool operator!= (const CBox3d &box) const
 

Detailed Description

Definition of an axis-aligned bounding box (AABB) in 3D space.

Box is stored as minimum and maximum corner points.

Definition at line 17 of file CBox3d.h.

Constructor & Destructor Documentation

◆ CBox3d() [1/2]

i3d::CBox3d::CBox3d ( )
inline

Default constructor.

Creates an empty box (invalid state).

Definition at line 131 of file CBox3d.h.

References Reset().

◆ CBox3d() [2/2]

i3d::CBox3d::CBox3d ( const CVector3d min,
const CVector3d max 
)
inline

Construct box from minimum and maximum corners.

Parameters
minMinimum corner (smallest x, y, z).
maxMaximum corner (largest x, y, z).

Definition at line 137 of file CBox3d.h.

Member Function Documentation

◆ Contains()

bool i3d::CBox3d::Contains ( const CVector3d point,
double  tolerance = 0.0 
) const
inline

Check if point is inside the box.

Parameters
pointPoint to check.
toleranceTolerance for boundary check.

Definition at line 219 of file CBox3d.h.

References i3d::CVector3d::GetX(), i3d::CVector3d::GetY(), i3d::CVector3d::GetZ(), and IsEmpty().

◆ GetCenter()

CVector3d i3d::CBox3d::GetCenter ( ) const
inline

Get center of the box.

Definition at line 176 of file CBox3d.h.

◆ GetClosestPoint()

CVector3d i3d::CBox3d::GetClosestPoint ( const CVector3d point) const

Get closest point on or inside box to given point.

◆ GetExtent()

CVector3d i3d::CBox3d::GetExtent ( ) const
inline

Get extent (half-size) of the box.

Definition at line 191 of file CBox3d.h.

References GetSize().

◆ GetMax()

const CVector3d & i3d::CBox3d::GetMax ( ) const
inline

Get maximum corner of the box.

Definition at line 164 of file CBox3d.h.

◆ GetMin()

const CVector3d & i3d::CBox3d::GetMin ( ) const
inline

Get minimum corner of the box.

Definition at line 152 of file CBox3d.h.

◆ GetSize()

CVector3d i3d::CBox3d::GetSize ( ) const
inline

Get size (dimensions) of the box.

Definition at line 182 of file CBox3d.h.

References IsEmpty().

Referenced by GetExtent(), GetSurfaceArea(), and GetVolume().

◆ GetSurfaceArea()

double i3d::CBox3d::GetSurfaceArea ( ) const
inline

Calculate surface area of the box.

Definition at line 207 of file CBox3d.h.

References GetSize(), i3d::CVector3d::GetX(), i3d::CVector3d::GetY(), i3d::CVector3d::GetZ(), and IsEmpty().

◆ GetVolume()

double i3d::CBox3d::GetVolume ( ) const
inline

Calculate volume of the box.

Definition at line 197 of file CBox3d.h.

References GetSize(), i3d::CVector3d::GetX(), i3d::CVector3d::GetY(), i3d::CVector3d::GetZ(), and IsEmpty().

◆ Include() [1/2]

void i3d::CBox3d::Include ( const CBox3d other)
inline

Expand box to include another box.

Definition at line 267 of file CBox3d.h.

References Include(), and IsEmpty().

◆ Include() [2/2]

void i3d::CBox3d::Include ( const CVector3d point)
inline

◆ Intersects()

bool i3d::CBox3d::Intersects ( const CBox3d other) const
inline

Check if this box intersects another box.

Definition at line 234 of file CBox3d.h.

References i3d::CVector3d::GetX(), i3d::CVector3d::GetY(), i3d::CVector3d::GetZ(), and IsEmpty().

◆ IsEmpty()

bool i3d::CBox3d::IsEmpty ( ) const
inline

Returns true if the box is in invalid/empty state.

Definition at line 144 of file CBox3d.h.

References i3d::CVector3d::GetX(), i3d::CVector3d::GetY(), and i3d::CVector3d::GetZ().

Referenced by Contains(), GetSize(), GetSurfaceArea(), GetVolume(), Include(), Include(), and Intersects().

◆ operator!=()

bool i3d::CBox3d::operator!= ( const CBox3d box) const
inline

Definition at line 290 of file CBox3d.h.

◆ operator==()

bool i3d::CBox3d::operator== ( const CBox3d box) const
inline

Definition at line 284 of file CBox3d.h.

◆ Reset()

void i3d::CBox3d::Reset ( )
inline

Reset box to empty state.

Definition at line 276 of file CBox3d.h.

References qInf.

Referenced by CBox3d().

◆ Serialize()

bool i3d::CBox3d::Serialize ( iser::IArchive archive)

Serialize this box to specified archive.

◆ SetMax()

void i3d::CBox3d::SetMax ( const CVector3d max)
inline

Set maximum corner of the box.

Definition at line 170 of file CBox3d.h.

◆ SetMin()

void i3d::CBox3d::SetMin ( const CVector3d min)
inline

Set minimum corner of the box.

Definition at line 158 of file CBox3d.h.


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