7 #ifndef _CONE_PRIMITIVE_H
8 #define _CONE_PRIMITIVE_H
10 #include <Moby/Primitive.h>
15 class SpherePrimitive;
27 ConePrimitive(
double radius,
double height,
unsigned npoints,
unsigned nrings,
const Ravelin::Pose3d& T);
28 ConePrimitive(
double radius,
double height,
const Ravelin::Pose3d& T);
34 virtual void load_from_xml(boost::shared_ptr<const XMLTree> node, std::map<std::string, BasePtr>& id_map);
35 virtual void save_to_xml(
XMLTreePtr node, std::list<boost::shared_ptr<const Base> >& shared_objects)
const;
37 virtual void get_vertices(boost::shared_ptr<const Ravelin::Pose3d> P, std::vector<Point3d>& vertices)
const;
38 virtual void set_pose(
const Ravelin::Pose3d& T);
41 virtual boost::shared_ptr<const IndexedTriArray>
get_mesh(boost::shared_ptr<const Ravelin::Pose3d> P);
45 virtual double get_bounding_radius()
const {
return std::max(_radius, _height); }
60 bool intersect_seg(
const LineSeg3& seg,
double& t,
Point3d& isect, Ravelin::Vector3d& normal)
const;
62 static double sqr(
double x) {
return x*x; }
63 virtual void calc_mass_properties();
64 double calc_penetration_depth(
const Point3d& p)
const;
65 Ravelin::Vector3d determine_normal(
const Point3d& query)
const;
66 bool point_inside(
const Point3d& p, Ravelin::Vector3d& normal)
const;
69 std::map<CollisionGeometryPtr, OBBPtr> _obbs;
boost::shared_ptr< BV > BVPtr
Bounding volume (BV) smart pointer.
Definition: Types.h:92
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: ConePrimitive.cpp:460
virtual double calc_dist_and_normal(const Point3d &point, std::vector< Ravelin::Vector3d > &normals) const
Computes the distance and normal from a point on the primitive.
Definition: ConePrimitive.cpp:117
virtual void set_pose(const Ravelin::Pose3d &T)
Transforms the primitive.
Definition: ConePrimitive.cpp:375
virtual BVPtr get_BVH_root(CollisionGeometryPtr geom)
Gets vertices from the primitive.
Definition: ConePrimitive.cpp:655
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.
unsigned get_circle_points() const
Gets the number of points in a circle on the cone.
Definition: ConePrimitive.h:57
void set_radius(double radius)
Sets the radius for this cone.
Definition: ConePrimitive.cpp:309
Defines a cone primitive.
Definition: ConePrimitive.h:22
virtual void get_vertices(boost::shared_ptr< const Ravelin::Pose3d > P, std::vector< Point3d > &vertices) const
Gets vertices from the primitive.
Definition: ConePrimitive.cpp:565
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: ConePrimitive.cpp:493
virtual osg::Node * create_visualization()
Creates the visualization for this primitive.
Definition: ConePrimitive.cpp:427
Defines a triangle-mesh-based primitive type used for inertial property calculation and geometry prov...
Definition: Primitive.h:41
ConePrimitive()
Constructs a cone centered at the origin, with the longitudinal axis aligned with the y-axis...
Definition: ConePrimitive.cpp:36
virtual boost::shared_ptr< const IndexedTriArray > get_mesh(boost::shared_ptr< const Ravelin::Pose3d > P)
Gets the triangle mesh for the cone, computing it if necessary.
Definition: ConePrimitive.cpp:391
boost::shared_ptr< CollisionGeometry > CollisionGeometryPtr
Collision geometry smart pointer.
Definition: Types.h:77
void set_circle_points(unsigned n)
Sets the number of points in the rings of the cone.
Definition: ConePrimitive.cpp:359
boost::shared_ptr< XMLTree > XMLTreePtr
XML tree smart pointer.
Definition: Types.h:104
void set_height(double height)
Sets the height for this cone.
Definition: ConePrimitive.cpp:334
Ravelin::Vector3d Point3d
Typedef to distinguish between a 3D vector and a point.
Definition: Types.h:47
unsigned get_num_rings() const
Gets the number of rings on the cone.
Definition: ConePrimitive.h:48
void set_num_rings(unsigned n)
Sets the number of rings in the cone.
Definition: ConePrimitive.cpp:367
std::pair< Point3d, Point3d > LineSeg3
Typedef to make specifying line segments easier.
Definition: Types.h:50
virtual Point3d get_supporting_point(const Ravelin::Vector3d &d) const
Gets a supporting point in a particular direction.
Definition: ConePrimitive.cpp:95
double get_radius() const
Gets the radius of this cone.
Definition: ConePrimitive.h:51
double get_height() const
Gets the height of this cone.
Definition: ConePrimitive.h:54
Represents a sphere primitive for inertia properties, collision detection, and visualization.
Definition: SpherePrimitive.h:18
virtual bool is_convex() const
Determines whether this primitive is convex.
Definition: ConePrimitive.h:29