|  | overview |  | wiki |  | api reference |  | download

- Main Page
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

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)
BoundingBox & | operator*= (const Matrix &matrix)

## Static Public Member Functions

static const BoundingBox & | empty ()

## Public Attributes

Vector3 | min
Vector3 | max

## Detailed Description

Defines a 3-dimensional axis-aligned bounding box.

## Constructor & Destructor Documentation

gameplay::BoundingBox::BoundingBox | ( |  | ) |

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:

  min | The minimum point of the bounding box.
  max | The 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:

  minX | The x coordinate of the minimum point of the bounding box.
  minY | The y coordinate of the minimum point of the bounding box.
  minZ | The z coordinate of the minimum point of the bounding box.
  maxX | The x coordinate of the maximum point of the bounding box.
  maxY | The y coordinate of the maximum point of the bounding box.
  maxZ | The z coordinate of the maximum point of the bounding box.

gameplay::BoundingBox::BoundingBox | ( | const BoundingBox & | copy | ) |

Constructs a new bounding box from the given bounding box.

Parameters:

  copy | The bounding box to copy.

gameplay::BoundingBox::~BoundingBox | ( |  | ) |

Destructor.

## Member Function Documentation

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

Returns an empty bounding box.

Vector3 gameplay::BoundingBox::getCenter | ( |  | ) | const

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.

void gameplay::BoundingBox::getCenter | ( | Vector3 * | dst | ) | const

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:

  dst | The vector to store the result in.

void gameplay::BoundingBox::getCorners | ( | Vector3 * | dst | ) | const

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:

  dst | The 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:

  box | The 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:

  sphere | The 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:

  frustum | The 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:

  plane | The 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:

  ray | The 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.

bool gameplay::BoundingBox::isEmpty | ( |  | ) | const

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:

  sphere | The bounding sphere to merge with.

void gameplay::BoundingBox::merge | ( | const BoundingBox & | box | ) |

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

Parameters:

  box | The bounding box to merge with.

BoundingBox& gameplay::BoundingBox::operator*= | ( | const Matrix & | matrix | ) | `[inline]`

Transforms this bounding box by the given matrix.

Parameters:

  matrix | The 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:

  min | The minimum point of the bounding box.
  max | The 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:

  minX | The x coordinate of the minimum point of the bounding box.
  minY | The y coordinate of the minimum point of the bounding box.
  minZ | The z coordinate of the minimum point of the bounding box.
  maxX | The x coordinate of the maximum point of the bounding box.
  maxY | The y coordinate of the maximum point of the bounding box.
  maxZ | The 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:

  box | The bounding box to set to.

void gameplay::BoundingBox::set | ( | const BoundingSphere & | sphere | ) |

Sets this box to tightly contain the specified bounding sphere.

Parameters:

  sphere | The sphere to contain.

void gameplay::BoundingBox::transform | ( | const Matrix & | matrix | ) |

Transforms the bounding box by the given transformation matrix.

Parameters:

  matrix | The transformation matrix to transform by.

## Member Data Documentation

Vector3 gameplay::BoundingBox::max

The maximum point.

Vector3 gameplay::BoundingBox::min

The minimum point.

All Classes Functions Variables Typedefs Enumerations Enumerator