opal::Solid Class Reference

#include <Solid.h>

Inheritance diagram for opal::Solid:

opal::ODESolid List of all members.

Public Member Functions

 Solid ()
virtual void OPAL_CALL init (const SolidData &data)=0
virtual const SolidData &OPAL_CALL getData ()
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 bool OPAL_CALL isStatic () const
virtual void OPAL_CALL setStatic (bool s)=0
virtual void OPAL_CALL setSpace (Space *newSpace)=0
virtual void OPAL_CALL setSleeping (bool sleeping)=0
virtual bool OPAL_CALL isSleeping () const =0
virtual void OPAL_CALL setSleepiness (real s)
virtual real OPAL_CALL getSleepiness () const
virtual void OPAL_CALL setLinearDamping (real ld)
virtual real OPAL_CALL getLinearDamping () const
virtual void OPAL_CALL setAngularDamping (real ad)
virtual real OPAL_CALL getAngularDamping () const
virtual void OPAL_CALL setUserData (void *data)
virtual void *OPAL_CALL getUserData () const
virtual void OPAL_CALL setTransform (const Matrix44r &t)
virtual const Matrix44r &OPAL_CALL getTransform () const
virtual void OPAL_CALL setPosition (real x, real y, real z)
virtual void OPAL_CALL setPosition (const Point3r &p)
virtual Point3r OPAL_CALL getPosition () const
virtual Vec3r OPAL_CALL getEulerXYZ () const
virtual Quaternion OPAL_CALL getQuaternion () const
virtual void OPAL_CALL setQuaternion (const Quaternion &q)
virtual void OPAL_CALL setQuaternion (real w, real x, real y, real z)
virtual void OPAL_CALL getLocalAABB (real aabb[6]) const
virtual void OPAL_CALL getGlobalAABB (real aabb[6]) const
virtual void OPAL_CALL clearShapes ()=0
virtual void OPAL_CALL addShape (ShapeData &data)=0
virtual void OPAL_CALL addForce (const Force &f)
virtual void OPAL_CALL zeroForces ()=0
virtual void OPAL_CALL setLocalLinearVel (const Vec3r &vel)=0
virtual Vec3r OPAL_CALL getLocalLinearVel () const =0
virtual Vec3r OPAL_CALL getLocalLinearVelAtLocalPos (const Point3r &p) const =0
virtual void OPAL_CALL setLocalAngularVel (const Vec3r &vel)=0
virtual Vec3r OPAL_CALL getLocalAngularVel () const =0
virtual void OPAL_CALL setGlobalLinearVel (const Vec3r &vel)=0
virtual Vec3r OPAL_CALL getGlobalLinearVel () const =0
virtual Vec3r OPAL_CALL getGlobalLinearVelAtLocalPos (const Point3r &p) const =0
virtual void OPAL_CALL setGlobalAngularVel (const Vec3r &vel)=0
virtual Vec3r OPAL_CALL getGlobalAngularVel () const =0
virtual void OPAL_CALL setMass (const Mass &newmass, const Matrix44r &offset)=0
virtual void OPAL_CALL translateMass (const Vec3r &offset)=0
virtual void OPAL_CALL setCollisionEventHandler (CollisionEventHandler *eventHandler)
virtual CollisionEventHandler
*OPAL_CALL 
getCollisionEventHandler () const
virtual real OPAL_CALL getMass () const =0
virtual Matrix44r OPAL_CALL getInertiaTensor () const =0
virtual bool OPAL_CALL isMoving () const
virtual void OPAL_CALL setMovingState (bool moving)
virtual void OPAL_CALL setMovementEventHandler (MovementEventHandler *eventHandler)
virtual MovementEventHandler
*OPAL_CALL 
getMovementEventHandler () const
virtual void OPAL_CALL internal_updateOPALTransform ()=0
virtual void OPAL_CALL internal_updateEngineTransform ()=0
virtual void OPAL_CALL internal_applyForces (real stepSize)
void internal_updateSleeping ()
virtual void OPAL_CALL internal_destroy ()

