13 #include <boost/shared_ptr.hpp>
14 #include <Ravelin/Vector3d.h>
15 #include <Ravelin/Matrix3d.h>
16 #include <Ravelin/Pose3d.h>
17 #include <Moby/Base.h>
18 #include <Moby/Triangle.h>
19 #include <Moby/ThickTriangle.h>
20 #include <Moby/Constants.h>
21 #include <Moby/IndexedTriArray.h>
24 class MatrixTransform;
32 class CollisionGeometry;
49 virtual void load_from_xml(boost::shared_ptr<const XMLTree> node, std::map<std::string, BasePtr>& id_map);
50 virtual void save_to_xml(
XMLTreePtr node, std::list<boost::shared_ptr<const Base> >& shared_objects)
const;
54 virtual void set_pose(
const Ravelin::Pose3d& T);
60 virtual double get_bounding_radius()
const = 0;
63 virtual double calc_max_dist(
double lin_cont,
double ang_cont,
double dist,
const Ravelin::Vector3d& d0,
const Ravelin::Vector3d& w0, boost::shared_ptr<const Ravelin::Pose3d> P)
65 return lin_cont + ang_cont;
79 virtual osg::Node* create_visualization() = 0;
85 virtual void get_vertices(boost::shared_ptr<const Ravelin::Pose3d> P, std::vector<Point3d>& vertices)
const = 0;
91 boost::shared_ptr<const Ravelin::Pose3d>
get_pose()
const {
return _F; }
94 virtual boost::shared_ptr<const IndexedTriArray>
get_mesh(boost::shared_ptr<const Ravelin::Pose3d> P) = 0;
100 virtual void calc_mass_properties() = 0;
103 boost::shared_ptr<Ravelin::Pose3d>
_F;
106 boost::shared_ptr<Ravelin::Pose3d>
_jF;
112 Ravelin::SpatialRBInertiad
_J;
117 std::map<boost::weak_ptr<CollisionGeometry>, boost::shared_ptr<Ravelin::Pose3d> >
_cg_poses;
120 std::set<boost::shared_ptr<Ravelin::Pose3d> >
_poses;
125 osg::MatrixTransform* _vtransform;
virtual void load_from_xml(boost::shared_ptr< const XMLTree > node, std::map< std::string, BasePtr > &id_map)
Implements Base::load_from_xml() for serialization.
Definition: Primitive.cpp:240
boost::shared_ptr< BV > BVPtr
Bounding volume (BV) smart pointer.
Definition: Types.h:92
virtual BVPtr get_BVH_root(CollisionGeometryPtr geom)=0
Gets the root bounding volume for this primitive.
Primitive()
Constructs a primitive under the identity transformation.
Definition: Primitive.cpp:58
Class from which all Moby classes are derived.
Definition: Base.h:20
virtual bool is_convex() const
Determines whether this primitive is convex.
Definition: Primitive.h:69
virtual osg::Node * get_visualization()
Gets the visualization for this primitive.
Definition: Primitive.cpp:164
Defines a triangle-mesh-based primitive type used for inertial property calculation and geometry prov...
Definition: Primitive.h:41
boost::shared_ptr< const Ravelin::Pose3d > get_inertial_pose() const
Gets the inertial frame of this primitive.
Definition: Primitive.h:88
virtual void save_to_xml(XMLTreePtr node, std::list< boost::shared_ptr< const Base > > &shared_objects) const
Implements Base::save_to_xml() for serialization.
Definition: Primitive.cpp:322
virtual double calc_dist_and_normal(const Point3d &p, std::vector< Ravelin::Vector3d > &normals) const =0
Computes the distance between a point and this primitive.
boost::shared_ptr< CollisionGeometry > CollisionGeometryPtr
Collision geometry smart pointer.
Definition: Types.h:77
void set_density(double density)
Sets the density of this primitive.
Definition: Primitive.cpp:232
boost::shared_ptr< XMLTree > XMLTreePtr
XML tree smart pointer.
Definition: Types.h:104
boost::shared_ptr< const Ravelin::Pose3d > get_pose() const
Gets the pose of this primitive.
Definition: Primitive.h:91
void set_mass(double mass)
Sets the mass of this primitive.
Definition: Primitive.cpp:225
virtual void get_vertices(boost::shared_ptr< const Ravelin::Pose3d > P, std::vector< Point3d > &vertices) const =0
Get vertices corresponding to this primitive.
Definition: Primitive.inl:18
void remove_collision_geometry(CollisionGeometryPtr cg)
Removes a collision geometry.
Definition: Primitive.cpp:103
Ravelin::Vector3d Point3d
Typedef to distinguish between a 3D vector and a point.
Definition: Types.h:47
boost::shared_ptr< double > _density
The density of this primitive.
Definition: Primitive.h:109
boost::shared_ptr< Ravelin::Pose3d > _jF
The inertial pose of this primitive (relative to the global frame)
Definition: Primitive.h:106
virtual void set_pose(const Ravelin::Pose3d &T)
Sets the transform for this primitive – transforms mesh and inertial properties (if calculated) ...
Definition: Primitive.cpp:344
void add_collision_geometry(CollisionGeometryPtr cg)
Adds a collision geometry.
Definition: Primitive.cpp:91
virtual double calc_max_dist(double lin_cont, double ang_cont, double dist, const Ravelin::Vector3d &d0, const Ravelin::Vector3d &w0, boost::shared_ptr< const Ravelin::Pose3d > P)
Computes the maximum distance by a point on the geometry.
Definition: Primitive.h:63
void update_visualization()
Updates the visualization on the primitive.
Definition: Primitive.cpp:197
virtual Point3d get_supporting_point(const Ravelin::Vector3d &d) const
Gets a supporting point from a primitive.
Definition: Primitive.cpp:132
boost::shared_ptr< Ravelin::Pose3d > _F
The pose of this primitive (relative to the global frame)
Definition: Primitive.h:103
std::map< boost::weak_ptr< CollisionGeometry >, boost::shared_ptr< Ravelin::Pose3d > > _cg_poses
The poses of this primitive, relative to a collision geometry.
Definition: Primitive.h:117
std::set< boost::shared_ptr< Ravelin::Pose3d > > _poses
The poses, relative to a particular collision geometry.
Definition: Primitive.h:120
virtual double calc_signed_dist(const Point3d &p) const
Calculates the signed distance from this primitive.
Definition: Primitive.cpp:124
virtual boost::shared_ptr< const IndexedTriArray > get_mesh(boost::shared_ptr< const Ravelin::Pose3d > P)=0
Gets the underlying triangle mesh for this primitive.
const Ravelin::SpatialRBInertiad & get_inertia() const
Gets the inertia for this primitive.
Definition: Primitive.h:97
Ravelin::SpatialRBInertiad _J
The inertia of the primitive.
Definition: Primitive.h:112