| Package | org.generalrelativity.foam.dynamics.element.particle |
| Class | public class SimpleParticle |
| Implements | IODE, ISimulatable |
| Subclasses | RigidBody |
| Property | Defined 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 | ||
| Property | Defined 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 | ||
| Method | Defined 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 | ||
|
accumulateForces():void
Accumulates forces
| SimpleParticle | ||
|
Adds a force to the particle
| SimpleParticle | ||
|
addForceGenerator(generator:IForceGenerator):void
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 | ||
|
removeForceGenerator(generator:IForceGenerator):void
Removes a force generator
| SimpleParticle | ||
| collisionTypeID | property |
collisionTypeID:String [read-only]Implementation
public function get collisionTypeID():String
| _elasticity | property |
protected var _elasticity:Numberelastic coefficient of particle (used in collision response)
| elasticity | property |
elasticity:Number [read-write]Implementation
public function get elasticity():Number
public function set elasticity(value:Number):void
| _force | property |
protected var _force:Vectorholds all accummulate forces
| force | property |
| _friction | property |
protected var _friction:Numberfrictional coefficient (used in collision response)
| friction | property |
friction:Number [read-write]Implementation
public function get friction():Number
public function set friction(value:Number):void
| _generators | property |
protected var _generators:Arrayholds all IForceGenerators affecting this particle
| _inverseMass | property |
protected var _inverseMass:Numberholds the inverse mass- this is an optimization as multiplication is faster than division and we can calculate this offline
| inverseMass | property |
inverseMass:Number [read-only]Implementation
public function get inverseMass():Number
| _mass | property |
protected var _mass:Numberholds the mass of the particle
| mass | property |
mass:Number [read-write]Implementation
public function get mass():Number
public function set mass(value:Number):void
| position | property |
| _state | property |
protected var _state:Arrayholds the state of the system
| state | property |
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
| velocity | property |
| vx | property |
vx:Number [read-write]Implementation
public function get vx():Number
public function set vx(value:Number):void
| vy | property |
vy:Number [read-write]Implementation
public function get vy():Number
public function set vy(value:Number):void
| x | property |
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
| y | property |
y:Number [read-write]Implementation
public function get y():Number
public function set y(value:Number):void
| 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
Parametersx: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
|
| accumulateForces | () | method |
public function accumulateForces():voidAccumulates forces
See also
| addForce | () | method |
public function addForce(force:Vector):voidAdds a force to the particle
Parametersforce:Vector — force to add
|
| addForceGenerator | () | method |
public function addForceGenerator(generator:IForceGenerator):voidAdds a force generator to influence this particle
Parametersgenerator:IForceGenerator — IForceGenerator to add
|
See also
| clearForces | () | method |
public function clearForces():voidClears all forces
| getDerivative | () | method |
public function getDerivative(state:Array, derivative:Array):voidGets 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.
Parametersstate:Array — state needed to define derivative
|
|
derivative:Array — derivative at given state
|
See also
| removeForceGenerator | () | method |
public function removeForceGenerator(generator:IForceGenerator):voidRemoves a force generator
Parametersgenerator:IForceGenerator — IForceGenerator to remove
|
See also