7 #ifndef _POLYHEDRAL_PRIMITIVE_H
8 #define _POLYHEDRAL_PRIMITIVE_H
10 #include <Moby/Primitive.h>
11 #include <Moby/Polyhedron.h>
33 virtual void get_vertices(boost::shared_ptr<const Ravelin::Pose3d> P, std::vector<Point3d>& vertices)
const;
34 virtual boost::shared_ptr<const IndexedTriArray>
get_mesh(boost::shared_ptr<const Ravelin::Pose3d> P);
36 virtual void load_from_xml(boost::shared_ptr<const XMLTree> node, std::map<std::string, BasePtr>& id_map);
37 virtual void save_to_xml(
XMLTreePtr node, std::list<boost::shared_ptr<const Base> >& shared_objects)
const;
38 virtual void set_pose(
const Ravelin::Pose3d& P);
44 virtual unsigned num_facets()
const {
return _poly.get_faces().size();}
47 virtual double get_bounding_radius()
const
50 const std::vector<boost::shared_ptr<Polyhedron::Vertex> >& verts = _poly.get_vertices();
55 double max_dist = 0.0;
56 for (
unsigned i=0; i< verts.size(); i++)
57 max_dist = std::max(max_dist, verts[i]->o.norm());
62 template <
class OutputIterator>
63 static OutputIterator get_halfspaces(
const Polyhedron& poly, boost::shared_ptr<const Ravelin::Pose3d> pose,
const Ravelin::Transform3d& wTpose, OutputIterator output_begin);
71 #include "PolyhedralPrimitive.inl"
boost::shared_ptr< BV > BVPtr
Bounding volume (BV) smart pointer.
Definition: Types.h:92
Primitive()
Constructs a primitive under the identity transformation.
Definition: Primitive.cpp:58
virtual void set_pose(const Ravelin::Pose3d &P)
Sets the pose of this primitive.
Definition: PolyhedralPrimitive.cpp:214
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.
virtual void get_vertices(boost::shared_ptr< const Ravelin::Pose3d > P, std::vector< Point3d > &vertices) const
Get vertices corresponding to this primitive.
Definition: PolyhedralPrimitive.cpp:193
virtual BVPtr get_BVH_root(CollisionGeometryPtr geom)
Gets the root bounding volume for this primitive.
Definition: PolyhedralPrimitive.cpp:187
virtual double calc_dist_and_normal(const Point3d &p, std::vector< Ravelin::Vector3d > &normals) const
Computes the distance between a point and this primitive.
Definition: PolyhedralPrimitive.cpp:39
Defines a triangle-mesh-based primitive type used for inertial property calculation and geometry prov...
Definition: Primitive.h:41
A potentially-non-convex polyhedron of genus 0.
Definition: Polyhedron.h:28
virtual boost::shared_ptr< const IndexedTriArray > get_mesh(boost::shared_ptr< const Ravelin::Pose3d > P)
Gets the underlying triangle mesh for this primitive.
Definition: PolyhedralPrimitive.cpp:207
boost::shared_ptr< CollisionGeometry > CollisionGeometryPtr
Collision geometry smart pointer.
Definition: Types.h:77
void calc_mass_properties()
Calculates mass properties for the polyhedron.
Definition: PolyhedralPrimitive.cpp:251
boost::shared_ptr< XMLTree > XMLTreePtr
XML tree smart pointer.
Definition: Types.h:104
Defines a triangle-mesh-based primitive type used for inertial property calculation and geometry prov...
Definition: PolyhedralPrimitive.h:22
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: PolyhedralPrimitive.cpp:385
Ravelin::Vector3d Point3d
Typedef to distinguish between a 3D vector and a point.
Definition: Types.h:47
virtual bool is_convex() const
Determines whether the primitive is convex.
Definition: PolyhedralPrimitive.cpp:32
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: PolyhedralPrimitive.cpp:446
virtual void set_polyhedron(const Polyhedron &p)
Sets the polyhedron corresponding to this primitive.
Definition: PolyhedralPrimitive.cpp:233
virtual osg::Node * create_visualization()
creates the visualization for the primitive
Definition: PolyhedralPrimitive.cpp:111
const Polyhedron & get_polyhedron() const
Gets the polyhedron corresponding to this primitive (in its transformed state)
Definition: PolyhedralPrimitive.h:41