GSSolver Class
Iterative GaussSeidel constraint equation solver.
Constructor
GSSolver

[options]
Parameters:

[options]
Object optional
[iterations=10]
Number optional 
[tolerance=0]
Number optional

Item Index
Methods
Methods
addEquations

eqs
Add equations. Same as .addEquation, but this time the argument is an array of Equations
Parameters:

eqs
Array
emit

event
Emit an event.
Parameters:

event
Object
type
String

Returns:
The self object, for chainability.
has

type

listener
Check if an event listener is added
Parameters:

type
String 
listener
Function
Returns:
off

type

listener
Remove an event listener
Parameters:

type
String 
listener
Function
Returns:
The self object, for chainability.
on

type

listener
Add an event listener
Parameters:

type
String 
listener
Function
Returns:
The self object, for chainability.
removeAllEquations
()
Remove all currently added equations.
solve

h

world
Solve the system of equations
Parameters:

h
NumberTime step

world
WorldWorld to solve
sortEquations
()
Sort all equations using the .equationSortFunction. Should be called by subclasses before solving.
Properties
equations
Array
Current equations in the solver.
equationSortFunction
Function  Boolean
Function that is used to sort all equations before each solve.
frictionIterations
Number
Number of solver iterations that are used to approximate normal forces used for friction (F_friction = mu * F_normal). These friction forces will override any other friction forces that are set. If you set frictionIterations = 0, then this feature will be disabled.
Use only frictionIterations > 0 if the approximated normal force (F_normal = mass * gravity) is not good enough. Examples of where it can happen is in space games where gravity is zero, or in tall stacks where the normal force is large at bottom but small at top.
Default: 0
iterations
Number
The max number of iterations to do when solving. More gives better results, but is more expensive.
tolerance
Number
The error tolerance, per constraint. If the total error is below this limit, the solver will stop iterating. Set to zero for as good solution as possible, but to something larger than zero to make computations faster.
Default: 1e7
usedIterations
Number
The number of iterations that were made during the last solve. If .tolerance is zero, this value will always be equal to .iterations, but if .tolerance is larger than zero, and the solver can quit early, then this number will be somewhere between 1 and .iterations.
useZeroRHS
Boolean
Set to true to set all right hand side terms to zero when solving. Can be handy for a few applications.