7 #ifndef _TORUS_PRIMITIVE_H
8 #define _TORUS_PRIMITIVE_H
10 #include <Moby/Primitive.h>
23 void set_radii(
double major_radius,
double minor_radius);
25 virtual void load_from_xml(boost::shared_ptr<const XMLTree> node, std::map<std::string, BasePtr>& id_map);
26 virtual void save_to_xml(
XMLTreePtr node, std::list<boost::shared_ptr<const Base> >& shared_objects)
const;
29 double calc_closest_point(
const Point3d& point,
Point3d& closest)
const;
30 virtual boost::shared_ptr<const IndexedTriArray>
get_mesh(boost::shared_ptr<const Ravelin::Pose3d> P);
34 virtual void get_vertices(boost::shared_ptr<const Ravelin::Pose3d> P, std::vector<Point3d>& p)
const;
36 virtual double get_bounding_radius()
const {
return _major_radius + _minor_radius; }
45 virtual void calc_mass_properties();
46 static double urand(
double a,
double b);
49 std::map<CollisionGeometryPtr, std::vector<Point3d> > _vertices;
52 std::map<CollisionGeometryPtr, OBBPtr> _obbs;
boost::shared_ptr< BV > BVPtr
Bounding volume (BV) smart pointer.
Definition: Types.h:92
virtual bool is_convex() const
Determines whether this primitive is convex.
Definition: TorusPrimitive.h:24
virtual double calc_signed_dist(boost::shared_ptr< const Primitive > p, Point3d &pthis, Point3d &pp) const
Computes the signed distance between this and another primitive.
Defines a triangle-mesh-based primitive type used for inertial property calculation and geometry prov...
Definition: Primitive.h:41
double get_major_radius() const
Gets the major radius.
Definition: TorusPrimitive.h:39
double get_minor_radius() const
Get the minor radius.
Definition: TorusPrimitive.h:42
virtual BVPtr get_BVH_root(CollisionGeometryPtr geom)
Gets the root BVH for this torus.
Definition: TorusPrimitive.cpp:77
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: TorusPrimitive.cpp:355
void set_radii(double major_radius, double minor_radius)
Sets the.
Definition: TorusPrimitive.cpp:379
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: TorusPrimitive.cpp:401
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 osg::Node * create_visualization()
Creates the visualization for this primitive.
Definition: TorusPrimitive.cpp:64
Ravelin::Vector3d Point3d
Typedef to distinguish between a 3D vector and a point.
Definition: Types.h:47
Represents a solid box centered at the origin (by default)
Definition: TorusPrimitive.h:17
virtual void get_vertices(boost::shared_ptr< const Ravelin::Pose3d > P, std::vector< Point3d > &p) const
Gets the vertices corresponding to this torus.
Definition: TorusPrimitive.cpp:113
virtual double calc_dist_and_normal(const Point3d &point, std::vector< Ravelin::Vector3d > &normals) const
Computes the distance from a point to this torus.
Definition: TorusPrimitive.cpp:108
virtual boost::shared_ptr< const IndexedTriArray > get_mesh(boost::shared_ptr< const Ravelin::Pose3d > P)
Gets the mesh corresponding to this torus.
Definition: TorusPrimitive.cpp:193