xoreos  0.0.5
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Common::BoundingBox Class Reference

A bounding box around 3D points. More...

#include <boundingbox.h>

Public Member Functions

 BoundingBox ()
 
 ~BoundingBox ()
 
void clear ()
 
bool empty () const
 
const glm::mat4 & getOrigin () const
 
void getMin (float &x, float &y, float &z) const
 
void getMax (float &x, float &y, float &z) const
 
float getWidth () const
 Get the width of the bounding box. More...
 
float getHeight () const
 Get the height of the bounding box. More...
 
float getDepth () const
 Get the depth of the bounding box. More...
 
bool isIn (float x, float y) const
 
bool isIn (float x, float y, float z) const
 
bool isIn (float x1, float y1, float z1, float x2, float y2, float z2) const
 
void add (float x, float y, float z)
 
void add (const BoundingBox &box)
 
void translate (float x, float y, float z)
 
void scale (float x, float y, float z)
 
void rotate (float angle, float x, float y, float z)
 
void transform (const glm::mat4 &m)
 
void absolutize ()
 Apply the origin transformations directly to the coordinates. More...
 
BoundingBox getAbsolute () const
 Return a copy with the origin transformations directly applied to the coordinates. More...
 

Private Member Functions

float getCoordMin (int i) const
 
float getCoordMax (int i) const
 
bool getIntersection (float fDst1, float fDst2, float x1, float y1, float z1, float x2, float y2, float z2, float &x, float &y, float &z) const
 
bool inBox (float x, float y, float z, float minX, float minY, float minZ, float maxX, float maxY, float maxZ, int axis) const
 

Private Attributes

bool _empty
 
bool _absolute
 
glm::mat4 _origin
 
float _coords [8][3]
 
float _min [3]
 
float _max [3]
 

Detailed Description

A bounding box around 3D points.

Definition at line 33 of file boundingbox.h.

Constructor & Destructor Documentation

◆ BoundingBox()

Common::BoundingBox::BoundingBox ( )

Definition at line 33 of file boundingbox.cpp.

References clear().

Here is the call graph for this function:

◆ ~BoundingBox()

Common::BoundingBox::~BoundingBox ( )

Definition at line 37 of file boundingbox.cpp.

Member Function Documentation

◆ absolutize()

void Common::BoundingBox::absolutize ( )

Apply the origin transformations directly to the coordinates.

Definition at line 305 of file boundingbox.cpp.

References _absolute, _coords, _empty, _origin, add(), and clear().

Referenced by Graphics::Aurora::ModelNode::createAbsoluteBound(), Graphics::Aurora::Model::createAbsolutePosition(), Graphics::Aurora::Model::createBound(), Graphics::Aurora::Model_Sonic::createBound(), and getAbsolute().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ add() [1/2]

void Common::BoundingBox::add ( float  x,
float  y,
float  z 
)

◆ add() [2/2]

void Common::BoundingBox::add ( const BoundingBox box)

Definition at line 251 of file boundingbox.cpp.

References _coords, _empty, and add().

Here is the call graph for this function:

◆ clear()

void Common::BoundingBox::clear ( )

◆ empty()

bool Common::BoundingBox::empty ( ) const

Definition at line 60 of file boundingbox.cpp.

References _empty.

Referenced by Graphics::Aurora::ModelNode::createAbsoluteBound().

Here is the caller graph for this function:

◆ getAbsolute()

BoundingBox Common::BoundingBox::getAbsolute ( ) const

Return a copy with the origin transformations directly applied to the coordinates.

Definition at line 328 of file boundingbox.cpp.

References absolutize().

Here is the call graph for this function:

◆ getCoordMax()

float Common::BoundingBox::getCoordMax ( int  i) const
inlineprivate

Definition at line 294 of file boundingbox.cpp.

References _coords, and MAX().

Referenced by add().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCoordMin()

float Common::BoundingBox::getCoordMin ( int  i) const
inlineprivate

Definition at line 283 of file boundingbox.cpp.

References _coords, and MIN().

Referenced by add().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDepth()

float Common::BoundingBox::getDepth ( ) const

Get the depth of the bounding box.

Definition at line 114 of file boundingbox.cpp.

References _max, _min, and ABS().

Referenced by Graphics::Aurora::ModelNode::getDepth(), Graphics::Aurora::Model::getDepth(), and Graphics::Aurora::Model::getTooltipAnchor().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getHeight()

float Common::BoundingBox::getHeight ( ) const

Get the height of the bounding box.

Definition at line 110 of file boundingbox.cpp.

References _max, _min, and ABS().

Referenced by Graphics::Aurora::ModelNode::getHeight(), Graphics::Aurora::Model::getHeight(), and Graphics::Aurora::Model::isIn().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getIntersection()

bool Common::BoundingBox::getIntersection ( float  fDst1,
float  fDst2,
float  x1,
float  y1,
float  z1,
float  x2,
float  y2,
float  z2,
float &  x,
float &  y,
float &  z 
) const
private

Definition at line 156 of file boundingbox.cpp.

Referenced by isIn().

Here is the caller graph for this function:

◆ getMax()

void Common::BoundingBox::getMax ( float &  x,
float &  y,
float &  z 
) const

