7 #ifndef _SPHERE_PRIMITIVE_H
8 #define _SPHERE_PRIMITIVE_H
10 #include <Moby/Primitive.h>
30 virtual void load_from_xml(boost::shared_ptr<const XMLTree> node, std::map<std::string, BasePtr>& id_map);
31 virtual void save_to_xml(
XMLTreePtr node, std::list<boost::shared_ptr<const Base> >& shared_objects)
const;
32 virtual void set_pose(
const Ravelin::Pose3d& T);
33 virtual void get_vertices(boost::shared_ptr<const Ravelin::Pose3d> P, std::vector<Point3d>& vertices)
const;
37 virtual boost::shared_ptr<const IndexedTriArray>
get_mesh(boost::shared_ptr<const Ravelin::Pose3d> P);
42 virtual double get_bounding_radius()
const {
return _radius; }
51 virtual void calc_mass_properties();
52 static double calc_f(
const Ravelin::VectorNd&,
void*);
53 static void calc_gradient(
const Ravelin::VectorNd&,
void*, Ravelin::VectorNd&);
54 static void calc_hessian(
const Ravelin::VectorNd&,
void*, Ravelin::MatrixNd&);
57 std::map<CollisionGeometryPtr, boost::shared_ptr<BoundingSphere> > _bsphs;
boost::shared_ptr< BV > BVPtr
Bounding volume (BV) smart pointer.
Definition: Types.h:92
void set_num_points(unsigned n)
Sets the number of points used in this sphere.
Definition: SpherePrimitive.cpp:180
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: SpherePrimitive.cpp:359
virtual void get_vertices(boost::shared_ptr< const Ravelin::Pose3d > P, std::vector< Point3d > &vertices) const
Gets vertices for the primitive.
Definition: SpherePrimitive.cpp:245
Defines a triangle-mesh-based primitive type used for inertial property calculation and geometry prov...
Definition: Primitive.h:41
void set_radius(double radius)
Sets the radius for this sphere (forces redetermination of the mesh)
Definition: SpherePrimitive.cpp:158
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: SpherePrimitive.cpp:382
unsigned get_num_points() const
Gets the number of points used to create the sphere for visualization / collision checking...
Definition: SpherePrimitive.h:48
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: SpherePrimitive.cpp:345
virtual BVPtr get_BVH_root(CollisionGeometryPtr geom)
Gets the root bounding volume.
Definition: SpherePrimitive.cpp:398
double get_radius() const
Gets the radius for this sphere.
Definition: SpherePrimitive.h:45
virtual double calc_dist_and_normal(const Point3d &point, std::vector< Ravelin::Vector3d > &normals) const
Finds the signed distance betwen the sphere and a point.
Definition: SpherePrimitive.cpp:332
Ravelin::Vector3d Point3d
Typedef to distinguish between a 3D vector and a point.
Definition: Types.h:47
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.
SpherePrimitive()
Creates a sphere with radius 1.0 and 100 points.
Definition: SpherePrimitive.cpp:37
virtual boost::shared_ptr< const IndexedTriArray > get_mesh(boost::shared_ptr< const Ravelin::Pose3d > P)
Gets the mesh, computing it if necessary.
Definition: SpherePrimitive.cpp:202
virtual bool is_convex() const
Determines whether this primitive is convex.
Definition: SpherePrimitive.h:29
virtual void set_pose(const Ravelin::Pose3d &T)
Transforms the primitive.
Definition: SpherePrimitive.cpp:186
virtual Point3d get_supporting_point(const Ravelin::Vector3d &d) const
Gets the supporting point.
Definition: SpherePrimitive.cpp:88
Represents a sphere primitive for inertia properties, collision detection, and visualization.
Definition: SpherePrimitive.h:18