• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdeedu
  • Sitemap
  • Contact Us
 

step/stepcore

StepCore::RigidBody

StepCore::RigidBody Class Reference
[Physical bodies]

#include <rigidbody.h>

Inheritance diagram for StepCore::RigidBody:

Inheritance graph
[legend]

List of all members.


Detailed Description

Rigid body.

Definition at line 144 of file rigidbody.h.


Public Types

enum  { PositionOffset = 0, AngleOffset = 2 }

Public Member Functions

Vector2d acceleration () const
void addForce (const double *force, const double *forceVariance)
double angle () const
double angularAcceleration () const
double angularMomentum () const
double angularVelocity () const
void applyForce (const Vector2d &force, const Vector2d &position)
void applyTorque (double torque)
const Vector2d & force () const
void getAccelerations (double *acceleration, double *accelerationVariance)
void getInverseMass (GmmSparseRowMatrix *inverseMass, GmmSparseRowMatrix *variance, int offset)
void getVariables (double *position, double *velocity, double *positionVariance, double *velocityVariance)
double inertia () const
double kineticEnergy () const
double mass () const
Vector2d momentum () const
Vector2d pointLocalToWorld (const Vector2d &p) const
Vector2d pointWorldToLocal (const Vector2d &p) const
const Vector2d & position () const
void resetForce (bool resetVariance)
 RigidBody (Vector2d position=Vector2d(0), double angle=0, Vector2d velocity=Vector2d(0), double angularVelocity=0, double mass=1, double inertia=1)
RigidBodyErrors * rigidBodyErrors ()
void setAngle (double angle)
void setAngularMomentum (double angularMomentum)
void setAngularVelocity (double angularVelocity)
void setForce (const Vector2d &force)
void setInertia (double inertia)
void setKineticEnergy (double kineticEnergy)
void setMass (double mass)
void setMomentum (const Vector2d &momentum)
void setPosition (const Vector2d &position)
void setTorque (double torque)
void setVariables (const double *position, const double *velocity, const double *positionVariance, const double *velocityVariance)
void setVelocity (const Vector2d &velocity)
double torque () const
int variablesCount ()
Vector2d vectorLocalToWorld (const Vector2d &v) const
Vector2d vectorWorldToLocal (const Vector2d &v) const
const Vector2d & velocity () const
Vector2d velocityLocal (const Vector2d &localPoint) const
Vector2d velocityWorld (const Vector2d &worldPoint) const

Protected Member Functions

ObjectErrors * createObjectErrors ()

Protected Attributes

double _angle
double _angularVelocity
Vector2d _force
double _inertia
double _mass
Vector2d _position
double _torque
Vector2d _velocity

Member Enumeration Documentation

anonymous enum

Enumerator:
PositionOffset  Offset of body position in variables array.
AngleOffset  Offset of body angle in variables array.

Definition at line 149 of file rigidbody.h.


Constructor & Destructor Documentation

StepCore::RigidBody::RigidBody ( Vector2d  position = Vector2d(0),
double  angle = 0,
Vector2d  velocity = Vector2d(0),
double  angularVelocity = 0,
double  mass = 1,
double  inertia = 1 
) [explicit]

Constructs RigidBody.

Definition at line 163 of file rigidbody.cc.


Member Function Documentation

Vector2d StepCore::RigidBody::acceleration (  )  const [inline]

Get acceleration of the center of mass of the body.

Definition at line 184 of file rigidbody.h.

void StepCore::RigidBody::addForce ( const double *  force,
const double *  forceVariance 
) [virtual]

Add force and (possibly) its variance to force accomulator.

Note:
This function is used only by generic constraints handling code, force objects should use body-specific functions.

Implements StepCore::Body.

Definition at line 289 of file rigidbody.cc.

double StepCore::RigidBody::angle (  )  const [inline]

Get angle of the body.

Definition at line 165 of file rigidbody.h.

double StepCore::RigidBody::angularAcceleration (  )  const [inline]

Get angular acceleration of the body.

Definition at line 187 of file rigidbody.h.

double StepCore::RigidBody::angularMomentum (  )  const [inline]

Get angular momentum of the body.

Definition at line 223 of file rigidbody.h.

