VR-Forces 5.0.2 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Classes | Public Types | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | Friends
makVrv::DtRk4MotionModel Class Reference

Implementation of a buoyancy model using RK4 integration.

Basic usage is to attach buoyancy floats, set position/orientation, and tick every frame.

Inheritance diagram for makVrv::DtRk4MotionModel:
Inheritance graph
[legend]

Classes

struct  Acceleration
 
struct  AppliedForce
 
struct  BuoyancySample
 
struct  Derivative
 
struct  State
 

Public Types

typedef std::vector
< BuoyancySample * > 
BuoyancySampleVec
 

Public Member Functions

 DtRk4MotionModel (makVrv::DtDe &de)
 
virtual ~DtRk4MotionModel ()
 
void tick (double dt)
 
DtVector velocity () const
 
DtVector position () const
 
DtTaitBryan orientation () const
 
void setPosition (const DtVector &position)
 
void setOrientation (const DtTaitBryan &orientation)
 
void setTargetOrientation (const DtTaitBryan &orientation)
 
void setSpeed (double speed)
 
void sink ()
 
void unsink ()
 
bool isSinking ()
 
void setSinkingSpeedScale (double scale)
 
double sinkingSpeedScale () const
 
void setRotationalInertia (double pitchInertia, double rollInertia)
 
void applyForce (const DtVector &offset, const DtVector &force)
 
void applyHeadingTorque (double magnitude)
 
void applyRollTorque (double magnitude)
 
void addBuoyancySample (BuoyancySample *bs)
 
BuoyancySampleVecbuoyancySamples ()
 
void setOrigin (const DtVector &pos)
 
DtVector origin () const
 
void moveOrigin (const DtVector &pos)
 

Static Public Attributes

static const double theTimeStep
 

Private Member Functions

DtVector worldPos (const DtVector &bodyOffset) const
 
DtTaitBryan worldOri (const DtTaitBryan &bodyOffset) const
 
DtVector localPos (const DtVector &pos) const
 
DtTaitBryan localOri (const DtTaitBryan &ori) const
 
virtual void slot_coordinateSystemChanged ()
 
Derivative evaluate (const State &initial, double dt, const Derivative &d)
 
Acceleration acceleration (const State &initial, double dt)
 

Private Attributes

DtCoordinateConvertermyCoordinateConverter
 
AppliedForce myAppliedForce
 
State myState
 
bool mySinking
 
double myHeadingTorque
 
double myRollTorque
 
double myPitchTorque
 
double myForwardSpeed
 
double mySinkingDensity
 
double mySinkingSpeedScale
 
double myRollInertia
 
double myPitchInertia
 
DtVector myOriginPos
 
DtDemyDe
 
BuoyancySampleVec myBuoyancySamples
 

Friends

struct BuoyancySample
 

Additional Inherited Members

- Protected Types inherited from makVrv::DtSignalConnectionManager
typedef std::vector
< boost::signalslib::connection > 
Connections
 
- Protected Member Functions inherited from makVrv::DtSignalConnectionManager
 DtSignalConnectionManager ()
 
virtual ~DtSignalConnectionManager ()
 
void manageConnection (const boost::signalslib::connection &conn)
 
DtSignalConnectionManageroperator+= (const boost::signalslib::connection &conn)
 
bool blockConnections (bool blocked)
 
int numberOfConnections () const
 
void disconnectSignals ()
 
bool connectionsBlocked () const
 
- Protected Attributes inherited from makVrv::DtSignalConnectionManager
Connections myConnections
 
bool myConnectionsBlocked
 
bool myIndiviualConnectionedBlocked
 
std::vector
< boost::signalslib::shared_connection_block * > 
mySharedConnectionsBlockManager
 

Member Typedef Documentation

Constructor & Destructor Documentation

makVrv::DtRk4MotionModel::DtRk4MotionModel ( makVrv::DtDe de)

CTOR.

virtual makVrv::DtRk4MotionModel::~DtRk4MotionModel ( )
virtual

DTOR.

Member Function Documentation

void makVrv::DtRk4MotionModel::tick ( double  dt)

Tick the physics simulation.

Internally this runs multiple fixed time steps until the full dt has been ticked through.

DtVector makVrv::DtRk4MotionModel::velocity ( ) const

Get the object's linear velocity in world coordinates.

DtVector makVrv::DtRk4MotionModel::position ( ) const

Get the object's position in world coordinates.

DtTaitBryan makVrv::DtRk4MotionModel::orientation ( ) const

Get the object's orientation in world coordinates.

void makVrv::DtRk4MotionModel::setPosition ( const DtVector position)

Set the object's position in world coordinates.

void makVrv::DtRk4MotionModel::setOrientation ( const DtTaitBryan &  orientation)

Set the object's orientation in world coordinates.

