13 #include <boost/tuple/tuple.hpp> 
   14 #include <boost/enable_shared_from_this.hpp> 
   15 #include <Ravelin/Vector3d.h> 
   16 #include <Ravelin/AAngled.h> 
   17 #include <Ravelin/MatrixNd.h> 
   18 #include <Ravelin/VectorNd.h> 
   19 #include <Ravelin/LinAlgd.h> 
   21 #include <Moby/Constants.h> 
   22 #include <Moby/Types.h> 
   23 #include <Moby/FastThreadable.h> 
   24 #include <Moby/CompGeom.h> 
   44     OBB(
const OBB& o, 
const Ravelin::Vector3d& v);
 
   46     virtual void transform(
const Ravelin::Transform3d& T, 
BV* result) 
const;
 
   52     static bool intersects(
const OBB& a, 
const OBB& b, 
const Ravelin::Transform3d& aTb);
 
   57     virtual std::ostream& 
to_vrml(std::ostream& out, 
const Ravelin::Pose3d& T) 
const;
 
   60     virtual boost::shared_ptr<const Ravelin::Pose3d> 
get_relative_pose()
 const { 
return center.pose; }
 
   65     template <
class ForwardIterator>
 
   66     void expand_to_fit(ForwardIterator begin, ForwardIterator end);
 
   68     template <
class ForwardIterator>
 
   69     OBB(ForwardIterator begin, ForwardIterator end);
 
   71     template <
class ForwardIterator>
 
   74     template <
class OutputIterator>
 
   78     virtual double calc_volume()
 const { 
return l[0] * l[1] * l[2]; }
 
   90     template <
class ForwardIterator>
 
   91     static OBB calc_low_dim_OBB(ForwardIterator begin, ForwardIterator end);
 
   93     template <
class ForwardIterator>
 
   94     static void calc_lengths(
const Ravelin::Vector3d& d1, 
const Ravelin::Vector3d& d2, 
const Ravelin::Vector3d& d3, 
const Point3d& center, ForwardIterator begin, ForwardIterator end, 
double lengths[3]);
 
   96     template <
class ForwardIterator>
 
   97     static void align(ForwardIterator begin, ForwardIterator end, 
const Ravelin::Vector3d& d1, Ravelin::Vector3d& d2);
 
XMLTreePtr save_to_xml_tree() const 
Saves a OBB hiearchy to a XMLTree. 
Definition: OBB.cpp:756
boost::shared_ptr< BV > BVPtr
Bounding volume (BV) smart pointer. 
Definition: Types.h:92
virtual Point3d get_upper_bounds() const 
Gets the upper bounds on the OBB. 
Definition: OBB.cpp:904
virtual BVPtr calc_swept_BV(CollisionGeometryPtr g, const Ravelin::SVelocityd &v) const 
Calculates the velocity-expanded OBB for a body. 
Definition: OBB.cpp:790
static double calc_sq_dist(const OBB &o, const Point3d &p)
Computes the squared distance from a point to an OBB. 
Definition: OBB.cpp:219
static OBBPtr load_from_xml(boost::shared_ptr< const XMLTree > root)
Loads an OBB hierarchy from a XML tree. 
Definition: OBB.cpp:675
An oriented bounding box that optionally allows building an OBB tree. 
Definition: OBB.h:38
Ravelin::Vector3d l
Half-lengths of the OBBs in the three axes directions (i.e., in the box frame) 
Definition: OBB.h:84
static double calc_dist(const OBB &a, const OBB &b, Point3d &cpa, Point3d &cpb)
Determines the distance between two OBBs. 
Definition: OBB.cpp:350
virtual void transform(const Ravelin::Transform3d &T, BV *result) const 
Transforms the OBB using the given transform. 
Definition: OBB.cpp:36
unsigned calc_size() const 
Constructs an OBB from a triangle mesh using the mesh inertia method [Ericson, 2003]. 
Definition: OBB.cpp:209
boost::shared_ptr< OBB > OBBPtr
Oriented bounding box (OBB) smart pointer. 
Definition: Types.h:98
OBB & operator=(const OBB &obb)
Copies an OBB. 
Definition: OBB.cpp:55
An abstract bounding volume. 
Definition: BV.h:38
OutputIterator get_vertices(OutputIterator begin) const 
Gets the eight vertices of the bounding box. 
Definition: OBB.h:723
virtual double calc_volume() const 
Calculates 1/8th of the volume of the bounding box. 
Definition: OBB.h:78
boost::shared_ptr< CollisionGeometry > CollisionGeometryPtr
Collision geometry smart pointer. 
Definition: Types.h:77
boost::shared_ptr< XMLTree > XMLTreePtr
XML tree smart pointer. 
Definition: Types.h:104
virtual boost::shared_ptr< const Ravelin::Pose3d > get_relative_pose() const 
Gets the associated pose for this bounding volume. 
Definition: OBB.h:60
virtual bool intersects(const LineSeg3 &seg, double &tmin, double tmax, Point3d &q) const 
Determines whether a line segment intersects the bounding volume. 
Definition: OBB.h:54
Ravelin::Vector3d Point3d
Typedef to distinguish between a 3D vector and a point. 
Definition: Types.h:47
virtual Point3d get_lower_bounds() const 
Gets the lower bounds on the OBB. 
Definition: OBB.cpp:884
virtual std::ostream & to_vrml(std::ostream &out, const Ravelin::Pose3d &T) const 
Outputs the OBB in VRML format to the given stream. 
Definition: OBB.cpp:546
std::pair< Point3d, Point3d > LineSeg3
Typedef to make specifying line segments easier. 
Definition: Types.h:50
static OBB calc_min_volume_OBB(ForwardIterator begin, ForwardIterator end)
Computes the minimum OBB from a set of points. 
Definition: OBB.h:226
static bool outside(const OBB &a, const Point3d &point, double tol=NEAR_ZERO)
Determines whether a point is outside a OBB to within the given tolerance. 
Definition: OBB.cpp:243
virtual bool outside(const Point3d &point, double tol=NEAR_ZERO) const 
Determines whether a point is outside the bounding volume. 
Definition: OBB.h:56
Point3d center
Center of the bounding box. 
Definition: OBB.h:81
void expand_to_fit(ForwardIterator begin, ForwardIterator end)
Expands this OBB (if necessary) to fit the given points. 
Definition: OBB.h:661
Ravelin::Matrix3d R
Orientation of this OBB. 
Definition: OBB.h:87
static bool intersects(const OBB &a, const OBB &b)
Determines whether two OBBs intersect another. 
Definition: OBB.cpp:403