Cyclone | Cyclone: cyclone::Particle Class Reference |
#include <particle.h>
Collaboration diagram for cyclone::Particle:
Public Member Functions | |
Integration and Simulation Functions | |
These functions are used to simulate the particle's motion over time. A normal application sets up one or more rigid bodies, applies permanent forces (i.e. gravity), then adds transient forces each frame, and integrates, prior to rendering.
Currently the only integration function provided is the first order Newton Euler method. | |
void | integrate (real duration) |
Integrates the particle forward in time by the given amount.ParticleIntegrate. | |
Accessor Functions for the Particle's State | |
These functions provide access to the particle's characteristics or state. | |
void | setMass (const real mass) |
Sets the mass of the particle. | |
real | getMass () const |
Gets the mass of the particle. | |
void | setInverseMass (const real inverseMass) |
Sets the inverse mass of the particle. | |
real | getInverseMass () const |
Gets the inverse mass of the particle. | |
bool | hasFiniteMass () const |
Returns true if the mass of the particle is not-infinite. | |
void | setDamping (const real damping) |
Sets both the damping of the particle. | |
real | getDamping () const |
Gets the current damping value. | |
void | setPosition (const Vector3 &position) |
Sets the position of the particle. | |
void | setPosition (const real x, const real y, const real z) |
Sets the position of the particle by component. | |
void | getPosition (Vector3 *position) const |
Fills the given vector with the position of the particle. | |
Vector3 | getPosition () const |
Gets the position of the particle. | |
void | setVelocity (const Vector3 &velocity) |
Sets the velocity of the particle. | |
void | setVelocity (const real x, const real y, const real z) |
Sets the velocity of the particle by component. | |
void | getVelocity (Vector3 *velocity) const |
Fills the given vector with the velocity of the particle. | |
Vector3 | getVelocity () const |
Gets the velocity of the particle. | |
void | setAcceleration (const Vector3 &acceleration) |
Sets the constant acceleration of the particle. | |
void | setAcceleration (const real x, const real y, const real z) |
Sets the constant acceleration of the particle by component. | |
void | getAcceleration (Vector3 *acceleration) const |
Fills the given vector with the acceleration of the particle. | |
Vector3 | getAcceleration () const |
Gets the acceleration of the particle. | |
Force Set-up Functions | |
These functions set up forces to apply to the particle. | |
void | clearAccumulator () |
Clears the forces applied to the particle.ParticleAccum. | |
void | addForce (const Vector3 &force) |
Adds the given force to the particle, to be applied at the next iteration only.ParticleAddForce. | |
Protected Attributes | |
Characteristic Data and State | |
This data holds the state of the particle. There are two sets of data: characteristics and state. Characteristics are properties of the particle independent of its current kinematic situation. This includes mass, moment of inertia and damping properties. Two identical particles will have the same values for their characteristics. State includes all the characteristics and also includes the kinematic situation of the particle in the current simulation. By setting the whole state data, a particle's exact game state can be replicated. Note that state does not include any forces applied to the body. Two identical rigid bodies in the same simulation will not share the same state values. The state values make up the smallest set of independent data for the particle. Other state data is calculated from their current values. When state data is changed the dependent values need to be updated: this can be achieved either by integrating the simulation, or by calling the calculateInternals function. This two stage process is used because recalculating internals can be a costly process: all state changes should be carried out at the same time, allowing for a single call.
| |
real | inverseMass |
Holds the inverse of the mass of the particle.ParticleMass. | |
real | damping |
Holds the amount of damping applied to linear motion.ParticleDamping. | |
Vector3 | position |
Holds the linear position of the particle in world space. | |
Vector3 | velocity |
Holds the linear velocity of the particle in world space.ParticleIntro. | |
Force Accumulators | |
These data members store the current force and global linear acceleration of the particle. | |
Vector3 | forceAccum |
Holds the accumulated force to be applied at the next simulation iteration only.ParticleAccum >ParticleIntro. | |
Vector3 | acceleration |
Holds the acceleration of the particle.ParticleIntro. |
/<ParticleIntro
It has position data (no orientation data), along with velocity. It can be integrated forward through time, and have linear forces, and impulses applied to it. The particle manages its state and allows access through a set of methods. />ParticleIntro
|
Adds the given force to the particle, to be applied at the next iteration only.ParticleAddForce.
|
|
Clears the forces applied to the particle.ParticleAccum. This will be called automatically after each integration step. |
|
Gets the acceleration of the particle.
|
|
Fills the given vector with the acceleration of the particle.
|
|
Gets the current damping value.
|
|
Gets the inverse mass of the particle.
|
|
Gets the mass of the particle.
|
|
Gets the position of the particle.
|
|
Fills the given vector with the position of the particle.
|
|
Gets the velocity of the particle.
|
|
Fills the given vector with the velocity of the particle.
|
|
Returns true if the mass of the particle is not-infinite.
|
|
Integrates the particle forward in time by the given amount.ParticleIntegrate. This function uses a Newton-Euler integration method, which is a linear approximation to the correct integral. For this reason it may be inaccurate in some cases. |
|
Sets the constant acceleration of the particle by component.
|
|
Sets the constant acceleration of the particle.
|
|
Sets both the damping of the particle.
|
|
Sets the inverse mass of the particle.
|
|
Sets the mass of the particle.
|
|
Sets the position of the particle by component.
|
|
Sets the position of the particle.
|
|
Sets the velocity of the particle by component.
|
|
Sets the velocity of the particle.
|
|
Holds the acceleration of the particle.ParticleIntro. This value can be used to set acceleration due to gravity (its primary use), or any other constant acceleration. |
|
Holds the amount of damping applied to linear motion.ParticleDamping. Damping is required to remove energy added through numerical instability in the integrator. |
|
Holds the accumulated force to be applied at the next simulation iteration only.ParticleAccum >ParticleIntro. This value is zeroed at each integration step. |
|
Holds the inverse of the mass of the particle.ParticleMass. It is more useful to hold the inverse mass because integration is simpler, and because in real time simulation it is more useful to have objects with infinite mass (immovable) than zero mass (completely unstable in numerical simulation). |
|
Holds the linear position of the particle in world space.
|
|
Holds the linear velocity of the particle in world space.ParticleIntro.
|
© 2000-2003 Icosagon. All Rights Reserved.
Distributed under licence.
Cyclone Version 2.0.5 (Documentation generated Fri Nov 10 20:44:24 2006). |