Simbody  3.6
SimTK::OrientedBoundingBox Class Reference

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

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().

Constructor & Destructor Documentation

◆ OrientedBoundingBox() [1/3]

SimTK::OrientedBoundingBox::OrientedBoundingBox ( )

◆ OrientedBoundingBox() [2/3]

SimTK::OrientedBoundingBox::OrientedBoundingBox ( const Transform transform,
const Vec3 size 
)

Create an OrientedBoundingBox.

Parameters
transformspecifies the position and orientation of the box
sizespecifies the dimensions of the box

◆ OrientedBoundingBox() [3/3]

SimTK::OrientedBoundingBox::OrientedBoundingBox ( const Vector_< Vec3 > &  points)
explicit

Create an OrientedBoundingBox which encloses a set of points.

Member Function Documentation

◆ getTransform()

const Transform& SimTK::OrientedBoundingBox::getTransform ( ) const

Get the position and orientation of the box.

◆ getSize()

const Vec3& SimTK::OrientedBoundingBox::getSize ( ) const

Get the dimensions of the box.

◆ containsPoint()

bool SimTK::OrientedBoundingBox::containsPoint ( const Vec3 point) const

Determine whether a point is inside the box.

◆ intersectsBox()

bool SimTK::OrientedBoundingBox::intersectsBox ( const OrientedBoundingBox box) const

Determine whether this box intersects another bounding box at any point.

◆ intersectsRay()

bool SimTK::OrientedBoundingBox::intersectsRay ( const Vec3 origin,
const UnitVec3 direction,
Real distance 
) const

Determine whether a ray intersects this bounding box.

Parameters
originthe position at which the ray begins
directionthe ray direction
distanceif 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

◆ findNearestPoint()

Vec3 SimTK::OrientedBoundingBox::findNearestPoint ( const Vec3 position) const

Given a point in space, find the point inside the bounding box which is nearest to it.

◆ getCorners()

void SimTK::OrientedBoundingBox::getCorners ( Vec3  corners[8]) const

Get the locations of the eight corners of the box.

Parameters
cornersthe corner locations are stored in this array

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