Protected Member Functions

virtual ~Solid ()
virtual void applyForce (const Force &f)=0
void addToLocalAABB (const real aabb[6])
void resetAABB ()

Protected Attributes

std::vector< ForcemForceList
SolidData mData
real mLocalAABB [6]
CollisionEventHandlermCollisionEventHandler
void * mUserData

Private Attributes

bool mIsMoving
MovementEventHandlermMovementEventHandler

Detailed Description

Solids are the physical objects in a simulation. Solids can be static or dynamic: basically, dynamic Solids move, and static Solids don't move. (Static Solids can still be positioned manually.) All Solids start out enabled, but they don't do much until Shapes are added.

Definition at line 49 of file Solid.h.


Constructor & Destructor Documentation

opal::Solid::Solid  ) 
 

Definition at line 32 of file Solid.cpp.

References resetAABB(), setCollisionEventHandler(), setMovementEventHandler(), setMovingState(), and setUserData().

opal::Solid::~Solid  )  [protected, virtual]
 

Definition at line 43 of file Solid.cpp.

References mForceList.


Member Function Documentation

void opal::Solid::addForce const Force f  )  [virtual]
 

Applies a force/torque to this Solid. If the Solid is disabled, the Solid is static, or the magnitude of the force/torque is zero, this will do nothing.

Definition at line 252 of file Solid.cpp.

References opal::areEqual(), opal::SolidData::enabled, opal::SolidData::isStatic, opal::Vec3r::lengthSquared(), mData, mForceList, and opal::Force::vec.

Referenced by opal::Joint::addForce(), opal::Joint::addTorque(), opal::ThrusterMotor::internal_update(), opal::SpringMotor::internal_update(), and opal::AttractorMotor::internal_update().

virtual void OPAL_CALL opal::Solid::addShape ShapeData data  )  [pure virtual]
 

Adds a Shape to this Solid. Updates the Solid's axis-aligned bounding box.

Implemented in opal::ODESolid.

Referenced by opal::Simulator::createPlane().

void opal::Solid::addToLocalAABB const real  aabb[6]  )  [protected]
 

Adds the given axis-aligned bounding box to the Solid's AABB.

Definition at line 318 of file Solid.cpp.

References mLocalAABB.

virtual void opal::Solid::applyForce const Force f  )  [protected, pure virtual]
 

Physics engine-specific function for applying Forces to Solids.

Implemented in opal::ODESolid.

virtual void OPAL_CALL opal::Solid::clearShapes  )  [pure virtual]
 

Removes all shapes from this Solid. Resets the Solid's axis-aligned bounding box.

Implemented in opal::ODESolid.

real opal::Solid::getAngularDamping  )  const [virtual]
 

Returns the amount of angular damping on this Solid.

Definition at line 142 of file Solid.cpp.

References opal::SolidData::angularDamping, and mData.

CollisionEventHandler * opal::Solid::getCollisionEventHandler  )  const [virtual]
 

Returns the Solid's collision event handler. If this returns NULL, the Solid is not using one.

Definition at line 313 of file Solid.cpp.

References mCollisionEventHandler.

Referenced by opal::ode_hidden::internal_collisionCallback().

const SolidData & opal::Solid::getData  )  [virtual]
 

Returns all data describing the Solid.

Definition at line 81 of file Solid.cpp.

References isSleeping(), mData, and opal::SolidData::sleeping.

Vec3r opal::Solid::getEulerXYZ  )  const [virtual]
 

Returns the euler angles of the Solid's orientation.

Definition at line 185 of file Solid.cpp.

References opal::Matrix44r::getEulerXYZ(), mData, and opal::SolidData::transform.

void opal::Solid::getGlobalAABB real  aabb[6]  )  const [virtual]
 

Returns the axis-aligned bounding box for all of the Solid's shapes in global coordinates.

Definition at line 215 of file Solid.cpp.

References mData, mLocalAABB, and opal::SolidData::transform.

virtual Vec3r OPAL_CALL opal::Solid::getGlobalAngularVel  )  const [pure virtual]
 

