API Docs for: 0.6.1
Show:

File: src/solver/Solver.js

module.exports = Solver;
/**
 * Constraint equation solver base class.
 * @class Solver
 * @constructor
 * @author schteppe / https://github.com/schteppe
 */
function Solver(){
 /**
 * All equations to be solved
 * @property {Array} equations
 */
 this.equations = [];
}
/**
 * Should be implemented in subclasses!
 * @method solve
 * @param {Number} dt
 * @param {World} world
 */
Solver.prototype.solve = function(dt,world){
 // Should return the number of iterations done!
 return 0;
};
/**
 * Add an equation
 * @method addEquation
 * @param {Equation} eq
 */
Solver.prototype.addEquation = function(eq){
 if (eq.enabled) {
 this.equations.push(eq);
 }
};
/**
 * Remove an equation
 * @method removeEquation
 * @param {Equation} eq
 */
Solver.prototype.removeEquation = function(eq){
 var eqs = this.equations;
 var i = eqs.indexOf(eq);
 if(i !== -1){
 eqs.splice(i,1);
 }
};
/**
 * Add all equations
 * @method removeAllEquations
 */
Solver.prototype.removeAllEquations = function(){
 this.equations.length = 0;
};
 

AltStyle によって変換されたページ (->オリジナル) /