void makVrv::DtRk4MotionModel::setTargetOrientation ( const DtTaitBryan &  orientation)

Set the resting orientation of the object in world coordinates.

void makVrv::DtRk4MotionModel::setSpeed ( double  speed)

Set the forward speed of the object.

This overwrites the current velocity

void makVrv::DtRk4MotionModel::sink ( )

Start simulated sinking.

void makVrv::DtRk4MotionModel::unsink ( )

Restore the object to the water surface.

bool makVrv::DtRk4MotionModel::isSinking ( )

Returns whether the model is currently sinking.

void makVrv::DtRk4MotionModel::setSinkingSpeedScale ( double  scale)

Allow the user to vary the speed at which ships sink.

double makVrv::DtRk4MotionModel::sinkingSpeedScale ( ) const

Get the current sinking speed scale.

void makVrv::DtRk4MotionModel::setRotationalInertia ( double  pitchInertia,
double  rollInertia 
)

Set roll and pitch inertia coefficients in entity local coordinates.

void makVrv::DtRk4MotionModel::applyForce ( const DtVector offset,
const DtVector force 
)

apply a force at offset (in entity coordinatess) for the next frame

void makVrv::DtRk4MotionModel::applyHeadingTorque ( double  magnitude)

Apply a torque around the up vector for the next frame.

void makVrv::DtRk4MotionModel::applyRollTorque ( double  magnitude)

Apply a torque around the forward vector for the next frame.

void makVrv::DtRk4MotionModel::addBuoyancySample ( BuoyancySample bs)

Add a buoyancy sample point to the simulated object.

BuoyancySampleVec& makVrv::DtRk4MotionModel::buoyancySamples ( )

Get a list of the sample points.

void makVrv::DtRk4MotionModel::setOrigin ( const DtVector pos)

Set an origin point in world coordinates for the simulation to use for its topo coordinate system.

Use this only for initialization; to move the origin of a running simulation, use moveOrigin instead.

DtVector makVrv::DtRk4MotionModel::origin ( ) const

Get the origin of the simulation's topo system in world coordinates.

void makVrv::DtRk4MotionModel::moveOrigin ( const DtVector pos)

Move the origin of the simulation's topo system to a new origin, in world coordinates.

DtVector makVrv::DtRk4MotionModel::worldPos ( const DtVector bodyOffset) const
private

Convert local position offset into world position.

DtTaitBryan makVrv::DtRk4MotionModel::worldOri ( const DtTaitBryan &  bodyOffset) const
private

Convert local pitch/roll offset into world orientation.

DtVector makVrv::DtRk4MotionModel::localPos ( const DtVector pos) const
private

Convert world position offset into local position.

DtTaitBryan makVrv::DtRk4MotionModel::localOri ( const DtTaitBryan &  ori) const
private

Convert world orientation into local hrp.

virtual void makVrv::DtRk4MotionModel::slot_coordinateSystemChanged ( )
privatevirtual

Update the cached coordinate converter.

Derivative makVrv::DtRk4MotionModel::evaluate ( const State initial,
double  dt,
const Derivative d 
)
private

Compute the derivatives from the passed in motion state and initial derivatives, over time step dt.

Acceleration makVrv::DtRk4MotionModel::acceleration ( const State initial,
double  dt 
)
private

Compute the second derivatives for the passed in motion state over time step dt.

Friends And Related Function Documentation

friend struct BuoyancySample
friend

Member Data Documentation

const double makVrv::DtRk4MotionModel::theTimeStep
static

time step for the motion model in seconds (currently 1/60 of a second)

DtCoordinateConverter* makVrv::DtRk4MotionModel::myCoordinateConverter
private
AppliedForce makVrv::DtRk4MotionModel::myAppliedForce
private
State makVrv::DtRk4MotionModel::myState
private
bool makVrv::DtRk4MotionModel::mySinking
private
double makVrv::DtRk4MotionModel::myHeadingTorque
private
double makVrv::DtRk4MotionModel::myRollTorque
private
double makVrv::DtRk4MotionModel::myPitchTorque
private
double makVrv::DtRk4MotionModel::myForwardSpeed
private
double makVrv::DtRk4MotionModel::mySinkingDensity
private
double makVrv::DtRk4MotionModel::mySinkingSpeedScale
private
double makVrv::DtRk4MotionModel::myRollInertia
private
double makVrv::DtRk4MotionModel::myPitchInertia
private
DtVector makVrv::DtRk4MotionModel::myOriginPos
private
DtDe& makVrv::DtRk4MotionModel::myDe
private
BuoyancySampleVec makVrv::DtRk4MotionModel::myBuoyancySamples
private

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

Document ID: Generated on Sun Dec 4 20:22:03 EST 2022 from SVN revision 249613
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)