VR-Forces 4.5 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator 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. More...

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

Classes

struct  Acceleration
 Second derivative of the simulation's motion state. More...
struct  AppliedForce
struct  BuoyancySample
 Defines a buoyancy sample point. More...
struct  Derivative
 First and second derivatives of the simulation's motion state. More...
struct  State
 Motion state of the simulation. More...

Public Types

typedef std::vector
< BuoyancySample * > 
BuoyancySampleVec

Public Member Functions

 DtRk4MotionModel (makVrv::DtDe &de)
 CTOR.
virtual ~DtRk4MotionModel ()
 DTOR.
void tick (double dt)
 Tick the physics simulation.
DtVector velocity () const
 Get the object's linear velocity in world coordinates.
DtVector position () const
 Get the object's position in world coordinates.
DtTaitBryan orientation () const
 Get the object's orientation in world coordinates.
void setPosition (const DtVector &position)
 Set the object's position in world coordinates.
void setOrientation (const DtTaitBryan &orientation)
 Set the object's orientation in world coordinates.
void setTargetOrientation (const DtTaitBryan &orientation)
 Set the resting orientation of the object in world coordinates.
void setSpeed (double speed)
 Set the forward speed of the object.
void sink ()
 Start simulated sinking.
void unsink ()
 Restore the object to the water surface.
bool isSinking ()
 Returns whether the model is currently sinking.
void setSinkingSpeedScale (double scale)
 Allow the user to vary the speed at which ships sink.
double sinkingSpeedScale () const
 Get the current sinking speed scale.
void setRotationalInertia (double pitchInertia, double rollInertia)
 Set roll and pitch inertia coefficients in entity local coordinates.
void applyForce (const DtVector &offset, const DtVector &force)
 apply a force at offset (in entity coordinatess) for the next frame
void applyHeadingTorque (double magnitude)
 Apply a torque around the up vector for the next frame.
void applyRollTorque (double magnitude)
 Apply a torque around the forward vector for the next frame.
void addBuoyancySample (BuoyancySample *bs)
 Add a buoyancy sample point to the simulated object.
BuoyancySampleVecbuoyancySamples ()
 Get a list of the sample points.
void setOrigin (const DtVector &pos)
 Set an origin point in world coordinates for the simulation to use for its topo coordinate system.
DtVector origin () const
 Get the origin of the simulation's topo system in world coordinates.
void moveOrigin (const DtVector &pos)
 Move the origin of the simulation's topo system to a new origin, in world coordinates.

Static Public Attributes

static const double theTimeStep
 time step for the motion model in seconds (currently 1/60 of a second)
static const double theGeocentricWaterLineNudge
 adjustment for geocentric terrains for all buoyant objects.

Private Member Functions

DtVector worldPos (const DtVector &bodyOffset) const
 Convert local position offset into world position.
DtTaitBryan worldOri (const DtTaitBryan &bodyOffset) const
 Convert local pitch/roll offset into world orientation.
DtVector localPos (const DtVector &pos) const
 Convert world position offset into local position.
DtTaitBryan localOri (const DtTaitBryan &ori) const
 Convert world orientation into local hrp.
virtual void slot_coordinateSystemChanged ()
 Update the cached coordinate converter.
Derivative evaluate (const State &initial, double dt, const Derivative &d)
 Compute the derivatives from the passed in motion state and initial derivatives, over time step dt.
Acceleration acceleration (const State &initial, double dt)
 Compute the second derivatives for the passed in motion state over time step dt.

Private Attributes

DtCoordinateConvertermyCoordinateConverter
AppliedForce myAppliedForce
Dt3DLineModelInstanceSegmentmyDebugLine [8]
State myState
bool mySinking
double myHeadingTorque
double myRollTorque
double myPitchTorque
double myForwardSpeed
double mySinkingDensity
bool mySinkingFloat [6]
double mySinkingSpeedScale
double myRollInertia
double myPitchInertia
DtVector myOriginPos
DtDemyDe
BuoyancySampleVec myBuoyancySamples

Friends

struct BuoyancySample

Additional Inherited Members

- Protected Member Functions inherited from makVrv::DtSignalConnectionManager
 DtSignalConnectionManager ()
 CTOR.
virtual ~DtSignalConnectionManager ()
 DTOR.
void manageConnection (const boost::signalslib::connection &conn)
 Connect a signal.
DtSignalConnectionManageroperator+= (const boost::signalslib::connection &conn)
 Connect a signal.
int numberOfConnections () const
 Get the number of connections.
void disconnectSignals ()
 Disconnect all signals.
bool blockConnections (bool blocked)
 Blocks/unblocks connections.
bool blockConnection (int index, bool blocked)
 Blocks/unblocks connections.
bool connectionsBlocked () const
 check whether connections are blocked.
bool connectionBlocked (int index) const
 check whether connections are blocked.

Detailed Description

Implementation of a buoyancy model using RK4 integration.

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

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)

const double makVrv::DtRk4MotionModel::theGeocentricWaterLineNudge
static

adjustment for geocentric terrains for all buoyant objects.

DtCoordinateConverter* makVrv::DtRk4MotionModel::myCoordinateConverter
private
AppliedForce makVrv::DtRk4MotionModel::myAppliedForce
private
Dt3DLineModelInstanceSegment* makVrv::DtRk4MotionModel::myDebugLine[8]
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
bool makVrv::DtRk4MotionModel::mySinkingFloat[6]
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 Thu Mar 23 18:54:12 EDT 2017 from SVN revision 174804
Copyright © 2005-2017 VT MÄK. All Rights Reserved (www.mak.com)