Om  1.0.0
A universal framework for multimedia simulation
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
om::physics::constraints::ContactConstraint Class Reference

An interface for classes that solves contact constraints between objects in a simulation. More...

#include <omPhysicsContactConstraint.h>

Inheritance diagram for om::physics::constraints::ContactConstraint:
om::physics::constraints::Constraint om::physics::context::PhysicsSceneObject om::physics::context::PhysicsContextObject

Classes

class  Contact
 A class that stores data about a single constraint contact point. More...
 
class  ContactManifold
 An object that stores a set of contact points between two objects. More...
 
class  ContactMaterial
 Class that contains the combined material properties of two objects at a contact point. More...
 
class  ObjectPair
 A class that stores the IDs for a pair of simulated objects. More...
 
class  SolverFrame
 

Public Types

typedef UInt32 ManifoldID
 Define the type to use for a contact manifold ID. More...
 
typedef UInt32 ContactID
 Define the type to use for a contact ID. More...
 

Public Member Functions

 ContactConstraint ()
 Create a new contact constraint with no constraints. More...
 
void updateContacts (const CollisionResultSet &collisions)
 Update this contact constraint using the specified collision result set. More...
 
virtual void solverStart (const ConstraintRequest &request, UInt32 userID, Float dt)
 Initialize the constraint solving for the specified constraint ID and timestep. More...
 
virtual void solverIterate (const ConstraintRequest &request, UInt32 userID, Float dt)
 Iterate the solution the constraint solving for the specified constraint ID and timestep. More...
 
void addPointToManifold (ContactManifold &manifold, const CollisionPoint &point)
 Add a new collision point to the specified contact manifold. More...
 
UInt32 findWorstContact (ContactManifold &manifold)
 Find the worst contact point in the specified manifold and return its index. More...
 
- Public Member Functions inherited from om::physics::constraints::Constraint
virtual ~Constraint ()
 Destroy this constraint. More...
 
const ConstraintTypegetType () const
 Return an object representing the type of this Constraint. More...
 
- Public Member Functions inherited from om::physics::context::PhysicsSceneObject
virtual Bool addSceneObjects (PhysicsSceneID sceneID)
 Add internal context objects to the scene with the specified ID. More...
 
virtual Bool removeSceneObjects (PhysicsSceneID sceneID)
 Remove internal context objects from the scene with the specified ID. More...
 
- Public Member Functions inherited from om::physics::context::PhysicsContextObject
virtual ~PhysicsContextObject ()
 Destory this physics context object. More...
 
PhysicsContextgetContext () const
 Return a pointer to the physics context this context object is using to do simulation. More...
 
virtual Bool setContext (PhysicsContext *newContext)
 Set a pointer to the physics context this context object should use to do simulation. More...
 
Bool clearContext ()
 Clear the previous context from this object. More...
 

Static Public Member Functions

static void normalBasis (const SIMDFloat4 &normal, SIMDFloat4 &tangent, SIMDFloat4 &binormal)
 Construct an orthonormal basis from a normalized normal vector (z column). More...
 
static Float getJacobian (const SolverFrame &frame, const Contact &c, Float invMassSum)
 
static Float getRelativeSpeed (const SolverFrame &frame, const Contact &c, const VelocityState &v1, const VelocityState &v2)
 Return the relative speed along the solver frame direction for the specified velocity states. More...
 
static Float getRelativeSpeedBias (const SolverFrame &frame, const Contact &c, const VelocityState &v1, const VelocityState &v2)
 Return the relative bias speed along the solver frame direction for the specified velocity states. More...
 
static void applyImpulses (const Contact &c, Float jXMag, Float jYMag, Float jZMag, VelocityState &v1, VelocityState &v2)
 
static void applyImpulse (const SolverFrame &frame, Float magnitude, VelocityState &v1, VelocityState &v2)
 
static void applyImpulseBias (const SolverFrame &frame, Float magnitude, VelocityState &v1, VelocityState &v2)
 
static Float crossMagnitude (const SIMDFloat4 &v1, const SIMDFloat4 &v2)
 
static Float getElasticityForSpeed (Float elasticity, Float speedZ, Float vc, Float vy)
 Return the elasticity as a function of the incident speed along the normal direction. More...
 

Public Attributes

ObjectPool< Contact, 8, ContactID, AlignedAllocator< 16 > > contacts
 A pool of the contacts that are in this constraint. More...
 
ObjectPool< ContactManifold, 8, ManifoldIDmanifolds
 A pool of the contact manifolds that are in this constraint. More...
 
HashMap< ObjectPair, ContactManifold * > manifoldMap
 A map from object pairs to contact manifolds. More...
 
UInt32 timestamp
 The global time stamp for the most recent simulation step. More...
 

Static Public Attributes

static const ConstraintType TYPE
 A constraint type object that represents the type of a contact constraint. More...
 
static const Size MAX_MANIFOLD_SIZE = 4
 The maximum number of contacts that can be in a contact manifold. More...
 
- Static Public Attributes inherited from om::physics::constraints::Constraint
static const ResourceType RESOURCE_TYPE
 The resource type for a constraint. More...
 

