Packageorg.generalrelativity.foam.dynamics.element.particle
Classpublic class SimpleParticle
ImplementsIODE, ISimulatable
SubclassesRigidBody



Public Properties
 PropertyDefined by
  collisionTypeID : String
[read-only]
SimpleParticle
  elasticity : Number
SimpleParticle
  force : Vector
[read-only]
SimpleParticle
  friction : Number
SimpleParticle
  inverseMass : Number
[read-only]
SimpleParticle
  mass : Number
SimpleParticle
  position : Vector
[read-only]
SimpleParticle
  state : Array
[read-only] Gets the state of the differential equation

Consider a particle with position x and velocity v.

SimpleParticle
  velocity : Vector
[read-only]
SimpleParticle
  vx : Number
SimpleParticle
  vy : Number
SimpleParticle
  x : Number
Note that these values that constitute this IODE's state use getters/setters that access specific indices within _state.
SimpleParticle
  y : Number
SimpleParticle
Protected Properties
 PropertyDefined by
  _elasticity : Number
elastic coefficient of particle (used in collision response)
SimpleParticle
  _force : Vector
holds all accummulate forces
SimpleParticle
  _friction : Number
frictional coefficient (used in collision response)
SimpleParticle
  _generators : Array
holds all IForceGenerators affecting this particle
SimpleParticle
  _inverseMass : Number
holds the inverse mass- this is an optimization as multiplication is faster than division and we can calculate this offline
SimpleParticle
  _mass : Number
holds the mass of the particle
SimpleParticle
  _state : Array
holds the state of the system
SimpleParticle
Public Methods
 MethodDefined by
  
SimpleParticle(x:Number, y:Number, vx:Number = 0, vy:Number = 0, mass:Number = 100, friction:Number = 0.2, elasticity:Number = 0.25, stateLength:uint = 4)
Creates a new SimpleParticle
SimpleParticle
  
Accumulates forces
SimpleParticle
  
addForce(force:Vector):void
Adds a force to the particle
SimpleParticle
  
Adds a force generator to influence this particle
SimpleParticle
  
clearForces():void
Clears all forces
SimpleParticle
  
getDerivative(state:Array, derivative:Array):void
Gets the element's derivative

This is called by this equation's IODESolver.

SimpleParticle
  
Removes a force generator
SimpleParticle
Property detail
collisionTypeIDproperty
collisionTypeID:String  [read-only]Implementation
    public function get collisionTypeID():String
_elasticityproperty 
protected var _elasticity:Number

elastic coefficient of particle (used in collision response)

elasticityproperty 
elasticity:Number  [read-write]Implementation
    public function get elasticity():Number
    public function set elasticity(value:Number):void
_forceproperty 
protected var _force:Vector

holds all accummulate forces

forceproperty 
force:Vector  [read-only]Implementation
    public function get force():Vector
_frictionproperty 
protected var _friction:Number

frictional coefficient (used in collision response)

frictionproperty 
friction:Number  [read-write]Implementation
    public function get friction():Number
    public function set friction(value:Number):void
_generatorsproperty 
protected var _generators:Array

holds all IForceGenerators affecting this particle

_inverseMassproperty 
protected var _inverseMass:Number

holds the inverse mass- this is an optimization as multiplication is faster than division and we can calculate this offline

inverseMassproperty 
inverseMass:Number  [read-only]Implementation
    public function get inverseMass():Number
_massproperty 
protected var _mass:Number

holds the mass of the particle

massproperty 
mass:Number  [read-write]Implementation
    public function get mass():Number
    public function set mass(value:Number):void
positionproperty 
position:Vector  [read-only]Implementation
    public function get position():Vector
_stateproperty 
protected var _state:Array

holds the state of the system

stateproperty 
state:Array  [read-only]

Gets the state of the differential equation

Consider a particle with position x and velocity v. We want to integrate this state with respect to time. The position and velocity are pushed into the particle's state Array and solved by an IODESolver. By abstracting the process this far, we make it easy to swap solvers for different tasks.

Implementation
    public function get state():Array

See also

getDerivative
IODESolver
velocityproperty 
velocity:Vector  [read-only]Implementation
    public function get velocity():Vector
vxproperty 
vx:Number  [read-write]Implementation
    public function get vx():Number
    public function set vx(value:Number):void
vyproperty 
vy:Number  [read-write]Implementation
    public function get vy():Number
    public function set vy(value:Number):void
xproperty 
x:Number  [read-write]

Note that these values that constitute this IODE's state use getters/setters that access specific indices within _state. Everything is modified through this state Array

Implementation
    public function get x():Number
    public function set x(value:Number):void

See also

IODE
ISimulatable
yproperty 
y:Number  [read-write]Implementation
    public function get y():Number
    public function set y(value:Number):void
Constructor detail
SimpleParticle()constructor
public function SimpleParticle(x:Number, y:Number, vx:Number = 0, vy:Number = 0, mass:Number = 100, friction:Number = 0.2, elasticity:Number = 0.25, stateLength:uint = 4)

Creates a new SimpleParticle

Parameters
x:Number — horizontal position of particle
 
y:Number — vertical position of particle
 
vx:Number (default = 0) — horizontal starting velocity of particle
 
vy:Number (default = 0) — vertical starting velocity of particle
 
mass:Number (default = 100) — mass of element
 
friction:Number (default = 0.2) — frictional coefficient (0 - 1.0)
 
elasticity:Number (default = 0.25) — elastic coefficient (0 - 1.0)
 
stateLength:uint (default = 4) — defines the length of this IODE's state
Method detail
accumulateForces()method
public function accumulateForces():void

Accumulates forces

See also

IForceGenerator.generate
addForce()method 
public function addForce(force:Vector):void

Adds a force to the particle

Parameters
force:Vector — force to add
addForceGenerator()method 
public function addForceGenerator(generator:IForceGenerator):void

Adds a force generator to influence this particle

Parameters
generator:IForceGenerator — IForceGenerator to add

See also

IForceGenerator
removeForceGenerator
clearForces()method 
public function clearForces():void

Clears all forces

getDerivative()method 
public function getDerivative(state:Array, derivative:Array):void

Gets the element's derivative

This is called by this equation's IODESolver. First, the state is updated. Then, all forces are accumulated based on this state (this is important- without this, higher-order differential equation solvers have no worth). Next, the derivative is populated. Finally all forces are cleared.

Parameters
state:Array — state needed to define derivative
 
derivative:Array — derivative at given state

See also

state
IODESolver.step
removeForceGenerator()method 
public function removeForceGenerator(generator:IForceGenerator):void

Removes a force generator

Parameters
generator:IForceGenerator — IForceGenerator to remove

See also

IForceGenerator
addForceGenerator