Moby
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Moby::BV Class Referenceabstract

An abstract bounding volume. More...

#include <BV.h>

Inheritance diagram for Moby::BV:
Moby::AABB Moby::BoundingSphere Moby::DummyBV Moby::OBB Moby::SSL Moby::SSR

Public Member Functions

virtual std::ostream & to_vrml (std::ostream &out, const Ravelin::Pose3d &T) const =0
 Virtual function for outputting the bounding volume to VRML.
 
virtual bool outside (const Point3d &point, double tol=NEAR_ZERO) const =0
 Determines whether a point is outside the bounding volume.
 
virtual bool intersects (const LineSeg3 &seg, double &tmin, double tmax, Point3d &q) const =0
 Determines whether a line segment intersects the bounding volume.
 
virtual boost::shared_ptr
< const Ravelin::Pose3d > 
get_relative_pose () const =0
 Gets the associated pose for this bounding volume.
 
virtual void transform (const Ravelin::Transform3d &T, BV *result) const =0
 Virtual function for transforming the BV.
 
virtual BVPtr calc_swept_BV (CollisionGeometryPtr g, const Ravelin::SVelocityd &v) const =0
 Virtual function that calculates a velocity-expanded BV. More...
 
BVPtr get_this ()
 
boost::shared_ptr< const BVget_this () const
 
bool is_leaf () const
 
template<class OutputIterator >
OutputIterator get_all_BVs (OutputIterator begin) const
 Gets all BV nodes. More...
 
template<class OutputIterator >
OutputIterator get_all_leafs (OutputIterator begin) const
 Gets all leaf nodes.
 
virtual double calc_volume () const =0
 Gets the volume for this bounding volume.
 
virtual Point3d get_lower_bounds () const =0
 Gets the lower bound on a AABB around the bounding volume when a transform of T is applied.
 
virtual Point3d get_upper_bounds () const =0
 Gets the upper bound on a AABB around the bounding volume when a transform of T is applied.
 
template<class OutputIterator >
OutputIterator get_all_BVs (OutputIterator begin) const
 Gets all BV nodes. More...
 
template<class OutputIterator >
OutputIterator get_all_leafs (OutputIterator begin) const
 Gets all leaf nodes.
 
template<class OutputIterator >
OutputIterator intersect_BV_trees (BVPtr a, BVPtr b, const Ravelin::Transform3d &aTb, const Ravelin::Transform3d &bTa, OutputIterator output_begin)
 Intersects two BV trees; returns list of all leaf-level intersecting BVs. More...
 

Static Public Member Functions

static bool intersects (BVPtr a, BVPtr b)
 Convenience method.
 
static bool intersects (BVPtr a, BVPtr b, const Ravelin::Transform3d &T)
 Convenience method.
 
static double calc_distance (BVPtr a, BVPtr b, Point3d &cp1, Point3d &cp2)
 Convenience method.
 
static double calc_distance (BVPtr a, BVPtr b, const Ravelin::Transform3d &aTb, Point3d &cp1, Point3d &cp2)
 Convenience method.
 
static bool intersects (const BV *a, const BV *b)
 Computes whether two abstract bounding volumes intersect.
 
static bool intersects (const BV *a, const BV *b, const Ravelin::Transform3d &T)
 
static double calc_distance (const BV *a, const BV *b, Point3d &cp1, Point3d &cp2)
 Computes the distance between two abstract bounding volumes and stores the closest points. More...
 
static double calc_distance (const BV *a, const BV *b, const Ravelin::Transform3d &aTb, Point3d &cp1, Point3d &cp2)
 
template<class OutputIterator >
static OutputIterator intersect_BV_trees (BVPtr a, BVPtr b, const Ravelin::Transform3d &aTb, const Ravelin::Transform3d &bTa, OutputIterator output_begin)
 Intersects two BV trees; returns list of all leaf-level intersecting BVs. More...
 

Public Attributes

boost::shared_ptr< void > userdata
 Userdata for the BV.
 
CollisionGeometryPtr geom
 The collision geometry associated with this bounding volume.
 
std::list< BVPtrchildren
 The children of this BV.
 

Detailed Description

An abstract bounding volume.

Note
the BV is generally constructed such that its frame is aligned with that of the underlying rigid body (or collision geometry). Therefore, the center of the BV is computed relative to the center-of-mass of the body (or the center of the geometry). The orientation of the BV will always be identical to the orientation of the rigid body (or collision geometry).

Member Function Documentation

double BV::calc_distance ( const BV a,
const BV b,
Point3d cp1,
Point3d cp2 
)
static

Computes the distance between two abstract bounding volumes and stores the closest points.

Parameters
cp1the closest point on a to b
cp2the closest point on b to a
Returns
the distance between the bounding volumes
virtual BVPtr Moby::BV::calc_swept_BV ( CollisionGeometryPtr  g,
const Ravelin::SVelocityd &  v 
) const
pure virtual

Virtual function that calculates a velocity-expanded BV.

Parameters
gthe geometry that this bounding volume represents
vthe "velocity" to sweep by
Returns
the velocity-expanded bounding volume

Implemented in Moby::DummyBV, Moby::OBB, Moby::SSR, Moby::SSL, Moby::AABB, and Moby::BoundingSphere.

template<class OutputIterator >
OutputIterator Moby::BV::get_all_BVs ( OutputIterator  begin) const

Gets all BV nodes.

The output is ordered by levels in the hierarchy.

template<class OutputIterator >
OutputIterator Moby::BV::get_all_BVs ( OutputIterator  begin) const

Gets all BV nodes.

The output is ordered by levels in the hierarchy.

template<class OutputIterator >
OutputIterator Moby::BV::intersect_BV_trees ( BVPtr  a,
BVPtr  b,
const Ravelin::Transform3d &  aTb,
const Ravelin::Transform3d &  bTa,
OutputIterator  output_begin 
)

Intersects two BV trees; returns list of all leaf-level intersecting BVs.

Parameters
athe root of the first BV tree
bthe root of the second BV tree
aTbthe transform from b's frame to a's frame (i.e., inverse(transform(a)) * transform(b))
bTathe transform from a's frame to b's frame (i.e., inverse(transform(b)) * transform(a))
output_beginiterator to the beginning of a list of pairs of type pair<shared_ptr<BV>, shared_ptr<BV> >; first element in each pair comes from the first BV tree, second element comes from the second tree
Returns
iterator to the end of a list of pairs of type pair<shared_ptr<BV>, shared_ptr<BV> >; first element in each pair comes from the first BV tree, second element comes from the second tree
template<class OutputIterator >
OutputIterator Moby::BV::intersect_BV_trees ( BVPtr  a,
BVPtr  b,
const Ravelin::Transform3d &  aTb,
const Ravelin::Transform3d &  bTa,
OutputIterator  output_begin 
)
static

Intersects two BV trees; returns list of all leaf-level intersecting BVs.

Parameters
athe root of the first BV tree
bthe root of the second BV tree
aTbthe transform from b's frame to a's frame (i.e., inverse(transform(a)) * transform(b))
bTathe transform from a's frame to b's frame (i.e., inverse(transform(b)) * transform(a))
output_beginiterator to the beginning of a list of pairs of type pair<shared_ptr<BV>, shared_ptr<BV> >; first element in each pair comes from the first BV tree, second element comes from the second tree
Returns
iterator to the end of a list of pairs of type pair<shared_ptr<BV>, shared_ptr<BV> >; first element in each pair comes from the first BV tree, second element comes from the second tree

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