13 #include <boost/tuple/tuple.hpp>
14 #include <boost/enable_shared_from_this.hpp>
15 #include <boost/foreach.hpp>
16 #include <Ravelin/Vector3d.h>
17 #include <Ravelin/Pose3d.h>
18 #include <Moby/Constants.h>
19 #include <Moby/Types.h>
38 class BV :
public boost::enable_shared_from_this<BV>
44 virtual std::ostream&
to_vrml(std::ostream& out,
const Ravelin::Pose3d& T)
const = 0
48 virtual bool outside(
const Point3d& point,
double tol = NEAR_ZERO)
const = 0;
57 virtual void transform(
const Ravelin::Transform3d& T,
BV* result)
const = 0;
80 static bool intersects(
const BV* a,
const BV* b,
const Ravelin::Transform3d& T);
84 BVPtr get_this() {
return boost::dynamic_pointer_cast<
BV>(shared_from_this()); }
85 boost::shared_ptr<const BV> get_this()
const {
return boost::dynamic_pointer_cast<
const BV>(shared_from_this()); }
86 bool is_leaf()
const {
return children.empty(); }
88 template <
class OutputIterator>
89 OutputIterator
get_all_BVs(OutputIterator begin)
const;
91 template <
class OutputIterator>
94 template <
class OutputIterator>
95 static OutputIterator
intersect_BV_trees(
BVPtr a,
BVPtr b,
const Ravelin::Transform3d& aTb,
const Ravelin::Transform3d& bTa, OutputIterator output_begin);
120 static bool intersects(
const OBB* O,
const AABB* A,
const Ravelin::Transform3d& OTA);
122 static bool intersects(
const OBB* O,
const SSR* S,
const Ravelin::Transform3d& OTS);
124 static bool intersects(
const OBB* O,
const SSL* S,
const Ravelin::Transform3d& OTS);
128 static bool intersects(
const AABB* A,
const SSL* S,
const Ravelin::Transform3d& ATS);
130 static bool intersects(
const SSR* S,
const AABB* A,
const Ravelin::Transform3d& STA);
134 static bool intersects(
const SSR* S,
const SSL* B,
const Ravelin::Transform3d& STB);
static bool intersects(BVPtr a, BVPtr b)
Convenience method.
Definition: BV.h:68
virtual boost::shared_ptr< const Ravelin::Pose3d > get_relative_pose() const =0
Gets the associated pose for this bounding volume.
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...
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...
boost::shared_ptr< BV > BVPtr
Bounding volume (BV) smart pointer.
Definition: Types.h:92
static double calc_distance(BVPtr a, BVPtr b, Point3d &cp1, Point3d &cp2)
Convenience method.
Definition: BV.h:74
A sphere-swept rectangle (SSR) that optionally allows building an SSR tree.
Definition: SSR.h:35
An oriented bounding box that optionally allows building an OBB tree.
Definition: OBB.h:38
An abstract bounding volume.
Definition: BV.h:38
virtual std::ostream & to_vrml(std::ostream &out, const Ravelin::Pose3d &T) const =0
Virtual function for outputting the bounding volume to VRML.
virtual BVPtr calc_swept_BV(CollisionGeometryPtr g, const Ravelin::SVelocityd &v) const =0
Virtual function that calculates a velocity-expanded BV.
static double calc_distance(BVPtr a, BVPtr b, const Ravelin::Transform3d &aTb, Point3d &cp1, Point3d &cp2)
Convenience method.
Definition: BV.h:77
static bool intersects(BVPtr a, BVPtr b, const Ravelin::Transform3d &T)
Convenience method.
Definition: BV.h:71
OutputIterator get_all_leafs(OutputIterator begin) const
Gets all leaf nodes.
Definition: BV.h:32
boost::shared_ptr< CollisionGeometry > CollisionGeometryPtr
Collision geometry smart pointer.
Definition: Types.h:77
boost::shared_ptr< void > userdata
Userdata for the BV.
Definition: BV.h:98
An axis-aligned bounding box.
Definition: AABB.h:16
A sphere-swept line (SSL) that optionally allows building an SSL tree.
Definition: SSL.h:26
virtual double calc_volume() const =0
Gets the volume for this bounding volume.
OutputIterator get_all_BVs(OutputIterator begin) const
Gets all BV nodes.
Definition: BV.h:13
Ravelin::Vector3d Point3d
Typedef to distinguish between a 3D vector and a point.
Definition: Types.h:47
CollisionGeometryPtr geom
The collision geometry associated with this bounding volume.
Definition: BV.h:101
std::pair< Point3d, Point3d > LineSeg3
Typedef to make specifying line segments easier.
Definition: Types.h:50
virtual bool outside(const Point3d &point, double tol=NEAR_ZERO) const =0
Determines whether a point is outside the bounding volume.
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.
Definition: BV.h:70
A sphere used for bounding geometry.
Definition: BoundingSphere.h:16
std::list< BVPtr > children
The children of this BV.
Definition: BV.h:104
virtual bool intersects(const LineSeg3 &seg, double &tmin, double tmax, Point3d &q) const =0
Determines whether a line segment intersects the bounding volume.
virtual void transform(const Ravelin::Transform3d &T, BV *result) const =0
Virtual function for transforming the BV.