opal::AttractorMotor Class Reference

#include <AttractorMotor.h>

Inheritance diagram for opal::AttractorMotor:

opal::Motor List of all members.

Public Member Functions

 AttractorMotor ()
virtual ~AttractorMotor ()
virtual void OPAL_CALL init (const AttractorMotorData &data)
virtual const AttractorMotorData
&OPAL_CALL 
getData () const
virtual MotorType OPAL_CALL getType () const
virtual void OPAL_CALL setName (const std::string &name)
virtual const std::string
&OPAL_CALL 
getName () const
virtual bool OPAL_CALL isEnabled () const
virtual void OPAL_CALL setEnabled (bool e)
virtual void OPAL_CALL setStrength (real s)
virtual real OPAL_CALL getStrength () const
virtual void OPAL_CALL setExponent (real e)
virtual real OPAL_CALL getExponent () const
virtual void OPAL_CALL internal_update ()
virtual bool OPAL_CALL internal_dependsOnSolid (Solid *s)

Protected Attributes

AttractorMotorData mData
real mSolid0Mass
real mSolid1Mass
real mMassConstant

Detailed Description

This type of Motor attracts two Solids together by applying gravitational forces on each Solid every time step. It uses the equation force magnitude = (strength * m0 * m1) / distance^exponent, where "strength" and "exponent" are changeable parameters. This can work with dynamic-dynamic and dynamic-static Solid pairs, but it will do nothing for static-static Solid pairs.

Definition at line 43 of file AttractorMotor.h.


Constructor & Destructor Documentation

opal::AttractorMotor::AttractorMotor  ) 
 

Definition at line 33 of file AttractorMotor.cpp.

References mMassConstant, mSolid0Mass, and mSolid1Mass.

opal::AttractorMotor::~AttractorMotor  )  [virtual]
 

Definition at line 42 of file AttractorMotor.cpp.


Member Function Documentation

const AttractorMotorData & opal::AttractorMotor::getData  )  const [virtual]
 

Returns all data describing the Motor.

Definition at line 73 of file AttractorMotor.cpp.

References mData.

real opal::AttractorMotor::getExponent  )  const [virtual]
 

Returns the exponent parameter.

Definition at line 164 of file AttractorMotor.cpp.

References opal::AttractorMotorData::exponent, and mData.

const std::string & opal::AttractorMotor::getName  )  const [virtual]
 

Returns the Motor's name.

Implements opal::Motor.

Definition at line 88 of file AttractorMotor.cpp.

References mData, and opal::MotorData::name.

real opal::AttractorMotor::getStrength  )  const [virtual]
 

Returns the strength parameter.

Definition at line 154 of file AttractorMotor.cpp.

References mData, and opal::AttractorMotorData::strength.

MotorType opal::AttractorMotor::getType  )  const [virtual]
 

Returns the Motor type.

Implements opal::Motor.

Definition at line 78 of file AttractorMotor.cpp.

References opal::MotorData::getType(), and mData.

void opal::AttractorMotor::init const AttractorMotorData data  )  [virtual]
 

Initializes the Motor with the given data structure. If the Solid pointers in the data are NULL, the Motor will do nothing.

Definition at line 58 of file AttractorMotor.cpp.

References opal::Solid::getMass(), opal::Motor::init(), mData, mMassConstant, mSolid0Mass, mSolid1Mass, opal::AttractorMotorData::solid0, opal::AttractorMotorData::solid1, and opal::AttractorMotorData::strength.

bool opal::AttractorMotor::internal_dependsOnSolid Solid s  )  [virtual]
 

Returns true if this Motor depends on the given Solid.

Reimplemented from opal::Motor.

Definition at line 169 of file AttractorMotor.cpp.

References mData, opal::AttractorMotorData::solid0, and opal::AttractorMotorData::solid1.

void opal::AttractorMotor::internal_update  )  [virtual]
 

Called regularly to update the Motor. This does nothing if the Motor is disabled.

Implements opal::Motor.

Definition at line 108 of file AttractorMotor.cpp.

References opal::Solid::addForce(), opal::MotorData::enabled, opal::AttractorMotorData::exponent, opal::Solid::getPosition(), opal::GLOBAL_FORCE, opal::Vec3r::length(), opal::Vec3r::lengthSquared(), mData, mMassConstant, opal::Vec3r::normalize(), opal::Force::singleStep, opal::AttractorMotorData::solid0, opal::AttractorMotorData::solid1, opal::Force::type, and opal::Force::vec.

bool opal::AttractorMotor::isEnabled  )  const [virtual]
 

Returns true if the Motor is enabled.

Implements opal::Motor.

Definition at line 93 of file AttractorMotor.cpp.

References opal::MotorData::enabled, and mData.

void opal::AttractorMotor::setEnabled bool  e  )  [virtual]
 

Sets whether the Motor has any effect.

Implements opal::Motor.

Definition at line 98 of file AttractorMotor.cpp.

References opal::MotorData::enabled, and mData.

void opal::AttractorMotor::setExponent real  e  )  [virtual]
 

Sets the exponent parameter.

Definition at line 159 of file AttractorMotor.cpp.

References opal::AttractorMotorData::exponent, and mData.

void opal::AttractorMotor::setName const std::string &  name  )  [virtual]
 

Sets the Motor's name.

Implements opal::Motor.

Definition at line 83 of file AttractorMotor.cpp.

References mData, and opal::MotorData::name.

void opal::AttractorMotor::setStrength real  s  )  [virtual]
 

Sets the strength parameter.

Definition at line 146 of file AttractorMotor.cpp.

References mData, mMassConstant, mSolid0Mass, mSolid1Mass, and opal::AttractorMotorData::strength.


Member Data Documentation

AttractorMotorData opal::AttractorMotor::mData [protected]
 

Stores data describing the Motor.

Definition at line 85 of file AttractorMotor.h.

Referenced by getData(), getExponent(), getName(), getStrength(), getType(), init(), internal_dependsOnSolid(), internal_update(), isEnabled(), setEnabled(), setExponent(), setName(), and setStrength().

real opal::AttractorMotor::mMassConstant [protected]
 

Cached copy of strength * m0 * m1.

Definition at line 94 of file AttractorMotor.h.

Referenced by AttractorMotor(), init(), internal_update(), and setStrength().

real opal::AttractorMotor::mSolid0Mass [protected]
 

Cached copy of Solid 0's mass.

Definition at line 88 of file AttractorMotor.h.

Referenced by AttractorMotor(), init(), and setStrength().

real opal::AttractorMotor::mSolid1Mass [protected]
 

Cached copy of Solid 1's mass.

Definition at line 91 of file AttractorMotor.h.

Referenced by AttractorMotor(), init(), and setStrength().


The documentation for this class was generated from the following files:
Generated on Tue May 16 17:49:55 2006 for OPAL by  doxygen 1.4.6-NO