Moby
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Attributes | Friends | List of all members
Moby::CollisionGeometry Class Reference

Defines collision geometry that may be used (in principle) many ways: for rigid bodies, non-rigid bodies, ... More...

#include <CollisionGeometry.h>

Inheritance diagram for Moby::CollisionGeometry:
Moby::Base

Public Member Functions

 CollisionGeometry ()
 Constructs a CollisionGeometry with no triangle mesh, identity transformation and relative transformation.
 
void set_relative_pose (const Ravelin::Pose3d &pose)
 Sets the relative pose of this geometry. More...
 
void write_vrml (const std::string &filename) const
 Writes the collision geometry mesh to the specified VRML file. More...
 
PrimitivePtr set_geometry (PrimitivePtr primitive)
 Sets the collision geometry via a primitive. More...
 
virtual void save_to_xml (XMLTreePtr node, std::list< boost::shared_ptr< const Base > > &shared_objects) const
 Implements Base::save_to_xml()
 
virtual void load_from_xml (boost::shared_ptr< const XMLTree > node, std::map< std::string, BasePtr > &id_map)
 Implements Base::load_from_xml()
 
void set_single_body (boost::shared_ptr< Ravelin::SingleBodyd > s)
 Sets the single body associated with this CollisionGeometry.
 
double calc_signed_dist (const Point3d &p)
 Calculates the signed distance for a primitive.
 
double calc_dist_and_normal (const Point3d &p, std::vector< Ravelin::Vector3d > &n) const
 Calculates the (unsigned) distance of a point from this collision geometry.
 
void get_vertices (std::vector< Point3d > &p) const
 Gets vertices for a primitive.
 
Point3d get_supporting_point (const Ravelin::Vector3d &d) const
 Gets a supporting point for this geometry in a particular direction.
 
double get_farthest_point_distance () const
 Gets the farthest point from this geometry.
 
CollisionGeometryPtr get_this ()
 Gets the shared pointer for this.
 
boost::shared_ptr
< CollisionGeometry
get_parent () const
 Gets the parent of this CollisionGeometry (or NULL if there is no parent)
 
void set_parent (boost::weak_ptr< CollisionGeometry > parent)
 Sets the parent of this CollisionGeometry (or NULL to indicate no parent)
 
boost::shared_ptr< const
Ravelin::Pose3d > 
get_pose () const
 Gets the relative transform for this CollisionGeometry.
 
boost::shared_ptr
< Ravelin::SingleBodyd > 
get_single_body () const
 Gets the single body associated with this CollisionGeometry (if any)
 
PrimitivePtr get_geometry () const
 Gets the geometry for this primitive.
 
- Public Member Functions inherited from Moby::Base
 Base (const Base *b)
 

Static Public Member Functions

static double calc_signed_dist (CollisionGeometryPtr a, CollisionGeometryPtr b, Point3d &cpa, Point3d &cpb)
 Calculates the signed distances between two geometries and returns closest points if geometries are not interpenetrating.
 
- 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

double compliant_layer_depth
 The compliant layer around this geometry.
 
- Public Attributes inherited from Moby::Base
boost::shared_ptr< void > userdata
 Any relevant userdata.
 
std::string id
 The unique ID for this object.
 

Protected Attributes

boost::shared_ptr
< Ravelin::Pose3d > 
_F
 The pose of the CollisionGeometry (relative to the rigid body)
 
PrimitivePtr _geometry
 The underlying geometry.
 

Friends

class GeneralizedCCD
 

Detailed Description

Defines collision geometry that may be used (in principle) many ways: for rigid bodies, non-rigid bodies, ...

In principle the geometry may be very complex, and may support nonstationarity (changing over time) or deformities (e.g., due to collision). Note that while the underlying geometry may be shared, it is not intended for CollisionGeometry objects to be shared.

Member Function Documentation

PrimitivePtr CollisionGeometry::set_geometry ( PrimitivePtr  primitive)

Sets the collision geometry via a primitive.

The primitive is not cloned, nor is it unaltered; this points to the pointer returned by this method (typically primitive).

Returns
primitive unless the geometry of the underlying primitive is inconsistent, degenerate, or non-convex; in that case, a corrected primitive will be returned.
void CollisionGeometry::set_relative_pose ( const Ravelin::Pose3d &  pose)

Sets the relative pose of this geometry.

Parameters
Pthe relative pose (P.pose must be set relative to the single body pose)
void CollisionGeometry::write_vrml ( const std::string &  filename) const

Writes the collision geometry mesh to the specified VRML file.

Note
the mesh is transformed using the current transformation

References get_pose().


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