Moby
Public Member Functions | List of all members
Moby::BoxPrimitive Class Reference

Represents a solid box centered at the origin (by default) More...

#include <BoxPrimitive.h>

Inheritance diagram for Moby::BoxPrimitive:
Moby::PolyhedralPrimitive Moby::Primitive Moby::Base

Public Member Functions

 BoxPrimitive ()
 Constructs a unit cube centered at the origin.
 
 BoxPrimitive (double xlen, double ylen, double zlen)
 Constructs a box of the specified size.
 
 BoxPrimitive (double xlen, double ylen, double zlen, const Ravelin::Pose3d &T)
 
 BoxPrimitive (const Ravelin::Pose3d &T)
 
virtual void set_polyhedron (const Polyhedron &p)
 Overrides the PolyhedronPrimitive::set_polyhedron(.)
 
void set_size (double xlen, double ylen, double zlen)
 Sets the size of this box. More...
 
virtual unsigned num_facets () const
 
virtual bool is_convex () const
 Determines whether the primitive is convex.
 
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.
 
virtual void save_to_xml (XMLTreePtr node, std::list< boost::shared_ptr< const Base > > &shared_objects) const
 Implements Base::save_to_xml() for serialization.
 
virtual BVPtr get_BVH_root (CollisionGeometryPtr geom)
 Gets the bounding volume for this plane.
 
virtual double calc_dist_and_normal (const Point3d &point, std::vector< Ravelin::Vector3d > &normals) const
 Tests whether a point is inside or on the box.
 
double calc_closest_point (const Point3d &point, Point3d &closest) const
 Computes the closest point on the box to a point (and returns the distance)
 
virtual void set_pose (const Ravelin::Pose3d &T)
 Transforms the primitive.
 
void set_edge_sample_length (double len)
 Sets the edge sample length for this box.
 
virtual boost::shared_ptr
< const IndexedTriArray
get_mesh (boost::shared_ptr< const Ravelin::Pose3d > P)
 Gets the set of vertices for the BoxPrimitive (constructing, if necessary) More...
 
virtual osg::Node * create_visualization ()
 Creates the visualization for this primitive.
 
double calc_signed_dist (boost::shared_ptr< const SpherePrimitive > s, Point3d &pthis, Point3d &psph) const
 
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 > &p) const
 Gets the set of vertices for the BoxPrimitive.
 
virtual double calc_signed_dist (const Point3d &p) const
 Computes the signed distance to a point.
 
double calc_closest_points (boost::shared_ptr< const SpherePrimitive > s, Point3d &pbox, Point3d &psph) const
 Finds closest point between a box and a sphere; returns the closest point on/in the box to the center of the sphere.
 
virtual double get_bounding_radius () const
 
double get_x_len () const
 Get the x-length of this box.
 
double get_y_len () const
 Get the y-length of this box.
 
double get_z_len () const
 Ge the z-length of this box.
 
- Public Member Functions inherited from Moby::PolyhedralPrimitive
 PolyhedralPrimitive (const Ravelin::Pose3d &T)
 
const Polyhedronget_polyhedron () const
 Gets the polyhedron corresponding to this primitive (in its transformed state)
 
template<class OutputIterator >
OutputIterator get_halfspaces (const Polyhedron &poly, boost::shared_ptr< const Ravelin::Pose3d > pose, const Ravelin::Transform3d &wTpose, OutputIterator output_begin)
 
- Public Member Functions inherited from Moby::Primitive
 Primitive ()
 Constructs a primitive under the identity transformation.
 
 Primitive (const Ravelin::Pose3d &T)
 
void update_visualization ()
 Updates the visualization on the primitive.
 
void set_mass (double mass)
 Sets the mass of this primitive. More...
 
void set_density (double density)
 Sets the density of this primitive.
 
virtual Point3d get_supporting_point (const Ravelin::Vector3d &d) const
 Gets a supporting point from a primitive.
 
void add_collision_geometry (CollisionGeometryPtr cg)
 Adds a collision geometry.
 
void remove_collision_geometry (CollisionGeometryPtr cg)
 Removes a collision geometry.
 
boost::shared_ptr< const
Ravelin::Pose3d > 
get_pose (CollisionGeometryPtr g) const
 Gets the pose of this primitive relative to a particular collision geometry.
 
virtual double calc_max_dist (double lin_cont, double ang_cont, double dist, const Ravelin::Vector3d &d0, const Ravelin::Vector3d &w0, boost::shared_ptr< const Ravelin::Pose3d > P)
 Computes the maximum distance by a point on the geometry.
 
virtual osg::Node * get_visualization ()
 Gets the visualization for this primitive. More...
 
boost::shared_ptr< const
Ravelin::Pose3d > 
get_inertial_pose () const
 Gets the inertial frame of this primitive.
 
boost::shared_ptr< const
Ravelin::Pose3d > 
get_pose () const
 Gets the pose of this primitive.
 
const Ravelin::SpatialRBInertiad & get_inertia () const
 Gets the inertia for this primitive.
 
- Public Member Functions inherited from Moby::Base
 Base (const Base *b)
 

Additional Inherited Members

- Static Public Member Functions inherited from Moby::PolyhedralPrimitive
template<class OutputIterator >
static OutputIterator get_halfspaces (const Polyhedron &poly, boost::shared_ptr< const Ravelin::Pose3d > pose, const Ravelin::Transform3d &wTpose, OutputIterator output_begin)
 
- Static Public Member Functions inherited from Moby::Base
template<class T >
static boost::shared_ptr< T > clone (boost::shared_ptr< T > x)
 Static method for cloning a shared pointer.
 
- Public Attributes inherited from Moby::Base
boost::shared_ptr< void > userdata
 Any relevant userdata.
 
std::string id
 The unique ID for this object.
 
- Protected Member Functions inherited from Moby::PolyhedralPrimitive
void calc_mass_properties ()
 Calculates mass properties for the polyhedron.
 
double calc_signed_dist (boost::shared_ptr< const PolyhedralPrimitive > p, Point3d &pthis, Point3d &pp) const
 
- Protected Attributes inherited from Moby::PolyhedralPrimitive
Polyhedron _poly
 
- Protected Attributes inherited from Moby::Primitive
boost::shared_ptr
< Ravelin::Pose3d > 
_F
 The pose of this primitive (relative to the global frame)
 
boost::shared_ptr
< Ravelin::Pose3d > 
_jF
 The inertial pose of this primitive (relative to the global frame)
 
boost::shared_ptr< double > _density
 The density of this primitive.
 
Ravelin::SpatialRBInertiad _J
 The inertia of the primitive.
 
std::map< boost::weak_ptr
< CollisionGeometry >
, boost::shared_ptr
< Ravelin::Pose3d > > 
_cg_poses
 The poses of this primitive, relative to a collision geometry.
 
std::set< boost::shared_ptr
< Ravelin::Pose3d > > 
_poses
 The poses, relative to a particular collision geometry.
 

Detailed Description

Represents a solid box centered at the origin (by default)

Member Function Documentation

shared_ptr< const IndexedTriArray > BoxPrimitive::get_mesh ( boost::shared_ptr< const Ravelin::Pose3d >  P)
virtual

Gets the set of vertices for the BoxPrimitive (constructing, if necessary)

Recomputes the triangle mesh for the BoxPrimitive

Reimplemented from Moby::PolyhedralPrimitive.

void BoxPrimitive::set_size ( double  xlen,
double  ylen,
double  zlen 
)

Sets the size of this box.

Note
forces recomputation of the mesh

References Moby::Primitive::update_visualization().

Referenced by load_from_xml().


The documentation for this class was generated from the following files: