Physsim::Contact Class Reference

Container class for describing a contact in the simulation. More...

#include <Contact.h>

Inheritance diagram for Physsim::Contact:

Physsim::Base List of all members.

Public Types

enum  ContactPhaseType {
  eNoContact, eImpacting, eImpactResponse, eRestingStart,
  eResting
}
enum  ContactType {
  eNone, eVertex, eEdge, ePoints,
  ePolygon, ePolyhedron
}

Public Member Functions

 Contact (const Contact &c)
void operator= (const Contact &c)
virtual bool is_struct_identical (BaseConstPtr object) const
 Verifies that structure of two contacts is identical.
virtual void clone (BasePtr &cloned, bimap< BasePtr, BasePtr > *obj_map=NULL) const
 Clones this object.
virtual void load_state (BaseConstPtr object, bimap< BasePtr, BasePtr > *correspondence=NULL)
 Loads the state of this object.
virtual void save_state (BasePtr object, bimap< BasePtr, BasePtr > *correspondence=NULL) const
 Saves the state of this object.
boost::shared_ptr< std::list<
Vector3 > > 
get_vertices () const
 Gets the vertices of contact.
void set_contact_data (boost::shared_ptr< ContactData > cdata)
 Sets the contact data.
void apply_contact_forces () const
 Applies all contact forces to the two rigid bodies.
boost::shared_ptr< ContactDataget_contact_data () const
 Gets the data relevant to this contact.
boost::shared_ptr< std::list<
Vector3 > > 
generate_samples () const
 Generates the appropriate number of samples from this contact's geometry.
boost::shared_ptr< std::list<
Vector3 > > 
generate_samples (unsigned n) const
 Generates the desired number of samples from this contact's geometry.
SoNode * to_visualization_data () const
 Makes a contact visualizable.
void write_vrml (const std::string &filename) const
 Writes a contact to the specified filename in VRML format for visualization.

Static Public Member Functions

static void det_connected_contacts (const std::list< ContactPtr > &contacts, std::list< std::list< ContactPtr > > &sets)
 Given a list of contacts, determines all of the sets of connected contacts.
template<class ForwardIterator>
static boost::shared_ptr<
std::list< ContactPtr > > 
form_singletons (ForwardIterator first, ForwardIterator last)
 Forms a list of singleton (vertex) contacts from a set of contacts.

Public Attributes

ContactType _contact_type
 The contact type (none, vertex, points, edge, polygon, polyhedron).
Real _d
 Plane intercept for the separating plane.
Vector3 _vertex
 Vertex for a point contact.
std::list< Vector3_points
 Points for points contact.
std::pair< Vector3, Vector3_edge
 Edge for an edge contact.
std::list< Vector3_surface
 Polygon for a surface contact.
PolyhedronPtr _volume
 Polyhedron for a volumetric contact.
Vector3 _normal
 The vector pointing outward from the contact on the first body (in world coordinates).
Vector3 _normal_dot
 The derivative of the contact normal.
std::list< std::pair< Vector3,
Real > > 
_normal_forces
 Points of application (global frame) and the corresponding normal force magnitudes that are applied (or about to be applied) due to this contact.
std::list< std::pair< Vector3,
Vector3 > > 
_tangent_forces
 Points of application (global frame) and the corresponding tangential forces that are applied (or about to be applied) due to this contact.
CollisionGeometryPtr _geom1
 The collision geometries involved in the contact.
CollisionGeometryPtr _geom2
ContactPhaseType _phase
 The contact phase.

Detailed Description

Container class for describing a contact in the simulation.

Multiple (possibly non-coplanar) contact points can be stored; however, the normal is shared by all contact points.


Member Function Documentation

void Contact::load_state ( BaseConstPtr  object,
bimap< BasePtr, BasePtr > *  correspondence = NULL 
) [virtual]

Loads the state of this object.

The underlying penalty resting contact method must have identical structure.

Reimplemented from Physsim::Base.

void Contact::save_state ( BasePtr  object,
bimap< BasePtr, BasePtr > *  correspondence = NULL 
) const [virtual]

Saves the state of this object.

The underlying penalty resting contact method must have identical structure.

Reimplemented from Physsim::Base.

boost::shared_ptr< std::list< Vector3 > > Contact::get_vertices (  )  const

Gets the vertices of contact.

Returns all vertices of contact of the contact geometry, irrespective of the geometry type.

void Contact::det_connected_contacts ( const std::list< ContactPtr > &  contacts,
std::list< std::list< ContactPtr > > &  sets 
) [static]

Given a list of contacts, determines all of the sets of connected contacts.

A set of connected contacts is the set of all contacts such that, for a given contact A in the set, there exists another contact B for which A and B share at least one rigid body. This method is useful for reducing the dimensionality of global methods for contact resolution (e.g., LCP methods), because only the subset that is connected need be resolved at any given time.

Parameters:
contacts the list of contacts
sets the sets of connected contacts on return

boost::shared_ptr< std::list< Vector3 > > Contact::generate_samples (  )  const

Generates the appropriate number of samples from this contact's geometry.

Samples are neither discarded nor interpolated; the exact number of samples returned is a function of the contact geometry. For example, eEdge contacts generate two points, while ePolygon / ePolyhedron generate the vertices of the polytope.

boost::shared_ptr< std::list< Vector3 > > Contact::generate_samples ( unsigned  n  )  const

Generates the desired number of samples from this contact's geometry.

The samples are generated uniformly (or nearly uniformly) over the surface of the contact geometry.

SoNode * Contact::to_visualization_data (  )  const

Makes a contact visualizable.

Todo:
add a cone onto the arrows

void Contact::write_vrml ( const std::string &  fname  )  const

Writes a contact to the specified filename in VRML format for visualization.

Todo:
add a cone onto the arrows


The documentation for this class was generated from the following files:
Generated on Wed Oct 24 14:54:22 2007 for Physsim by  doxygen 1.5.1