Overview     Modules     Class Hierarchy     Classes     Members  

tlp::BoundingBox Struct Reference

This class represents the 3D bounding box of an object. It is mostly used to determine whether or not two object are in a state of collision. More...

#include <BoundingBox.h>

Inheritance diagram for tlp::BoundingBox:
Collaboration diagram for tlp::BoundingBox:

List of all members.

Public Member Functions

  • BoundingBox ()
    Creates an invalid boundig box. The minimum is in (1, 1, 1) and the maximum in (-1, -1, -1).
  • BoundingBox (const tlp::Vec3f &min, const tlp::Vec3f &max)
    Creates a bounding box that must be valid. Validity is checked in debug mode by an assert.
  • Vec3f center () const
    gets the geometrical center of the bounding box. An assertion is raised in debug mode if the BoundingBox is not valid.
  • void expand (const tlp::Vec3f &coord)
    Expands the bounding box to one containing the vector passed as param. If the parameter is inside the bounding box, it remains unchanged.
  • void translate (const tlp::Vec3f &vec)
    Translates the bounding box of the distance given by the parameter vector.
  • bool isValid () const
    Checks whether this bounding box's lowest point is less than it's highest point. "Less Than" means axis-by-axis comparison, e.g. x1 < x2 && y1 < y2 && z1 < z3.
  • void getCompleteBB (Vec3f bb[8]) const
    The vector passed as param is modified to contain the 8 points of the bounding box. The points are, in order : 0: lower leftmost closest point (the bounding box's minimum) 1: lower rightmost closest point 2: highest rightmost closest point 3: highest leftmost closest point 4: lower rightmost farthest point 5: lower rightmost farthest point 6: highest rightmost farthest point 7: highest leftmost farthest point.

Detailed Description

This class represents the 3D bounding box of an object. It is mostly used to determine whether or not two object are in a state of collision.

It is composed of two voxels, the first one (A) being the lowest point, the second (B) being the highest. As a bounding box is a mathematical entity describing the lowest and highest points, whether these points are in the top-left corner or lower-right corner depends on the axes we use. Below is a crude ASCII-art description of tthe axes we use in our 3D world and the points where the min and max are thus positioned. Through the rest of this class's documentation, it will be assumed that this is the convention.

y | | |_____ x / / z

_________ B / /| / / | /________/ | | | | | | | | | / |________|/ A

Author : Tulip team


Constructor & Destructor Documentation

tlp::BoundingBox::BoundingBox (  )  [inline]

Creates an invalid boundig box. The minimum is in (1, 1, 1) and the maximum in (-1, -1, -1).

tlp::BoundingBox::BoundingBox ( const tlp::Vec3f min,
const tlp::Vec3f max 
) [inline]

Creates a bounding box that must be valid. Validity is checked in debug mode by an assert.

Parameters:
min The lower left closest point of the box.
max The higher left most farther point of the box.

Member Function Documentation

Vec3f tlp::BoundingBox::center (  )  const [inline]

gets the geometrical center of the bounding box. An assertion is raised in debug mode if the BoundingBox is not valid.

Returns:
The center of the bounding box :Vec3f
void tlp::BoundingBox::expand ( const tlp::Vec3f coord  )  [inline]

Expands the bounding box to one containing the vector passed as param. If the parameter is inside the bounding box, it remains unchanged.

Parameters:
coord A point in the 3D space we want the bounding box to encompass.
Returns:
void
void tlp::BoundingBox::getCompleteBB ( Vec3f  bb[8]  )  const [inline]

The vector passed as param is modified to contain the 8 points of the bounding box. The points are, in order : 0: lower leftmost closest point (the bounding box's minimum) 1: lower rightmost closest point 2: highest rightmost closest point 3: highest leftmost closest point 4: lower rightmost farthest point 5: lower rightmost farthest point 6: highest rightmost farthest point 7: highest leftmost farthest point.

Crude ASCII art again, sorry for your eyes.

6_________ 7 /| /| / | / | 3/__|_____/2 | | |_____|__| | /4 | /5 | / | / |/_______|/ 0 1

Parameters:
bb A vector in which to put the points of the bounding box.
Returns:
void
bool tlp::BoundingBox::isValid (  )  const [inline]

Checks whether this bounding box's lowest point is less than it's highest point. "Less Than" means axis-by-axis comparison, e.g. x1 < x2 && y1 < y2 && z1 < z3.

Returns:
bool Whether this bounding box is valid.
void tlp::BoundingBox::translate ( const tlp::Vec3f vec  )  [inline]

Translates the bounding box of the distance given by the parameter vector.

Parameters:
vec The distance in 3D space to translate this bounding box by.
Returns:
void


Tulip Software by LaBRI Visualization Team    2001 - 2011