version 3.3

VRS::PhysicalModel Class Reference

The physical model is used by NavigationConcept to smoothen camera movement by applying a mass-spring camera model. More...

#include <vrs/sg/physicalmodel.h>

Inheritance diagram for VRS::PhysicalModel:

VRS::SharedObj VRS::Visitable

List of all members.

Public Member Functions

 PhysicalModel (const Vector &startPos)
 Constructs a physical model and initializes it with the given start position.
void setViscosity (double viscosity=.5)
 PhysicalNavigation also takes a viscous liquid into account, in which the camera is situated.
double getViscosity () const
 PhysicalNavigation also takes a viscous liquid into account, in which the camera is situated.
void setSpringStrength (double strength=50.0)
 Defines the strength of the spring force. 'strength' must be positive.
double getSpringStrength () const
 Returns the strength of the spring force.
double getMeterDefinition () const
 The physical model works in an own coordination system.
void setMeterDefinition (double factor=1.0)
 The physical model works in an own coordination system.
void initializeModel (const Vector &startPos)
 Restarts the model at a given position.
void setNewTargetPosition (const Vector &targetPosition)
 Changes the position of the target position, which is permanently chased by the camera.
void brake ()
 brake() is called when the camera shall stop as fast as possible.
Vector getCameraPosition () const
 Returns the current camera position.
Vector getCameraVelocity () const
 Returns the current camera velocity.
Vector getCameraAcceleration () const
 Returns the current camera acceleration.
*Vector getTargetPosition () const
 Returns the current target position.
void onTimer (double elapsedTime)
 Updates the current camera position/velocity/accelerations.
 VRS_TYPEINFO (PhysicalModel, SharedObj)
 VRS_SERIALIZABLE (PhysicalModel)


Detailed Description

The physical model is used by NavigationConcept to smoothen camera movement by applying a mass-spring camera model.


Constructor & Destructor Documentation

VRS::PhysicalModel::PhysicalModel ( const Vector startPos  ) 

Constructs a physical model and initializes it with the given start position.


Member Function Documentation

void VRS::PhysicalModel::setViscosity ( double  viscosity = .5  ) 

PhysicalNavigation also takes a viscous liquid into account, in which the camera is situated.

This extension is made to prevent the camera oscillating around the target. In a viscous liquid (e.g. honey) the moving camera experiences friction. The camera looses energy while moving. That's why it won't oscillate infinitely around the target, but will swing into the target position. With high values of viscosity the camera won't even do a single oscillation but will move slowly and directly into the target position. 'viscosity' must be >= 0.

double VRS::PhysicalModel::getViscosity (  )  const

PhysicalNavigation also takes a viscous liquid into account, in which the camera is situated.

This extension is made to prevent the camera oscillating around the target. In a viscous liquid (e.g. honey) the moving camera experiences friction. The camera looses energy while moving. That's why it won't oscillate infinitely around the target, but will swing into the target position. With high values of viscosity the camera won't even do a single oscillation but will move slowly and directly into the target position.

void VRS::PhysicalModel::setSpringStrength ( double  strength = 50.0  ) 

Defines the strength of the spring force. 'strength' must be positive.

double VRS::PhysicalModel::getSpringStrength (  )  const

Returns the strength of the spring force.

double VRS::PhysicalModel::getMeterDefinition (  )  const

The physical model works in an own coordination system.

So position, velocity and accelleration of the camera and also the target position are described in the physical coordination system. To convert values described in physical coordinations to world coordination, the meter definition is used. Important: Use the meter definition to adapt the physical model to the scene geometry. Be aware of an abnormal high speed of the camera.

void VRS::PhysicalModel::setMeterDefinition ( double  factor = 1.0  ) 

The physical model works in an own coordination system.

So position, velocity and accelleration of the camera and also the target position are described in the physical coordination system. To convert values described in physical coordinations to world coordination, the meter definition is used. Important: Use the meter definition to adapt the physical model to the scene geometry. Be aware of an abnormal high speed of the camera. 'factor' must be positive.

void VRS::PhysicalModel::initializeModel ( const Vector startPos  ) 

Restarts the model at a given position.

At start, target position and camera position are equal and velocity and acceleration are 0.

void VRS::PhysicalModel::setNewTargetPosition ( const Vector targetPosition  ) 

Changes the position of the target position, which is permanently chased by the camera.

void VRS::PhysicalModel::brake (  ) 

brake() is called when the camera shall stop as fast as possible.

For this the viscosity is temporarily increased by a large value and the target point is internally moved more close to the current camera position. Note: After a brake() call the subsequent onTimer() call will change the target position, all other calls of onTimer() will leave it unchaged.

Vector VRS::PhysicalModel::getCameraPosition (  )  const

Returns the current camera position.

Vector VRS::PhysicalModel::getCameraVelocity (  )  const

Returns the current camera velocity.

Vector VRS::PhysicalModel::getCameraAcceleration (  )  const

Returns the current camera acceleration.

* Vector VRS::PhysicalModel::getTargetPosition (  )  const

Returns the current target position.

Mostly the result is the value that has been set in the last setNewTargetPosition() call, or the start position, if the target position has not been changed yet. However after a brake() call and the subsequent onTimer() call, the target position is changed internally by the model.

void VRS::PhysicalModel::onTimer ( double  elapsedTime  ) 

Updates the current camera position/velocity/accelerations.

When brake() has been called before, the target position is also changed.

VRS::PhysicalModel::VRS_TYPEINFO ( PhysicalModel  ,
SharedObj   
)

VRS::PhysicalModel::VRS_SERIALIZABLE ( PhysicalModel   ) 


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

Generated on Tue May 22 06:00:29 2012 by Doxygen 1.5.6
© 2001-2010 Hasso-Plattner-Institut | Impressum | Contact