xoreos
0.0.5
|
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] |
A bounding box around 3D points.
Definition at line 33 of file boundingbox.h.
Common::BoundingBox::BoundingBox | ( | ) |
Definition at line 33 of file boundingbox.cpp.
References clear().
Common::BoundingBox::~BoundingBox | ( | ) |
Definition at line 37 of file boundingbox.cpp.
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().
void Common::BoundingBox::add | ( | float | x, |
float | y, | ||
float | z | ||
) |
Definition at line 230 of file boundingbox.cpp.
References _coords, _empty, _max, _min, getCoordMax(), getCoordMin(), MAX(), and MIN().
Referenced by absolutize(), add(), Graphics::Aurora::ModelNode::createAbsoluteBound(), Graphics::Aurora::ModelNode::createBound(), Graphics::Aurora::Model::createBound(), Graphics::Aurora::Model_Sonic::createBound(), and Engines::Trigger::prepare().
void Common::BoundingBox::add | ( | const BoundingBox & | box | ) |
Definition at line 251 of file boundingbox.cpp.
References _coords, _empty, and add().
void Common::BoundingBox::clear | ( | ) |
Definition at line 40 of file boundingbox.cpp.
References _absolute, _coords, _empty, _max, _min, _origin, and FLT_MAX.
Referenced by absolutize(), BoundingBox(), Graphics::Aurora::ModelNode::createBound(), Graphics::Aurora::Model::createBound(), and Graphics::Aurora::Model_Sonic::createBound().
bool Common::BoundingBox::empty | ( | ) | const |
Definition at line 60 of file boundingbox.cpp.
References _empty.
Referenced by Graphics::Aurora::ModelNode::createAbsoluteBound().
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().
|
inlineprivate |
Definition at line 294 of file boundingbox.cpp.
References _coords, and MAX().
Referenced by add().
|
inlineprivate |
Definition at line 283 of file boundingbox.cpp.
References _coords, and MIN().
Referenced by add().
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().
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().
|
private |
Definition at line 156 of file boundingbox.cpp.
Referenced by isIn().
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().
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().
const glm::mat4 & Common::BoundingBox::getOrigin | ( | ) | const |
Definition at line 64 of file boundingbox.cpp.
References _origin.
Referenced by Graphics::Aurora::ModelNode::createAbsoluteBound().
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().
|
private |
Definition at line 173 of file boundingbox.cpp.
Referenced by isIn().
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().
bool Common::BoundingBox::isIn | ( | float | x, |
float | y, | ||
float | z | ||
) | const |
Definition at line 136 of file boundingbox.cpp.
References _empty, getMax(), and getMin().
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().
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().
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().
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().
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().
|
private |
Definition at line 74 of file boundingbox.h.
Referenced by absolutize(), clear(), getMax(), getMin(), rotate(), scale(), transform(), and translate().
|
private |
Definition at line 78 of file boundingbox.h.
Referenced by absolutize(), add(), clear(), getCoordMax(), and getCoordMin().
|
private |
Definition at line 73 of file boundingbox.h.
Referenced by absolutize(), add(), clear(), empty(), and isIn().
|
private |
Definition at line 81 of file boundingbox.h.
Referenced by add(), clear(), getDepth(), getHeight(), getMax(), getMin(), and getWidth().
|
private |
Definition at line 80 of file boundingbox.h.
Referenced by add(), clear(), getDepth(), getHeight(), getMax(), getMin(), and getWidth().
|
private |
Definition at line 76 of file boundingbox.h.
Referenced by absolutize(), clear(), getMax(), getMin(), getOrigin(), rotate(), scale(), transform(), and translate().