#include <OrientedBoundingBox.h>
It is used in collision detection as a bounding volume for geometry of various types.
An OrientedBoundingBox is defined by a Transform that specifies its position and orientation, and a Vec3 that specifies its size. In the reference frame defined by the Transform, one corner is at the origin and the opposite corner is at the point returned by getSize().
Public Member Functions | |
OrientedBoundingBox () | |
OrientedBoundingBox (const Transform &transform, const Vec3 &size) | |
Create an OrientedBoundingBox. | |
OrientedBoundingBox (const Vector_< Vec3 > &points) | |
Create an OrientedBoundingBox which encloses a set of points. | |
const Transform & | getTransform () const |
Get the position and orientation of the box. | |
const Vec3 & | getSize () const |
Get the dimensions of the box. | |
bool | containsPoint (const Vec3 &point) const |
Determine whether a point is inside the box. | |
bool | intersectsBox (const OrientedBoundingBox &box) const |
Determine whether this box intersects another bounding box at any point. | |
bool | intersectsRay (const Vec3 &origin, const UnitVec3 &direction, Real &distance) const |
Determine whether a ray intersects this bounding box. | |
Vec3 | findNearestPoint (const Vec3 &position) const |
Given a point in space, find the point inside the bounding box which is nearest to it. | |
void | getCorners (Vec3 corners[8]) const |
Get the locations of the eight corners of the box. |
OrientedBoundingBox | ( | ) | [inline] |
OrientedBoundingBox | ( | const Transform & | transform, | |
const Vec3 & | size | |||
) | [inline] |
Create an OrientedBoundingBox.
transform | specifies the position and orientation of the box | |
size | specifies the dimensions of the box |
OrientedBoundingBox | ( | const Vector_< Vec3 > & | points | ) |
Create an OrientedBoundingBox which encloses a set of points.
const Transform& getTransform | ( | ) | const [inline] |
Get the position and orientation of the box.
const Vec3& getSize | ( | ) | const [inline] |
bool containsPoint | ( | const Vec3 & | point | ) | const |
Determine whether a point is inside the box.
bool intersectsBox | ( | const OrientedBoundingBox & | box | ) | const |
Determine whether this box intersects another bounding box at any point.
Determine whether a ray intersects this bounding box.
origin | the position at which the ray begins | |
direction | the ray direction | |
distance | if an intersection is found, the distance from the ray origin to the intersection point is stored in this. Otherwise, it is left unchanged. |
Given a point in space, find the point inside the bounding box which is nearest to it.
void getCorners | ( | Vec3 | corners[8] | ) | const |
Get the locations of the eight corners of the box.
the | corner locations are stored in this array |