double StepCore::RigidBody::angularVelocity (  )  const [inline]

Get angular velocity of the body.

Definition at line 179 of file rigidbody.h.

void StepCore::RigidBody::applyForce ( const Vector2d &  force,
const Vector2d &  position 
)

Apply force (and torque) to the body at given position (in World coordinates).

Definition at line 170 of file rigidbody.cc.

void StepCore::RigidBody::applyTorque ( double  torque  )  [inline]

Apply torque (but no force) to the body.

Definition at line 205 of file rigidbody.h.

ObjectErrors* StepCore::RigidBody::createObjectErrors (  )  [inline, protected, virtual]

For internal use only.

Creates specific ObjectErrors-derived class (to be reimplemented in derived classes)

Reimplemented from StepCore::Item.

Definition at line 266 of file rigidbody.h.

const Vector2d& StepCore::RigidBody::force (  )  const [inline]

Get force that acts upon the body.

Definition at line 190 of file rigidbody.h.

void StepCore::RigidBody::getAccelerations ( double *  acceleration,
double *  accelerationVariance 
) [virtual]

Copy acceleration (forces left-multiplied by inverse mass) and (possibly) its variances to arrays.

Variances should only be copied if accelerationVariance != NULL.

Implements StepCore::Body.

Definition at line 273 of file rigidbody.cc.

void StepCore::RigidBody::getInverseMass ( GmmSparseRowMatrix *  inverseMass,
GmmSparseRowMatrix *  variance,
int  offset 
) [virtual]

Get inverse mass and (possibly) its variance matrixes.

Variance should only be copied of variance != NULL.

Implements StepCore::Body.

Definition at line 313 of file rigidbody.cc.

void StepCore::RigidBody::getVariables ( double *  position,
double *  velocity,
double *  positionVariance,
double *  velocityVariance 
) [virtual]

Copy positions, velocities and (possibly) its variances to arrays.

Variances should only be copied if positionVariance != NULL.

Implements StepCore::Body.

Definition at line 233 of file rigidbody.cc.

double StepCore::RigidBody::inertia (  )  const [inline]

Get inertia "tensor" of the body.

Definition at line 213 of file rigidbody.h.

double StepCore::RigidBody::kineticEnergy (  )  const [inline]

Get kinetic energy of the body.

Definition at line 229 of file rigidbody.h.

double StepCore::RigidBody::mass (  )  const [inline]

Get mass of the body.

Definition at line 208 of file rigidbody.h.

Vector2d StepCore::RigidBody::momentum (  )  const [inline]

Get momentum of the body.

Definition at line 218 of file rigidbody.h.

Vector2d StepCore::RigidBody::pointLocalToWorld ( const Vector2d &  p  )  const

Translate local coordinates on body to world coordinates.

Definition at line 201 of file rigidbody.cc.

Vector2d StepCore::RigidBody::pointWorldToLocal ( const Vector2d &  p  )  const

Translate world coordinates to local coordinates on body.

Definition at line 209 of file rigidbody.cc.

const Vector2d& StepCore::RigidBody::position (  )  const [inline]

Get position of the center of mass of the body.

Definition at line 160 of file rigidbody.h.

void StepCore::RigidBody::resetForce ( bool  resetVariance  )  [virtual]

Reset force accomulator and (possibly) its variance to zero.

Variance should only be reseted if resetVariance == true.

Implements StepCore::Body.

Definition at line 302 of file rigidbody.cc.

RigidBodyErrors* StepCore::RigidBody::rigidBodyErrors (  )  [inline]

Get (and possibly create) RigidBodyErrors object.

Definition at line 262 of file rigidbody.h.

void StepCore::RigidBody::setAngle ( double  angle  )  [inline]

Set angle of the body.

Definition at line 167 of file rigidbody.h.

void StepCore::RigidBody::setAngularMomentum ( double  angularMomentum  )  [inline]

Set angular momentum of the body (will modify only angularVelocity).

Definition at line 225 of file rigidbody.h.

void StepCore::RigidBody::setAngularVelocity ( double  angularVelocity  )  [inline]

Set angular velocity of the body.

Definition at line 181 of file rigidbody.h.

