OrientedBoundingBox Class Reference

#include <OrientedBoundingBox.h>

List of all members.


Detailed Description

This class represents a rectangular box with arbitrary position and orientation.

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 TransformgetTransform () const
 Get the position and orientation of the box.
const Vec3getSize () 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.


Constructor & Destructor Documentation

OrientedBoundingBox (  )  [inline]

OrientedBoundingBox ( const Transform transform,
const Vec3 size 
) [inline]

Create an OrientedBoundingBox.

Parameters:
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.


Member Function Documentation

const Transform& getTransform (  )  const [inline]

Get the position and orientation of the box.

const Vec3& getSize (  )  const [inline]

Get the dimensions of the box.

References fkinkryx_p::size.

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.

Parameters:
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.
Returns:
true if an intersection is found, false otherwise

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.

Parameters:
the corner locations are stored in this array


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

Generated on Fri Sep 26 07:44:32 2008 for SimTKcore by  doxygen 1.5.6