Simbody
3.5
|
This class represents a rectangular box with arbitrary position and orientation. More...
Public Member Functions | |
OrientedBoundingBox () | |
OrientedBoundingBox (const Transform &transform, const Vec3 &size) | |
Create an OrientedBoundingBox. More... | |
OrientedBoundingBox (const Vector_< Vec3 > &points) | |
Create an OrientedBoundingBox which encloses a set of points. More... | |
const Transform & | getTransform () const |
Get the position and orientation of the box. More... | |
const Vec3 & | getSize () const |
Get the dimensions of the box. More... | |
bool | containsPoint (const Vec3 &point) const |
Determine whether a point is inside the box. More... | |
bool | intersectsBox (const OrientedBoundingBox &box) const |
Determine whether this box intersects another bounding box at any point. More... | |
bool | intersectsRay (const Vec3 &origin, const UnitVec3 &direction, Real &distance) const |
Determine whether a ray intersects this bounding box. More... | |
Vec3 | findNearestPoint (const Vec3 &position) const |
Given a point in space, find the point inside the bounding box which is nearest to it. More... | |
void | getCorners (Vec3 corners[8]) const |
Get the locations of the eight corners of the box. More... | |
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().
SimTK::OrientedBoundingBox::OrientedBoundingBox | ( | ) |
Create an OrientedBoundingBox.
transform | specifies the position and orientation of the box |
size | specifies the dimensions of the box |
Create an OrientedBoundingBox which encloses a set of points.
const Transform& SimTK::OrientedBoundingBox::getTransform | ( | ) | const |
Get the position and orientation of the box.
const Vec3& SimTK::OrientedBoundingBox::getSize | ( | ) | const |
Get the dimensions of the box.
bool SimTK::OrientedBoundingBox::containsPoint | ( | const Vec3 & | point | ) | const |
Determine whether a point is inside the box.
bool SimTK::OrientedBoundingBox::intersectsBox | ( | const OrientedBoundingBox & | box | ) | const |
Determine whether this box intersects another bounding box at any point.
bool SimTK::OrientedBoundingBox::intersectsRay | ( | const Vec3 & | origin, |
const UnitVec3 & | direction, | ||
Real & | distance | ||
) | const |
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 SimTK::OrientedBoundingBox::getCorners | ( | Vec3 | corners[8] | ) | const |
Get the locations of the eight corners of the box.
corners | the corner locations are stored in this array |