Returns the Solid's angular velocity in global coordinates.

Implemented in opal::ODESolid.

Referenced by opal::AccelerationSensor::internal_update().

virtual Vec3r OPAL_CALL opal::Solid::getGlobalLinearVel  )  const [pure virtual]
 

Returns the Solid's linear velocity in global coordinates.

Implemented in opal::ODESolid.

Referenced by opal::VelocityMotor::internal_update(), opal::SpringMotor::internal_update(), and opal::AccelerationSensor::internal_update().

virtual Vec3r OPAL_CALL opal::Solid::getGlobalLinearVelAtLocalPos const Point3r p  )  const [pure virtual]
 

Given an offset point relative to the Solid's local origin, returns the linear velocity of the point in global coordinates.

Implemented in opal::ODESolid.

virtual Matrix44r OPAL_CALL opal::Solid::getInertiaTensor  )  const [pure virtual]
 

Returns the Solid's inertia tensor as a 4x4 matrix. This will be the identity matrix if the Solid is static.

Implemented in opal::ODESolid.

real opal::Solid::getLinearDamping  )  const [virtual]
 

Returns the amount of linear damping on this Solid.

Definition at line 131 of file Solid.cpp.

References opal::SolidData::linearDamping, and mData.

void opal::Solid::getLocalAABB real  aabb[6]  )  const [virtual]
 

Returns the axis-aligned bounding box for all of the Solid's shapes relative to the Solid.

Definition at line 207 of file Solid.cpp.

References mLocalAABB.

virtual Vec3r OPAL_CALL opal::Solid::getLocalAngularVel  )  const [pure virtual]
 

Returns the Solid's angular velocity in local coordinates.

Implemented in opal::ODESolid.

Referenced by opal::AccelerationSensor::internal_update().

virtual Vec3r OPAL_CALL opal::Solid::getLocalLinearVel  )  const [pure virtual]
 

Returns the Solid's linear velocity in local coordinates.

Implemented in opal::ODESolid.

Referenced by opal::AccelerationSensor::internal_update().

virtual Vec3r OPAL_CALL opal::Solid::getLocalLinearVelAtLocalPos const Point3r p  )  const [pure virtual]
 

Given an offset point relative to the Solid's local origin, returns the linear velocity of the point in local coordinates.

Implemented in opal::ODESolid.

virtual real OPAL_CALL opal::Solid::getMass  )  const [pure virtual]
 

Returns the Solid's mass. This will return 0 if the Solid is static.

Implemented in opal::ODESolid.

Referenced by opal::AttractorMotor::init(), and opal::SpringMotor::internal_update().

MovementEventHandler * opal::Solid::getMovementEventHandler  )  const [virtual]
 

Returns the Solid's movement event handler. If this returns NULL, the Solid is not using one.

Definition at line 71 of file Solid.cpp.

References mMovementEventHandler.

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

Returns the Solid's name.

Definition at line 94 of file Solid.cpp.

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

Referenced by opal::BlueprintInstance::internal_addSolid().

Point3r opal::Solid::getPosition  )  const [virtual]
 

Returns the position of this Solid in global coordinates.

Definition at line 180 of file Solid.cpp.

References opal::Matrix44r::getPosition(), mData, and opal::SolidData::transform.

Referenced by opal::SpringMotor::getGlobalAttachPoint(), and opal::AttractorMotor::internal_update().

Quaternion opal::Solid::getQuaternion  )  const [virtual]
 

Returns a quaternion representing the Solid's orientation.

Definition at line 190 of file Solid.cpp.

References opal::Matrix44r::getQuaternion(), mData, and opal::SolidData::transform.

real opal::Solid::getSleepiness  )  const [virtual]
 

Returns the Solid's sleepiness level.

Definition at line 120 of file Solid.cpp.

References mData, and opal::SolidData::sleepiness.

const Matrix44r & opal::Solid::getTransform  )  const [virtual]
 

Returns a constant reference to this Solid's transform.

Definition at line 163 of file Solid.cpp.

