overview wiki api reference download
 All Classes Functions Variables Typedefs Enumerations Enumerator
Public Member Functions | Static Public Member Functions | Public Attributes
gameplay::BoundingBox Class Reference

#include <BoundingBox.h>

List of all members.

Public Member Functions

 BoundingBox ()
 BoundingBox (const Vector3 &min, const Vector3 &max)
 BoundingBox (float minX, float minY, float minZ, float maxX, float maxY, float maxZ)
 BoundingBox (const BoundingBox &copy)
 ~BoundingBox ()
Vector3 getCenter () const
void getCenter (Vector3 *dst) const
void getCorners (Vector3 *dst) const
bool intersects (const BoundingBox &box) const
bool intersects (const BoundingSphere &sphere) const
bool intersects (const Frustum &frustum) const
float intersects (const Plane &plane) const
float intersects (const Ray &ray) const
bool isEmpty () const
void merge (const BoundingSphere &sphere)
void merge (const BoundingBox &box)
void set (const Vector3 &min, const Vector3 &max)
void set (float minX, float minY, float minZ, float maxX, float maxY, float maxZ)
void set (const BoundingBox &box)
void set (const BoundingSphere &sphere)
void transform (const Matrix &matrix)
BoundingBoxoperator*= (const Matrix &matrix)

Static Public Member Functions

static const BoundingBoxempty ()

Public Attributes

Vector3 min
Vector3 max

Detailed Description

Defines a 3-dimensional axis-aligned bounding box.


Constructor & Destructor Documentation

Constructs an empty bounding box at the origin.

gameplay::BoundingBox::BoundingBox ( const Vector3 min,
const Vector3 max 
)

Constructs a new bounding box from the specified values.

Parameters:
minThe minimum point of the bounding box.
maxThe maximum point of the bounding box.
gameplay::BoundingBox::BoundingBox ( float  minX,
float  minY,
float  minZ,
float  maxX,
float  maxY,
float  maxZ 
)

Constructs a new bounding box from the specified values.

Parameters:
minXThe x coordinate of the minimum point of the bounding box.
minYThe y coordinate of the minimum point of the bounding box.
minZThe z coordinate of the minimum point of the bounding box.
maxXThe x coordinate of the maximum point of the bounding box.
maxYThe y coordinate of the maximum point of the bounding box.
maxZThe z coordinate of the maximum point of the bounding box.

Constructs a new bounding box from the given bounding box.

Parameters:
copyThe bounding box to copy.

Destructor.


Member Function Documentation

static const BoundingBox& gameplay::BoundingBox::empty ( ) [static]

Returns an empty bounding box.

Gets the center point of the bounding box.

This method computes the center point of the box from its min and max.

Returns:
The center point of the bounding box.

Gets the center point of the bounding box.

This method computes the center point of the box from its min and max points and stores the result in dst.

Parameters:
dstThe vector to store the result in.

Gets the corners of the bounding box in the specified array.

The corners are returned as follows: 0 to 3 specify the near face starting at the upper left point when looking towards the origin from the positive z-axis in a counter-clockwise fashion; 4 to 7 specify the far face starting at the upper left point when looking towards the origin from the negative z-axis in a counter-clockwise fashion.

Parameters:
dstThe array to store the corners in. Must be size 8.
bool gameplay::BoundingBox::intersects ( const BoundingBox box) const

Tests whether this bounding box intersects the specified bounding object.

Parameters:
boxThe bounding box to test intersection with.
Returns:
true if the specified bounding box intersects this bounding box; false otherwise.
bool gameplay::BoundingBox::intersects ( const BoundingSphere sphere) const

Tests whether this bounding box intersects the specified bounding sphere.

Parameters:
sphereThe bounding sphere to test intersection with.
Returns:
true if the specified bounding sphere intersects this bounding box; false otherwise.
bool gameplay::BoundingBox::intersects ( const Frustum frustum) const

Tests whether this bounding box intersects the specified frustum.

Parameters:
frustumThe frustum to test intersection with.
Returns:
true if this bounding sphere intersects the specified frustum; false otherwise.
float gameplay::BoundingBox::intersects ( const Plane plane) const

Tests whether this bounding box intersects the specified plane.

Parameters:
planeThe plane to test intersection with.
Returns:
Plane::INTERSECTS_BACK INTERSECTS_BACK if this bounding box is in the negative half-space of the plane, Plane::INTERSECTS_FRONT INTERSECTS_FRONT if it is in the positive half-space of the plane; and Plane::INTERSECTS_INTERSECTING INTERSECTS_INTERSECTING if it intersects the plane.
float gameplay::BoundingBox::intersects ( const Ray ray) const

Tests whether this bounding box intersects the specified ray.

Parameters:
rayThe ray to test intersection with.
Returns:
The distance from the origin of the ray to this bounding box or INTERSECTS_NONE INTERSECTS_NONE if the ray does not intersect this bounding box.

Determines if this bounding box is empty.

Returns:
true if this bounding box is empty; false otherwise.
void gameplay::BoundingBox::merge ( const BoundingSphere sphere)

Sets this bounding box to the smallest bounding box that contains both this bounding box and the specified bounding sphere.

Parameters:
sphereThe bounding sphere to merge with.

Sets this bounding box to the smallest bounding box that contains both this bounding object and the specified bounding box.

Parameters:
boxThe bounding box to merge with.
BoundingBox& gameplay::BoundingBox::operator*= ( const Matrix matrix) [inline]

Transforms this bounding box by the given matrix.

Parameters:
matrixThe matrix to transform by.
Returns:
This bounding box, after the transformation occurs.
void gameplay::BoundingBox::set ( const Vector3 min,
const Vector3 max 
)

Sets this bounding box to the specified values.

Parameters:
minThe minimum point of the bounding box.
maxThe maximum point of the bounding box.
void gameplay::BoundingBox::set ( float  minX,
float  minY,
float  minZ,
float  maxX,
float  maxY,
float  maxZ 
)

Sets this bounding box to the specified values.

Parameters:
minXThe x coordinate of the minimum point of the bounding box.
minYThe y coordinate of the minimum point of the bounding box.
minZThe z coordinate of the minimum point of the bounding box.
maxXThe x coordinate of the maximum point of the bounding box.
maxYThe y coordinate of the maximum point of the bounding box.
maxZThe z coordinate of the maximum point of the bounding box.
void gameplay::BoundingBox::set ( const BoundingBox box)

Sets this bounding box to the specified bounding box.

Parameters:
boxThe bounding box to set to.
void gameplay::BoundingBox::set ( const BoundingSphere sphere)

Sets this box to tightly contain the specified bounding sphere.

Parameters:
sphereThe sphere to contain.
void gameplay::BoundingBox::transform ( const Matrix matrix)

Transforms the bounding box by the given transformation matrix.

Parameters:
matrixThe transformation matrix to transform by.

Member Data Documentation

The maximum point.

The minimum point.

 All Classes Functions Variables Typedefs Enumerations Enumerator