13 #include <boost/tuple/tuple.hpp>
14 #include <boost/enable_shared_from_this.hpp>
15 #include <Ravelin/LinAlgd.h>
16 #include <Ravelin/Vector3d.h>
17 #include <Ravelin/AAngled.h>
19 #include <Moby/Constants.h>
20 #include <Moby/FastThreadable.h>
21 #include <Moby/Types.h>
22 #include <Moby/CompGeom.h>
41 SSR(
const SSR& s,
const Ravelin::Vector3d& v);
49 static bool intersects(
const SSR& a,
const SSR& b,
const Ravelin::Transform3d& T);
54 boost::shared_ptr<SSR> get_this() {
return boost::dynamic_pointer_cast<
SSR>(shared_from_this()); }
55 boost::shared_ptr<const SSR> get_this()
const {
return boost::dynamic_pointer_cast<
const SSR>(shared_from_this()); }
56 virtual std::ostream&
to_vrml(std::ostream& out,
const Ravelin::Pose3d& T)
const;
58 virtual boost::shared_ptr<const Ravelin::Pose3d>
get_relative_pose()
const {
return center.pose; }
59 virtual void transform(
const Ravelin::Transform3d& T,
BV* result)
const;
64 template <
class ForwardIterator>
65 void expand_to_fit(ForwardIterator begin, ForwardIterator end);
67 template <
class ForwardIterator>
68 SSR(ForwardIterator begin, ForwardIterator end);
86 static double calc_sq_dist(
const Point3d& p,
const Point3d& rect_center,
const Ravelin::Vector3d& axis1,
const Ravelin::Vector3d& axis2,
const Ravelin::Vector2d& lengths,
Point3d& cp_rect);
87 static double calc_sq_dist(
const Point3d& origin,
const Ravelin::Vector3d& dir,
const LineSeg3& seg,
Point3d& cp_line,
Point3d& cp_seg,
double& line_param);
88 static double calc_sq_dist(
const Point3d& origin,
const Ravelin::Vector3d& dir,
const Point3d& rect_center,
const Ravelin::Vector3d& axis1,
const Ravelin::Vector3d& axis2,
const Ravelin::Vector2d& lengths,
Point3d& cp_line,
Point3d& cp_rect,
double& line_param);
89 static double calc_sq_dist(
const LineSeg3& seg,
const Point3d& rect_center,
const Ravelin::Vector3d& axis1,
const Ravelin::Vector3d& axis2,
const Ravelin::Vector2d& lengths,
Point3d& cp_seg,
Point3d& cp_rect);
90 static double calc_sq_dist(
const Point3d& a_center,
const Ravelin::Vector3d& aaxis1,
const Ravelin::Vector3d& aaxis2,
const Ravelin::Vector2d& alengths,
const Point3d& b_center,
const Ravelin::Vector3d& baxis1,
const Ravelin::Vector3d& baxis2,
const Ravelin::Vector2d& blengths,
Point3d& cpa,
Point3d& cpb);
92 template <
class ForwardIterator>
93 void calc_lengths_and_radius(ForwardIterator begin, ForwardIterator end);
95 template <
class ForwardIterator>
96 static void align(ForwardIterator begin, ForwardIterator end,
const Ravelin::Vector3d& d1, Ravelin::Vector3d& d2);
boost::shared_ptr< BV > BVPtr
Bounding volume (BV) smart pointer.
Definition: Types.h:92
SSR()
Initializes an empty SSR.
Definition: SSR.cpp:16
A sphere-swept rectangle (SSR) that optionally allows building an SSR tree.
Definition: SSR.h:35
unsigned calc_size() const
Calculates the size (number of elements in) a SSR tree.
Definition: SSR.cpp:573
virtual void transform(const Ravelin::Transform3d &T, BV *result) const
Transforms the SSR using the given transform.
Definition: SSR.cpp:45
Ravelin::Matrix3d R
Orientation of this SSR.
Definition: SSR.h:80
virtual std::ostream & to_vrml(std::ostream &out, const Ravelin::Pose3d &T) const
Outputs the SSR to VRML (not yet implemented)
Definition: SSR.cpp:659
An abstract bounding volume.
Definition: BV.h:38
virtual bool intersects(const LineSeg3 &seg, double &tmin, double tmax, Point3d &q) const
Determines whether a line segment intersects the bounding volume.
Definition: SSR.h:51
virtual Point3d get_upper_bounds() const
Gets the upper bounds of the SSR.
Definition: SSR.cpp:610
static bool intersects(const SSR &a, const SSR &b)
Determines whether two SSRs intersect.
Definition: SSR.cpp:503
boost::shared_ptr< CollisionGeometry > CollisionGeometryPtr
Collision geometry smart pointer.
Definition: Types.h:77
Ravelin::Vector2d l
Lengths of the rectangle sides.
Definition: SSR.h:77
double radius
Radius of the spherical addition.
Definition: SSR.h:83
virtual double calc_volume() const
Calculates (approximate?) volume of the SSR.
Definition: SSR.h:71
void get_rect_verts(Point3d rect_verts[4]) const
Gets the vertices of the rectangle.
Definition: SSR.cpp:637
Ravelin::Vector3d Point3d
Typedef to distinguish between a 3D vector and a point.
Definition: Types.h:47
static bool outside(const SSR &a, const Point3d &point, double tol=NEAR_ZERO)
Determines whether a point is outside the SSR.
Definition: SSR.cpp:566
virtual Point3d get_lower_bounds() const
Gets the lower bounds of the SSR.
Definition: SSR.cpp:583
SSR & operator=(const SSR &s)
Copies one SSR to another.
Definition: SSR.cpp:61
virtual bool outside(const Point3d &point, double tol=NEAR_ZERO) const
Determines whether a point is outside the bounding volume.
Definition: SSR.h:53
Point3d center
Center of the volume.
Definition: SSR.h:74
std::pair< Point3d, Point3d > LineSeg3
Typedef to make specifying line segments easier.
Definition: Types.h:50
virtual boost::shared_ptr< const Ravelin::Pose3d > get_relative_pose() const
Gets the associated pose for this bounding volume.
Definition: SSR.h:58
static double calc_dist(const SSR &a, const Point3d &p)
Calculates the distance of the sphere-swept rectangle from a point.
Definition: SSR.cpp:97
virtual BVPtr calc_swept_BV(CollisionGeometryPtr g, const Ravelin::SVelocityd &v) const
Calculates the velocity-expanded bounding volume.
Definition: SSR.cpp:72