References mData, and opal::SolidData::transform.

Referenced by opal::RaycastSensor::firePiercingRay(), opal::RaycastSensor::fireRay(), opal::InclineSensor::getAngle(), opal::SpringMotor::getGlobalAttachPoint(), opal::SpringMotor::internal_update(), opal::VolumeSensor::queryVolume(), opal::SpringMotor::setGlobalAttachPoint(), and opal::InclineSensor::setupInternalVectors().

void * opal::Solid::getUserData  )  const [virtual]
 

Returns the user data pointer (NULL if it has not been set).

Definition at line 152 of file Solid.cpp.

References mUserData.

virtual void OPAL_CALL opal::Solid::init const SolidData data  )  [pure virtual]
 

Initializes the Solid with the given data structure. Calling this more than once will automatically destroy all the old Shapes before adding new ones.

Implemented in opal::ODESolid.

void opal::Solid::internal_applyForces real  stepSize  )  [virtual]
 

Loops over the Solid's list of Forces and applies them.

Definition at line 261 of file Solid.cpp.

References isSleeping(), opal::SolidData::isStatic, mData, mForceList, and setSleeping().

void opal::Solid::internal_destroy  )  [virtual]
 

Internal function used to destroy this object.

Definition at line 76 of file Solid.cpp.

virtual void OPAL_CALL opal::Solid::internal_updateEngineTransform  )  [pure virtual]
 

Update the physics engine transform using the OPAL transform.

Implemented in opal::ODESolid.

Referenced by setPosition(), setQuaternion(), and setTransform().

virtual void OPAL_CALL opal::Solid::internal_updateOPALTransform  )  [pure virtual]
 

Update the OPAL transform using the physics engine transform.

Implemented in opal::ODESolid.

void opal::Solid::internal_updateSleeping  ) 
 

Updates the SolidData sleeping value from the physics engine.

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

Returns true if the Solid is enabled.

Definition at line 99 of file Solid.cpp.

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

bool opal::Solid::isMoving  )  const [virtual]
 

Returns true if the solid has moved since last call of Solid::isMoving().

Definition at line 48 of file Solid.cpp.

References mIsMoving.

virtual bool OPAL_CALL opal::Solid::isSleeping  )  const [pure virtual]
 

Returns true if the Solid is sleeping. If the Solid is static, this will always return true.

Implemented in opal::ODESolid.

Referenced by getData(), and internal_applyForces().

bool opal::Solid::isStatic  )  const [virtual]
 

Returns true if this is a static Solid.

Definition at line 109 of file Solid.cpp.

References opal::SolidData::isStatic, and mData.

Referenced by opal::ODEJoint::filterSolidForStaticness().

void opal::Solid::resetAABB  )  [protected]
 

Resets the Solid's axis-aligned bounding box.

Definition at line 335 of file Solid.cpp.

References mLocalAABB.

Referenced by opal::ODESolid::clearShapes(), and Solid().

void opal::Solid::setAngularDamping real  ad  )  [virtual]
 

Sets the amount of angular damping on this Solid.

Definition at line 136 of file Solid.cpp.

References opal::SolidData::angularDamping, and mData.

void opal::Solid::setCollisionEventHandler CollisionEventHandler eventHandler  )  [virtual]
 

Sets the Solid's collision event handler.

Definition at line 308 of file Solid.cpp.

References mCollisionEventHandler.

Referenced by Solid().

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

Sets whether the Solid can collide with other Solids and be physically simulated. Forces applied to this Solid while disabled will be ignored.

Reimplemented in opal::ODESolid.

Definition at line 104 of file Solid.cpp.

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

virtual void OPAL_CALL opal::Solid::setGlobalAngularVel const Vec3r vel  )  [pure virtual]
 

Sets the Solid's angular velocity in global coordinates.

Implemented in opal::ODESolid.

virtual void OPAL_CALL opal::Solid::setGlobalLinearVel const Vec3r vel  )  [pure virtual]
 

Sets the Solid's linear velocity in global coordinates.

Implemented in opal::ODESolid.

