GLM AABB
Axis aligned bounding box built on GLM
Public Types | Public Member Functions
AABB Class Reference

Standalone axis aligned bounding box implemented built on top of GLM. More...

#include <AABB.hpp>

List of all members.

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 &center, 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 &center, glm::float_t radius)
void extend (const AABB &aabb)
 Expand the AABB to encompass the given aabb.
void extendDisk (const glm::vec3 &center, 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

Detailed Description

Standalone axis aligned bounding box implemented built on top of GLM.


Constructor & Destructor Documentation

AABB ( const glm::vec3 &  center,
glm::float_t  radius 
)

Builds an AABB that encompasses a sphere.

Parameters:
[in]centerCenter of the sphere.
[in]radiusRadius of the sphere.

Member Function Documentation

void extend ( const glm::vec3 &  center,
glm::float_t  radius 
)

Expand the AABB to include a sphere centered at center and of radius radius.

Parameters:
[in]centerCenter of sphere.
[in]radiusRadius 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.

bool overlaps ( const AABB bb) const

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 
)

Scale the AABB by scale, centered around origin.

Parameters:
[in]scale3D vector specifying scale along each axis.
[in]originOrigin of scaling operation. Most useful origin would be the center of the AABB.

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