Moby
DummyBV.h
1 /****************************************************************************
2  * Copyright 2009 Evan Drumwright
3  * This library is distributed under the terms of the Apache V2.0
4  * License (obtainable from http://www.apache.org/licenses/LICENSE-2.0).
5  ****************************************************************************/
6 
7 #ifndef _MOBY_DUMMY_BV_H_
8 #define _MOBY_DUMMY_BV_H_
9 
10 #include <Moby/BV.h>
11 
12 namespace Moby {
13 
15 
23 class DummyBV : public BV
24 {
25  public:
26  virtual ~DummyBV() {}
27 
29  std::ostream& to_vrml(std::ostream& out, const Ravelin::Pose3d& T) const { return out; }
30 
32  virtual boost::shared_ptr<const Ravelin::Pose3d> get_relative_pose() const { return GLOBAL; }
33 
35  virtual bool outside(const Point3d& point, double tol = NEAR_ZERO) const { return false; }
36 
38  virtual bool intersects(const LineSeg3& seg, double& tmin, double tmax, Point3d& q) const { q = seg.first*tmin + seg.second*((double) 1.0 - tmin); return true; }
39 
41 
47  virtual BVPtr calc_swept_BV(CollisionGeometryPtr g, const Ravelin::SVelocityd& v) const { return boost::const_pointer_cast<BV>(get_this()); }
48 
50  virtual double calc_volume() const { return 0.0; }
51 
53  virtual Point3d get_lower_bounds() const { double INF = std::numeric_limits<double>::max(); return Point3d(-INF, -INF, -INF); }
54 
56  virtual Point3d get_upper_bounds() const { double INF = std::numeric_limits<double>::max(); return Point3d(INF, INF, INF); }
57 
59  virtual void transform(const Ravelin::Transform3d& T, BV* result) const {}
60 }; // end class
61 
62 } // end namespace
63 
64 #endif
65 
boost::shared_ptr< BV > BVPtr
Bounding volume (BV) smart pointer.
Definition: Types.h:92
virtual Point3d get_lower_bounds() const
Gets the lower bounds.
Definition: DummyBV.h:53
An abstract bounding volume.
Definition: DummyBV.h:23
virtual double calc_volume() const
Volume will be zero.
Definition: DummyBV.h:50
An abstract bounding volume.
Definition: BV.h:38
boost::shared_ptr< CollisionGeometry > CollisionGeometryPtr
Collision geometry smart pointer.
Definition: Types.h:77
virtual bool outside(const Point3d &point, double tol=NEAR_ZERO) const
Determines whether a point is outside the bounding volume.
Definition: DummyBV.h:35
virtual BVPtr calc_swept_BV(CollisionGeometryPtr g, const Ravelin::SVelocityd &v) const
Virtual function that calculates a velocity-expanded BV.
Definition: DummyBV.h:47
Ravelin::Vector3d Point3d
Typedef to distinguish between a 3D vector and a point.
Definition: Types.h:47
virtual boost::shared_ptr< const Ravelin::Pose3d > get_relative_pose() const
Gets the associated pose for this bounding volume.
Definition: DummyBV.h:32
virtual Point3d get_upper_bounds() const
Gets the upper bounds.
Definition: DummyBV.h:56
std::pair< Point3d, Point3d > LineSeg3
Typedef to make specifying line segments easier.
Definition: Types.h:50
std::ostream & to_vrml(std::ostream &out, const Ravelin::Pose3d &T) const
Nothing will be output.
Definition: DummyBV.h:29
virtual void transform(const Ravelin::Transform3d &T, BV *result) const
Transforms the dummy BV (does nothing)
Definition: DummyBV.h:59
virtual bool intersects(const LineSeg3 &seg, double &tmin, double tmax, Point3d &q) const
Determines whether a line segment intersects the bounding volume.
Definition: DummyBV.h:38