void opal::Solid::setLinearDamping real  ld  )  [virtual]
 

Sets the amount of linear damping on this Solid.

Definition at line 125 of file Solid.cpp.

References opal::SolidData::linearDamping, and mData.

Referenced by opal::VelocityMotor::init().

virtual void OPAL_CALL opal::Solid::setLocalAngularVel const Vec3r vel  )  [pure virtual]
 

Sets the Solid's angular velocity in local coordinates.

Implemented in opal::ODESolid.

virtual void OPAL_CALL opal::Solid::setLocalLinearVel const Vec3r vel  )  [pure virtual]
 

Sets the Solid's linear velocity in local coordinates.

Implemented in opal::ODESolid.

virtual void OPAL_CALL opal::Solid::setMass const Mass newmass,
const Matrix44r offset
[pure virtual]
 

Set a new mass, center, and intertia for the solid.

Implemented in opal::ODESolid.

void opal::Solid::setMovementEventHandler MovementEventHandler eventHandler  )  [virtual]
 

Sets the Solid's movement event handler.

Definition at line 66 of file Solid.cpp.

References mMovementEventHandler.

Referenced by Solid().

void opal::Solid::setMovingState bool  moving  )  [virtual]
 

Manual set of a moving state.

Definition at line 61 of file Solid.cpp.

References mIsMoving.

Referenced by Solid().

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

Sets the Solid's name.

Definition at line 89 of file Solid.cpp.

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

void opal::Solid::setPosition const Point3r p  )  [virtual]
 

Sets the position of this Solid in global coordinates.

Definition at line 175 of file Solid.cpp.

References setPosition().

void opal::Solid::setPosition real  x,
real  y,
real  z
[virtual]
 

Sets the position of this Solid in global coordinates.

Definition at line 168 of file Solid.cpp.

References internal_updateEngineTransform(), mData, mIsMoving, opal::Matrix44r::setPosition(), and opal::SolidData::transform.

Referenced by setPosition().

void opal::Solid::setQuaternion real  w,
real  x,
real  y,
real  z
[virtual]
 

Sets a quaternion representing the Solid's orientation.

Definition at line 200 of file Solid.cpp.

References internal_updateEngineTransform(), mData, mIsMoving, opal::Matrix44r::setQuaternion(), and opal::SolidData::transform.

void opal::Solid::setQuaternion const Quaternion q  )  [virtual]
 

Sets a quaternion representing the Solid's orientation.

Definition at line 195 of file Solid.cpp.

void opal::Solid::setSleepiness real  s  )  [virtual]
 

Sets the Solid's sleepiness level.

Reimplemented in opal::ODESolid.

Definition at line 114 of file Solid.cpp.

References mData, and opal::SolidData::sleepiness.

Referenced by opal::ODESolid::setSleepiness().

virtual void OPAL_CALL opal::Solid::setSleeping bool  sleeping  )  [pure virtual]
 

Sets whether the Solid is sleeping (i.e. set this to false to wake up a sleeping Solid).

Implemented in opal::ODESolid.

Referenced by internal_applyForces(), and opal::Joint::wakeSolids().

virtual void OPAL_CALL opal::Solid::setSpace Space newSpace  )  [pure virtual]
 

Removes the Solid from its current Space and adds it to the new Space.

Implemented in opal::ODESolid.

virtual void OPAL_CALL opal::Solid::setStatic bool  s  )  [pure virtual]
 

Sets whether the Solid should be static or dynamic.

Implemented in opal::ODESolid.

Referenced by opal::Simulator::createPlane().

void opal::Solid::setTransform const Matrix44r t  )  [virtual]
 

Sets this Solid's transform matrix.

Definition at line 157 of file Solid.cpp.

References internal_updateEngineTransform(), mData, and opal::SolidData::transform.

Referenced by opal::ODESolid::init(), opal::VolumeSensor::queryVolume(), and opal::ODESolid::setupNewGeom().

void opal::Solid::setUserData void *  data  )  [virtual]
 