void StepCore::RigidBody::setForce ( const Vector2d &  force  )  [inline]

Set force that acts upon the body.

Definition at line 192 of file rigidbody.h.

void StepCore::RigidBody::setInertia ( double  inertia  )  [inline]

Set inertia "tensor" of the body.

Definition at line 215 of file rigidbody.h.

void StepCore::RigidBody::setKineticEnergy ( double  kineticEnergy  ) 

Set kinetic energy of the body (will modify only velocity and (possibly) angularVelocity).

Definition at line 329 of file rigidbody.cc.

void StepCore::RigidBody::setMass ( double  mass  )  [inline]

Set mass of the body.

Definition at line 210 of file rigidbody.h.

void StepCore::RigidBody::setMomentum ( const Vector2d &  momentum  )  [inline]

Set momentum of the body (will modify only velocity).

Definition at line 220 of file rigidbody.h.

void StepCore::RigidBody::setPosition ( const Vector2d &  position  )  [inline]

Set position of the center of mass of the body.

Definition at line 162 of file rigidbody.h.

void StepCore::RigidBody::setTorque ( double  torque  )  [inline]

Set torque that acts upon the body.

Definition at line 197 of file rigidbody.h.

void StepCore::RigidBody::setVariables ( const double *  position,
const double *  velocity,
const double *  positionVariance,
const double *  velocityVariance 
) [virtual]

Set positions, velocities and (possibly) its variances using values in arrays and also reset accelerations and its variances.

Variances should only be copied and reseted if positionVariance != NULL.

Implements StepCore::Body.

Definition at line 250 of file rigidbody.cc.

void StepCore::RigidBody::setVelocity ( const Vector2d &  velocity  )  [inline]

Set velocity of the particle.

Definition at line 172 of file rigidbody.h.

double StepCore::RigidBody::torque (  )  const [inline]

Get torque that acts upon the body.

Definition at line 195 of file rigidbody.h.

int StepCore::RigidBody::variablesCount (  )  [inline, virtual]

Get count of dynamic variables (not including velocities).

Implements StepCore::Body.

Definition at line 250 of file rigidbody.h.

Vector2d StepCore::RigidBody::vectorLocalToWorld ( const Vector2d &  v  )  const

Translate local vector on body to world vector.

Definition at line 217 of file rigidbody.cc.

Vector2d StepCore::RigidBody::vectorWorldToLocal ( const Vector2d &  v  )  const

Translate world vector to local vector on body.

Definition at line 225 of file rigidbody.cc.

const Vector2d& StepCore::RigidBody::velocity (  )  const [inline]

Get velocity of the center of mass of the body.

Definition at line 170 of file rigidbody.h.

Vector2d StepCore::RigidBody::velocityLocal ( const Vector2d &  localPoint  )  const

Get velocity of given (local) point on the body.

Definition at line 195 of file rigidbody.cc.

Vector2d StepCore::RigidBody::velocityWorld ( const Vector2d &  worldPoint  )  const

Get velocity of given (world) point on the body.

Definition at line 189 of file rigidbody.cc.


Member Data Documentation

double StepCore::RigidBody::_angle [protected]

Definition at line 269 of file rigidbody.h.

double StepCore::RigidBody::_angularVelocity [protected]

Definition at line 272 of file rigidbody.h.

Vector2d StepCore::RigidBody::_force [protected]

Definition at line 274 of file rigidbody.h.

double StepCore::RigidBody::_inertia [protected]

Definition at line 278 of file rigidbody.h.

double StepCore::RigidBody::_mass [protected]

Definition at line 277 of file rigidbody.h.

Vector2d StepCore::RigidBody::_position [protected]

Definition at line 268 of file rigidbody.h.

double StepCore::RigidBody::_torque [protected]

Definition at line 275 of file rigidbody.h.

Vector2d StepCore::RigidBody::_velocity [protected]

Definition at line 271 of file rigidbody.h.


The documentation for this class was generated from the following files:
  • rigidbody.h
  • rigidbody.cc

step/stepcore

Skip menu "step/stepcore"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdeedu

Skip menu "kdeedu"
  • kalzium
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  •   docs
  •   src
  • parley
  •   stepcore
Generated for kdeedu by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal