7 #ifndef _HEIGHTMAP_PRIMITIVE_H
8 #define _HEIGHTMAP_PRIMITIVE_H
10 #include <Moby/Primitive.h>
15 class SpherePrimitive;
25 virtual void set_pose(
const Ravelin::Pose3d& T);
26 virtual void get_vertices(boost::shared_ptr<const Ravelin::Pose3d> P, std::vector<Point3d>& vertices)
const;
27 void get_vertices(
BVPtr bv, 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);
35 virtual void calc_mass_properties() {
_density.reset();
_J.set_zero(); }
37 virtual void load_from_xml(boost::shared_ptr<const XMLTree> node, std::map<std::string, BasePtr>& id_map);
38 virtual void save_to_xml(
XMLTreePtr node, std::list<boost::shared_ptr<const Base> >& shared_objects)
const;
39 const Ravelin::MatrixNd& get_heights()
const {
return _heights; }
40 double get_width()
const {
return _width; }
41 double get_depth()
const {
return _depth; }
42 virtual double get_bounding_radius()
const {
return 0.0; }
55 Ravelin::MatrixNd _heights;
58 std::map<CollisionGeometryPtr, boost::shared_ptr<OBB> >
_obbs;
boost::shared_ptr< BV > BVPtr
Bounding volume (BV) smart pointer.
Definition: Types.h:92
virtual void set_pose(const Ravelin::Pose3d &T)
Transforms the primitive.
Definition: HeightmapPrimitive.cpp:418
Represents a heightmap with height zero on the xz plane (primitive can be transformed) ...
Definition: HeightmapPrimitive.h:18
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.
HeightmapPrimitive()
Initializes the heightmap primitive.
Definition: HeightmapPrimitive.cpp:37
double _width
width of the heightmap
Definition: HeightmapPrimitive.h:49
virtual osg::Node * create_visualization()
Computes the OSG visualization.
Definition: HeightmapPrimitive.cpp:251
Defines a triangle-mesh-based primitive type used for inertial property calculation and geometry prov...
Definition: Primitive.h:41
virtual void get_vertices(boost::shared_ptr< const Ravelin::Pose3d > P, std::vector< Point3d > &vertices) const
Get vertices corresponding to this primitive.
virtual Point3d get_supporting_point(const Ravelin::Vector3d &d) const
Gets the supporting point.
Definition: HeightmapPrimitive.cpp:49
std::map< CollisionGeometryPtr, boost::shared_ptr< OBB > > _obbs
The bounding volumes for the heightmap.
Definition: HeightmapPrimitive.h:58
virtual boost::shared_ptr< const IndexedTriArray > get_mesh(boost::shared_ptr< const Ravelin::Pose3d > P)
Gets the mesh of the heightmap.
Definition: HeightmapPrimitive.cpp:105
boost::shared_ptr< CollisionGeometry > CollisionGeometryPtr
Collision geometry smart pointer.
Definition: Types.h:77
virtual double calc_dist_and_normal(const Point3d &point, std::vector< Ravelin::Vector3d > &normals) const
Finds the signed distance betwen the heightmap and a point.
Definition: HeightmapPrimitive.cpp:464
boost::shared_ptr< XMLTree > XMLTreePtr
XML tree smart pointer.
Definition: Types.h:104
double _depth
depth of the heightmap
Definition: HeightmapPrimitive.h:52
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: HeightmapPrimitive.cpp:488
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: HeightmapPrimitive.cpp:531
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
Implements the CollisionDetection abstract class to perform exact contact finding using abstract shap...
Definition: CCD.h:36
void calc_gradient(const Point3d &p, double &gx, double &gz) const
Computes the gradient at a particular point.
Definition: HeightmapPrimitive.cpp:199
virtual double calc_height(const Point3d &p) const
Computes the height at a particular point.
Definition: HeightmapPrimitive.cpp:166
Ravelin::SpatialRBInertiad _J
The inertia of the primitive.
Definition: Primitive.h:112
virtual BVPtr get_BVH_root(CollisionGeometryPtr geom)
Gets the BVH root for the heightmap.
Definition: HeightmapPrimitive.cpp:65