Set this Solid's user data pointer to some external data. This can be used to let the Solid point to some user object (e.g. an object with a visual mesh). The user data is totally user-managed (i.e. it is not destroyed when the Solid is destroyed).

Definition at line 147 of file Solid.cpp.

References mUserData.

Referenced by Solid().

virtual void OPAL_CALL opal::Solid::translateMass const Vec3r offset  )  [pure virtual]
 

Translate the Solid's mass using the given offset vector specified in global coordinates.

Implemented in opal::ODESolid.

virtual void OPAL_CALL opal::Solid::zeroForces  )  [pure virtual]
 

Removes all forces and torques currently affecting this Solid.

Implemented in opal::ODESolid.


Member Data Documentation

CollisionEventHandler* opal::Solid::mCollisionEventHandler [protected]
 

Pointer to this Solid's collision event handler.

Definition at line 293 of file Solid.h.

Referenced by getCollisionEventHandler(), and setCollisionEventHandler().

SolidData opal::Solid::mData [protected]
 

Stores data describing the Solid.

Definition at line 284 of file Solid.h.

Referenced by addForce(), opal::ODESolid::addMass(), opal::ODESolid::clearShapes(), getAngularDamping(), getData(), getEulerXYZ(), getGlobalAABB(), opal::ODESolid::getGlobalAngularVel(), opal::ODESolid::getGlobalLinearVel(), opal::ODESolid::getGlobalLinearVelAtLocalPos(), opal::ODESolid::getInertiaTensor(), getLinearDamping(), opal::ODESolid::getLocalAngularVel(), opal::ODESolid::getLocalLinearVel(), opal::ODESolid::getLocalLinearVelAtLocalPos(), opal::ODESolid::getMass(), getName(), getPosition(), getQuaternion(), getSleepiness(), getTransform(), opal::ODESolid::init(), internal_applyForces(), opal::ODESolid::internal_updateEngineTransform(), opal::ODESolid::internal_updateOPALTransform(), isEnabled(), opal::ODESolid::isSleeping(), isStatic(), opal::ODESolid::ODESolid(), setAngularDamping(), setEnabled(), opal::ODESolid::setEnabled(), opal::ODESolid::setGlobalAngularVel(), opal::ODESolid::setGlobalLinearVel(), setLinearDamping(), opal::ODESolid::setLocalAngularVel(), opal::ODESolid::setLocalLinearVel(), opal::ODESolid::setMass(), setName(), setPosition(), setQuaternion(), setSleepiness(), opal::ODESolid::setSleepiness(), opal::ODESolid::setSleeping(), opal::ODESolid::setStatic(), setTransform(), opal::ODESolid::setupNewGeom(), opal::ODESolid::translateMass(), opal::ODESolid::zeroForces(), and opal::ODESolid::~ODESolid().

std::vector<Force> opal::Solid::mForceList [protected]
 

An internal list of this Solid's pending Forces.

Definition at line 281 of file Solid.h.

Referenced by addForce(), internal_applyForces(), opal::ODESolid::zeroForces(), and ~Solid().

bool opal::Solid::mIsMoving [mutable, private]
 

Data used for.

Definition at line 301 of file Solid.h.

Referenced by isMoving(), setMovingState(), setPosition(), and setQuaternion().

real opal::Solid::mLocalAABB[6] [protected]
 

The axis-aligned bounding box of all shapes in local coordinates. This array stores data in the following order: min x, max x, min y, max y, min z, max z. This gets updated whenever a shape is added or removed.

Definition at line 290 of file Solid.h.

Referenced by addToLocalAABB(), getGlobalAABB(), getLocalAABB(), and resetAABB().

MovementEventHandler* opal::Solid::mMovementEventHandler [private]
 

Definition at line 302 of file Solid.h.

Referenced by getMovementEventHandler(), and setMovementEventHandler().

void* opal::Solid::mUserData [protected]
 

Pointer to user data. This is totally user-managed (i.e. OPAL will never delete it).

Definition at line 297 of file Solid.h.

Referenced by getUserData(), and setUserData().


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