Additional Inherited Members

- Protected Member Functions inherited from om::physics::constraints::Constraint
 Constraint (const ConstraintType *newType)
 Create a Constraint object that has the specified type. More...
 
- Protected Member Functions inherited from om::physics::context::PhysicsContextObject
 PhysicsContextObject ()
 Create a new physics context object that doesn't have an associated physics context. More...
 
 PhysicsContextObject (PhysicsContext *newContext)
 Create a new physics context object that uses the specified context for simulation. More...
 
- Protected Attributes inherited from om::physics::context::PhysicsContextObject
PhysicsContextcontext
 A pointer to the physics context this object is using. More...
 

Detailed Description

An interface for classes that solves contact constraints between objects in a simulation.

Member Typedef Documentation

Define the type to use for a contact manifold ID.

Define the type to use for a contact ID.

Constructor & Destructor Documentation

om::physics::constraints::ContactConstraint::ContactConstraint ( )

Create a new contact constraint with no constraints.

Member Function Documentation

void om::physics::constraints::ContactConstraint::updateContacts ( const CollisionResultSet collisions)

Update this contact constraint using the specified collision result set.

The results in the result set are matched to existing contacts, and any existing contacts that are not in the result set are removed.

virtual void om::physics::constraints::ContactConstraint::solverStart ( const ConstraintRequest request,
UInt32  userID,
Float  dt 
)
virtual

Initialize the constraint solving for the specified constraint ID and timestep.

Implements om::physics::constraints::Constraint.

virtual void om::physics::constraints::ContactConstraint::solverIterate ( const ConstraintRequest request,
UInt32  userID,
Float  dt 
)
virtual

Iterate the solution the constraint solving for the specified constraint ID and timestep.

Implements om::physics::constraints::Constraint.

void om::physics::constraints::ContactConstraint::addPointToManifold ( ContactManifold manifold,
const CollisionPoint point 
)

Add a new collision point to the specified contact manifold.

UInt32 om::physics::constraints::ContactConstraint::findWorstContact ( ContactManifold manifold)

Find the worst contact point in the specified manifold and return its index.

static void om::physics::constraints::ContactConstraint::normalBasis ( const SIMDFloat4 &  normal,
SIMDFloat4 &  tangent,
SIMDFloat4 &  binormal 
)
inlinestatic

Construct an orthonormal basis from a normalized normal vector (z column).

static Float om::physics::constraints::ContactConstraint::getJacobian ( const SolverFrame frame,
const Contact c,
Float  invMassSum 
)
inlinestatic
static Float om::physics::constraints::ContactConstraint::getRelativeSpeed ( const SolverFrame frame,
const Contact c,
const VelocityState v1,
const VelocityState v2 
)
inlinestatic

Return the relative speed along the solver frame direction for the specified velocity states.

static Float om::physics::constraints::ContactConstraint::getRelativeSpeedBias ( const SolverFrame frame,
const Contact c,
const VelocityState v1,
const VelocityState v2 
)
inlinestatic

Return the relative bias speed along the solver frame direction for the specified velocity states.

static void om::physics::constraints::ContactConstraint::applyImpulses ( const Contact c,
Float  jXMag,
Float  jYMag,
Float  jZMag,
VelocityState v1,
VelocityState v2 
)
inlinestatic
static void om::physics::constraints::ContactConstraint::applyImpulse ( const SolverFrame frame,
Float  magnitude,
VelocityState v1,
VelocityState v2 
)
inlinestatic
static void om::physics::constraints::ContactConstraint::applyImpulseBias ( const SolverFrame frame,
Float  magnitude,
VelocityState v1,
VelocityState v2 
)
inlinestatic
static Float om::physics::constraints::ContactConstraint::crossMagnitude ( const SIMDFloat4 &  v1,
const SIMDFloat4 &  v2 
)
inlinestatic
static Float om::physics::constraints::ContactConstraint::getElasticityForSpeed ( Float  elasticity,
Float  speedZ,
Float  vc,
Float  vy 
)
inlinestatic

Return the elasticity as a function of the incident speed along the normal direction.

Member Data Documentation

const ConstraintType om::physics::constraints::ContactConstraint::TYPE
static

A constraint type object that represents the type of a contact constraint.

const Size om::physics::constraints::ContactConstraint::MAX_MANIFOLD_SIZE = 4
static

The maximum number of contacts that can be in a contact manifold.

ObjectPool<Contact,8,ContactID,AlignedAllocator<16> > om::physics::constraints::ContactConstraint::contacts

A pool of the contacts that are in this constraint.

ObjectPool<ContactManifold,8,ManifoldID> om::physics::constraints::ContactConstraint::manifolds

A pool of the contact manifolds that are in this constraint.

HashMap<ObjectPair,ContactManifold*> om::physics::constraints::ContactConstraint::manifoldMap

A map from object pairs to contact manifolds.

UInt32 om::physics::constraints::ContactConstraint::timestamp

The global time stamp for the most recent simulation step.

This value is used to keep track of which constraints have not been updated so that they can be removed from the simulation.


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