step/stepcore
StepCore::RigidBody Class Reference
[Physical bodies]
#include <rigidbody.h>

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
Member Function Documentation
| Vector2d StepCore::RigidBody::acceleration | ( | ) | const [inline] |
| 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] |
| double StepCore::RigidBody::angularAcceleration | ( | ) | const [inline] |
| double StepCore::RigidBody::angularMomentum | ( | ) | const [inline] |
| double StepCore::RigidBody::angularVelocity | ( | ) | const [inline] |
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] |
| 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] |
| 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] |
| double StepCore::RigidBody::kineticEnergy | ( | ) | const [inline] |
| double StepCore::RigidBody::mass | ( | ) | const [inline] |
| Vector2d StepCore::RigidBody::momentum | ( | ) | const [inline] |
Translate local coordinates on body to world coordinates.
Definition at line 201 of file rigidbody.cc.
Translate world coordinates to local coordinates on body.
Definition at line 209 of file rigidbody.cc.
| const Vector2d& StepCore::RigidBody::position | ( | ) | const [inline] |
| 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] |
| void StepCore::RigidBody::setAngle | ( | double | angle | ) | [inline] |
| 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] |
| void StepCore::RigidBody::setForce | ( | const Vector2d & | force | ) | [inline] |
| void StepCore::RigidBody::setInertia | ( | double | inertia | ) | [inline] |
| 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] |
| void StepCore::RigidBody::setMomentum | ( | const Vector2d & | momentum | ) | [inline] |
| void StepCore::RigidBody::setPosition | ( | const Vector2d & | position | ) | [inline] |
| void StepCore::RigidBody::setTorque | ( | double | torque | ) | [inline] |
| 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] |
| double StepCore::RigidBody::torque | ( | ) | const [inline] |
| 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.
| const Vector2d& StepCore::RigidBody::velocity | ( | ) | const [inline] |
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:
KDE 4.2 API Reference