Om  1.0.0
A universal framework for multimedia simulation
Public Member Functions | Static Public Attributes | List of all members
om::physics::forces::Spring Class Reference

A class that applies a damped spring force between two physics objects. More...

#include <omPhysicsSpring.h>

Inheritance diagram for om::physics::forces::Spring:
om::physics::forces::Force om::physics::context::PhysicsSceneObject om::physics::context::PhysicsContextObject

Public Member Functions

 Spring ()
 Create a new spring with no objects attached. More...
 
 Spring (ObjectState *newObject1, ObjectState *newObject2, const Vector3f &newLocalR1, const Vector3f &newLocalR2)
 Create a new spring attachment between the specified objects at the given local points. More...
 
 Spring (RigidObject *newObject1, RigidObject *newObject2, const Vector3f &newLocalR1, const Vector3f &newLocalR2)
 Create a new spring attachment between the specified objects at the given local points. More...
 
RigidObjectgetObject1 () const
 Return a pointer to first object that is affected by the spring. More...
 
RigidObjectgetObject2 () const
 Return a pointer to second object that is affected by the spring. More...
 
void setObject1 (RigidObject *newObject1)
 Set a pointer to first object that is affected by the spring. More...
 
void setObject2 (RigidObject *newObject2)
 Set a pointer to second object that is affected by the spring. More...
 
ObjectStategetObjectState1 () const
 Return a pointer to first object state that is affected by the spring. More...
 
ObjectStategetObjectState2 () const
 Return a pointer to second object state that is affected by the spring. More...
 
void setObjectState1 (ObjectState *newObjectState1)
 Set a pointer to first object state that is affected by the spring. More...
 
void setObjectState2 (ObjectState *newObjectState2)
 Set a pointer to second object state that is affected by the spring. More...
 
const Vector3f & getLocalPoint1 () const
 Return the spring's attachment point on the first object in its local space. More...
 
const Vector3f & getLocalPoint2 () const
 Return the spring's attachment point on the second object in its local space. More...
 
void setLocalPoint1 (const Vector3f &newLocalPoint1)
 Set the spring's attachment point on the first object in its local space. More...
 
void setLocalPoint2 (const Vector3f &newLocalPoint2)
 Set the spring's attachment point on the second object in its local space. More...
 
Float getRestLength () const
 Return the rest length of this spring in meters. More...
 
void setRestLength (Float newRestLength)
 Set the rest length of this spring in meters. More...
 
Float getStiffness () const
 Return the stiffness constant of this spring (kg/s^2). More...
 
void setStiffness (Float newStiffness)
 Set the stiffness constant of this spring (kg/s^2). More...
 
Float getDamping () const
 Return the damping constant of this spring. More...
 
void setDamping (Float newDamping)
 Set the damping constant of this spring. More...
 
virtual void applyForce (Float dt)
 Apply force vectors to all objects that this Force effects. More...
 
virtual Bool setContext (PhysicsContext *newContext)
 Set a pointer to the physics context this force field should use to do simulation. More...
 
virtual Bool addSceneObjects (PhysicsSceneID sceneID)
 Add internal context objects to the scene with the specified ID. More...
 
- Public Member Functions inherited from om::physics::forces::Force
virtual ~Force ()
 Destory this force object. More...
 
const ForceTypegetType () const
 Return an object representing the type of this Force. 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...
 
Bool clearContext ()
 Clear the previous context from this object. More...
 

Static Public Attributes

static const ForceType TYPE
 A force type object that represents the type of a spring. More...
 
- Static Public Attributes inherited from om::physics::forces::Force
static const ResourceType RESOURCE_TYPE
 The resource type for a force. More...
 

Additional Inherited Members

- Protected Member Functions inherited from om::physics::forces::Force
 Force (const ForceType *newType)
 Create a Force 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

A class that applies a damped spring force between two physics objects.

Constructor & Destructor Documentation

om::physics::forces::Spring::Spring ( )

Create a new spring with no objects attached.

om::physics::forces::Spring::Spring ( ObjectState newObject1,
ObjectState newObject2,
const Vector3f &  newLocalR1,
const Vector3f &  newLocalR2 
)

Create a new spring attachment between the specified objects at the given local points.

om::physics::forces::Spring::Spring ( RigidObject newObject1,
RigidObject newObject2,
const Vector3f &  newLocalR1,
const Vector3f &  newLocalR2 
)

Create a new spring attachment between the specified objects at the given local points.

Member Function Documentation

RigidObject* om::physics::forces::Spring::getObject1 ( ) const
inline

Return a pointer to first object that is affected by the spring.

RigidObject* om::physics::forces::Spring::getObject2 ( ) const
inline

Return a pointer to second object that is affected by the spring.

void om::physics::forces::Spring::setObject1 ( RigidObject newObject1)

Set a pointer to first object that is affected by the spring.

void om::physics::forces::Spring::setObject2 ( RigidObject newObject2)

Set a pointer to second object that is affected by the spring.

ObjectState* om::physics::forces::Spring::getObjectState1 ( ) const
inline

Return a pointer to first object state that is affected by the spring.

ObjectState* om::physics::forces::Spring::getObjectState2 ( ) const
inline

Return a pointer to second object state that is affected by the spring.

void om::physics::forces::Spring::setObjectState1 ( ObjectState newObjectState1)
inline

Set a pointer to first object state that is affected by the spring.

void om::physics::forces::Spring::setObjectState2 ( ObjectState newObjectState2)
inline

Set a pointer to second object state that is affected by the spring.

const Vector3f& om::physics::forces::Spring::getLocalPoint1 ( ) const
inline

Return the spring's attachment point on the first object in its local space.

If the object is invalid (e.g. NULL), the point is assumed to be in world space.

const Vector3f& om::physics::forces::Spring::getLocalPoint2 ( ) const
inline

Return the spring's attachment point on the second object in its local space.

If the object is invalid (e.g. NULL), the point is assumed to be in world space.

void om::physics::forces::Spring::setLocalPoint1 ( const Vector3f &  newLocalPoint1)
inline

Set the spring's attachment point on the first object in its local space.

If the object is invalid (e.g. NULL), the point is assumed to be in world space.

void om::physics::forces::Spring::setLocalPoint2 ( const Vector3f &  newLocalPoint2)
inline

Set the spring's attachment point on the second object in its local space.

If the object is invalid (e.g. NULL), the point is assumed to be in world space.

Float om::physics::forces::Spring::getRestLength ( ) const
inline

Return the rest length of this spring in meters.

void om::physics::forces::Spring::setRestLength ( Float  newRestLength)
inline

Set the rest length of this spring in meters.

The new rest length is clamped to be greater than or equal to zero.

Float om::physics::forces::Spring::getStiffness ( ) const
inline

Return the stiffness constant of this spring (kg/s^2).

void om::physics::forces::Spring::setStiffness ( Float  newStiffness)
inline

Set the stiffness constant of this spring (kg/s^2).

The new stiffness constant is clamped to be greater than or equal to zero.

Float om::physics::forces::Spring::getDamping ( ) const
inline

Return the damping constant of this spring.

void om::physics::forces::Spring::setDamping ( Float  newDamping)
inline

Set the damping constant of this spring.

The new damping constant is clamped to be greater than or equal to zero.

virtual void om::physics::forces::Spring::applyForce ( Float  dt)
virtual

Apply force vectors to all objects that this Force effects.

These force vectors should be based on the internal configuration of the force system.

Implements om::physics::forces::Force.

virtual Bool om::physics::forces::Spring::setContext ( PhysicsContext newContext)
virtual

Set a pointer to the physics context this force field should use to do simulation.

Reimplemented from om::physics::context::PhysicsContextObject.

virtual Bool om::physics::forces::Spring::addSceneObjects ( PhysicsSceneID  sceneID)
virtual

Add internal context objects to the scene with the specified ID.

Member Data Documentation

const ForceType om::physics::forces::Spring::TYPE
static

A force type object that represents the type of a spring.


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