Definition at line 87 of file boundingbox.cpp.

References _absolute, _max, _min, _origin, and MAX().

Referenced by Graphics::Aurora::Model::createBound(), Graphics::Aurora::Model_Sonic::createBound(), Graphics::Aurora::ModelNode::createCenter(), and isIn().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getMin()

void Common::BoundingBox::getMin ( float &  x,
float &  y,
float &  z 
) const

Definition at line 68 of file boundingbox.cpp.

References _absolute, _max, _min, _origin, and MIN().

Referenced by Graphics::Aurora::Model::createBound(), Graphics::Aurora::Model_Sonic::createBound(), Graphics::Aurora::ModelNode::createCenter(), Graphics::Aurora::Model::doDrawBound(), isIn(), and Graphics::Aurora::Model::queueDrawBound().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getOrigin()

const glm::mat4 & Common::BoundingBox::getOrigin ( ) const

Definition at line 64 of file boundingbox.cpp.

References _origin.

Referenced by Graphics::Aurora::ModelNode::createAbsoluteBound().

Here is the caller graph for this function:

◆ getWidth()

float Common::BoundingBox::getWidth ( ) const

Get the width of the bounding box.

Definition at line 106 of file boundingbox.cpp.

References _max, _min, and ABS().

Referenced by Graphics::Aurora::ModelNode::getWidth(), Graphics::Aurora::Model::getWidth(), and Graphics::Aurora::Model::isIn().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ inBox()

bool Common::BoundingBox::inBox ( float  x,
float  y,
float  z,
float  minX,
float  minY,
float  minZ,
float  maxX,
float  maxY,
float  maxZ,
int  axis 
) const
private

Definition at line 173 of file boundingbox.cpp.

Referenced by isIn().

Here is the caller graph for this function:

◆ isIn() [1/3]

bool Common::BoundingBox::isIn ( float  x,
float  y 
) const

Definition at line 118 of file boundingbox.cpp.

References _empty, getMax(), and getMin().

Referenced by Engines::Trigger::contains(), and Graphics::Aurora::Model::isIn().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isIn() [2/3]

bool Common::BoundingBox::isIn ( float  x,
float  y,
float  z 
) const

Definition at line 136 of file boundingbox.cpp.

References _empty, getMax(), and getMin().

Here is the call graph for this function:

◆ isIn() [3/3]

bool Common::BoundingBox::isIn ( float  x1,
float  y1,
float  z1,
float  x2,
float  y2,
float  z2 
) const

Definition at line 184 of file boundingbox.cpp.

References _empty, getIntersection(), getMax(), getMin(), and inBox().

Here is the call graph for this function:

◆ rotate()

void Common::BoundingBox::rotate ( float  angle,
float  x,
float  y,
float  z 
)

Definition at line 270 of file boundingbox.cpp.

References _absolute, _origin, and Common::deg2rad().

Referenced by Graphics::Aurora::ModelNode::createAbsoluteBound().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ scale()

void Common::BoundingBox::scale ( float  x,
float  y,
float  z 
)

Definition at line 265 of file boundingbox.cpp.

References _absolute, and _origin.

Referenced by Graphics::Aurora::ModelNode::createAbsoluteBound().

Here is the caller graph for this function:

◆ transform()

void Common::BoundingBox::transform ( const glm::mat4 &  m)

Definition at line 278 of file boundingbox.cpp.

References _absolute, and _origin.

Referenced by Graphics::Aurora::Model::createAbsolutePosition(), Graphics::Aurora::Model::createBound(), and Graphics::Aurora::Model_Sonic::createBound().

Here is the caller graph for this function:

◆ translate()

void Common::BoundingBox::translate ( float  x,
float  y,
float  z 
)

Definition at line 260 of file boundingbox.cpp.

References _absolute, and _origin.

Referenced by Graphics::Aurora::ModelNode::createAbsoluteBound().

Here is the caller graph for this function:

Member Data Documentation

◆ _absolute

bool Common::BoundingBox::_absolute
private

Definition at line 74 of file boundingbox.h.

Referenced by absolutize(), clear(), getMax(), getMin(), rotate(), scale(), transform(), and translate().

◆ _coords

float Common::BoundingBox::_coords[8][3]
private

Definition at line 78 of file boundingbox.h.

Referenced by absolutize(), add(), clear(), getCoordMax(), and getCoordMin().

◆ _empty

bool Common::BoundingBox::_empty
private

Definition at line 73 of file boundingbox.h.

Referenced by absolutize(), add(), clear(), empty(), and isIn().

◆ _max

float Common::BoundingBox::_max[3]
private

Definition at line 81 of file boundingbox.h.

Referenced by add(), clear(), getDepth(), getHeight(), getMax(), getMin(), and getWidth().

◆ _min

float Common::BoundingBox::_min[3]
private

Definition at line 80 of file boundingbox.h.

Referenced by add(), clear(), getDepth(), getHeight(), getMax(), getMin(), and getWidth().

◆ _origin

glm::mat4 Common::BoundingBox::_origin
private

Definition at line 76 of file boundingbox.h.

Referenced by absolutize(), clear(), getMax(), getMin(), getOrigin(), rotate(), scale(), transform(), and translate().


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