Moby
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Moby::AABB Class Reference

An axis-aligned bounding box. More...

#include <AABB.h>

Inheritance diagram for Moby::AABB:
Moby::BV

Public Member Functions

template<class InputIterator >
 AABB (InputIterator begin, InputIterator end)
 Constructs an axis-aligned bounding box using a set of points. More...
 
virtual void transform (const Ravelin::Transform3d &T, BV *result) const
 Transforms the OBB using the given transform.
 
virtual bool outside (const Point3d &point, double tol=NEAR_ZERO) const
 Determines whether a point is outside the bounding volume.
 
virtual bool intersects (const LineSeg3 &seg, double &tmin, double tmax, Point3d &q) const
 Determines whether a line segment intersects the bounding volume.
 
virtual std::ostream & to_vrml (std::ostream &out, const Ravelin::Pose3d &T) const
 Sends this AABB to VRML.
 
virtual BVPtr calc_swept_BV (CollisionGeometryPtr g, const Ravelin::SVelocityd &v) const
 Constructs a velocity expanded OBB using the AABB.
 
virtual double calc_volume () const
 Calculates the volume of this AABB.
 
virtual boost::shared_ptr
< const Ravelin::Pose3d > 
get_relative_pose () const
 Gets the associated pose for this bounding volume.
 
virtual Point3d get_lower_bounds () const
 Gets the lower bounds for this AABB using an OBB.
 
virtual Point3d get_upper_bounds () const
 Gets the upper bounds for this AABB using an OBB.
 
OBB get_OBB () const
 Gets the AABB as an OBB.
 
AABBoperator= (const AABB &a)
 Copies an AABB.
 
template<class InputIterator >
 AABB (InputIterator begin, InputIterator end)
 Constructs an axis-aligned bounding box using a set of points. More...
 
- Public Member Functions inherited from Moby::BV
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.
 
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 (const AABB &a, const AABB &b)
 Determines whether two AABBs overlap.
 
static bool intersects (const AABB &a, const AABB &b, const Ravelin::Transform3d &aTb)
 
static bool outside (const AABB &a, const Point3d &point, double tol=NEAR_ZERO)
 Determines whether a point is outside of a AABB.
 
static bool intersects (const AABB &a, const LineSeg3 &seg, double &tmin, double tmax, Point3d &q)
 Determines whether an OBB and a line/ray/line segment intersect. More...
 
static void get_closest_point (const AABB &a, const Point3d &p, Point3d &closest)
 Gets the closest point on the AABB to a point.
 
static double get_farthest_point (const AABB &a, const Point3d &p, Point3d &farthest)
 Gets the farthest point on the AABB to a point. More...
 
- Static Public Member Functions inherited from Moby::BV
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

Point3d minp
 The lower corner of the AABB.
 
Point3d maxp
 The upper corner of the AABB;.
 
- Public Attributes inherited from Moby::BV
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 axis-aligned bounding box.

Constructor & Destructor Documentation

template<class InputIterator >
Moby::AABB::AABB ( InputIterator  begin,
InputIterator  end 
)

Constructs an axis-aligned bounding box using a set of points.

Parameters
beginan iterator to the beginning of a container of type Ravelin::Vector3
endan iterator to the end of a container of type Ravelin::Vector3
template<class InputIterator >
Moby::AABB::AABB ( InputIterator  begin,
InputIterator  end 
)

Constructs an axis-aligned bounding box using a set of points.

Parameters
beginan iterator to the beginning of a container of type Ravelin::Vector3
endan iterator to the end of a container of type Ravelin::Vector3

Member Function Documentation

double AABB::get_farthest_point ( const AABB a,
const Point3d p,
Point3d farthest 
)
static

Gets the farthest point on the AABB to a point.

Returns the squared distance to the farthest point

References get_relative_pose(), maxp, and minp.

bool AABB::intersects ( const AABB a,
const LineSeg3 seg,
double &  tmin,
double  tmax,
Point3d q 
)
static

Determines whether an OBB and a line/ray/line segment intersect.

When intersecting, return intersection distance tmin and point q of intersection.

Parameters
athe OBB to check for intersection
segthe line segment to check for intersection
tminon entry, contains the minimum value of the line parameter- for a line segment, this will generally be 0; when an intersection occurs, this will contain the distance of intersection from the tmin that was input on return
tmaxthe maximum value of the line parameter- for a line segment, this will generally be 1
qcontains the point of intersection, if any, on return
Returns
true if the OBB and line intersect, false otherwise
Note
code adapted from [Ericson, 2005], pp. 180-181

References maxp, and minp.


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