GLM AABB
Axis aligned bounding box built on GLM
|
Standalone axis aligned bounding box implemented built on top of GLM. More...
#include <AABB.hpp>
Public Types | |
enum | INTERSECTION_TYPE { INSIDE, INTERSECT, OUTSIDE } |
Type returned from call to intersect. | |
Public Member Functions | |
AABB () | |
Builds a null AABB. | |
AABB (const glm::vec3 ¢er, glm::float_t radius) | |
AABB (const glm::vec3 &p1, const glm::vec3 &p2) | |
Builds an AABB that contains the two points. | |
AABB (const AABB &aabb) | |
void | setNull () |
Set the AABB as NULL (not set). | |
bool | isNull () const |
Returns true if AABB is NULL (not set). | |
void | extend (glm::float_t val) |
Extend the bounding box on all sides by val . | |
void | extend (const glm::vec3 &p) |
Expand the AABB to include point p . | |
void | extend (const glm::vec3 ¢er, glm::float_t radius) |
void | extend (const AABB &aabb) |
Expand the AABB to encompass the given aabb . | |
void | extendDisk (const glm::vec3 ¢er, const glm::vec3 &normal, glm::float_t radius) |
void | translate (const glm::vec3 &v) |
Translates AABB by vector v . | |
void | scale (const glm::vec3 &scale, const glm::vec3 &origin) |
glm::vec3 | getCenter () const |
Retrieves the center of the AABB. | |
glm::vec3 | getDiagonal () const |
glm::float_t | getLongestEdge () const |
glm::float_t | getShortestEdge () const |
glm::vec3 | getMin () const |
Retrieves the AABB's minimum point. | |
glm::vec3 | getMax () const |
Retrieves the AABB's maximum point. | |
bool | overlaps (const AABB &bb) const |
INTERSECTION_TYPE | intersect (const AABB &bb) const |
bool | isSimilarTo (const AABB &b, glm::float_t diff=0.5) const |
Standalone axis aligned bounding box implemented built on top of GLM.
AABB | ( | const glm::vec3 & | center, |
glm::float_t | radius | ||
) |
Builds an AABB that encompasses a sphere.
[in] | center | Center of the sphere. |
[in] | radius | Radius of the sphere. |
void extend | ( | const glm::vec3 & | center, |
glm::float_t | radius | ||
) |
Expand the AABB to include a sphere centered at center
and of radius radius
.
[in] | center | Center of sphere. |
[in] | radius | Radius of sphere. |
void extendDisk | ( | const glm::vec3 & | center, |
const glm::vec3 & | normal, | ||
glm::float_t | radius | ||
) |
Expand the AABB to include a disk centered at center
, with normal normal
, and radius radius
. Untested -- This function is not represented in our unit tests.
glm::vec3 getDiagonal | ( | ) | const |
Retrieves the diagonal vector (computed as mMax - mMin). If the AABB is NULL, then a vector of all zeros is returned.
glm::float_t getLongestEdge | ( | ) | const |
Retrieves the longest edge. If the AABB is NULL, then 0 is returned.
glm::float_t getShortestEdge | ( | ) | const |
Retrieves the shortest edge. If the AABB is NULL, then 0 is returned.
AABB::INTERSECTION_TYPE intersect | ( | const AABB & | bb | ) | const |
Returns one of the intersection types. If either of the aabbs are invalid, then OUTSIDE is returned.
bool isSimilarTo | ( | const AABB & | b, |
glm::float_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. Untested -- This function is not represented in our unit tests.
Returns true if AABBs share a face overlap. Untested -- This function is not represented in our unit tests.
void scale | ( | const glm::vec3 & | scale, |
const glm::vec3 & | origin | ||
) |