/**
* Physics
* A requirified port of Traer Physics from Processing to JavaScript.
* Copyright (C) 2012 jonobr1
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
(function(){common=function(){var f={},g=Array.prototype,b=Object.prototype,h=b.hasOwnProperty,e=g.slice,c=g.forEach,k=g.indexOf,a=b.toString,d=function(a,d,h){if(null!=a)if(c&&a.forEach===c)a.forEach(d,h);else if(a.length===+a.length)for(var b=0,e=a.length;b>1;c(a[e])this.distanceTo(b)},lerp:function(b,h){return this.set((b.x-this.x)*h+this.x,(b.y-this.y)*h+this.y)},isZero:function(){return 1E-4>this.length()}});return g}(common);this.Physics=Physics=function(f,g,b){function h(){g(h);for(var c=0;c
this.originalPositions.length;)this.originalPositions.push(new f),this.originalVelocities.push(new f),this.k1Forces.push(new f),this.k1Velocities.push(new f),this.k2Forces.push(new f),this.k2Velocities.push(new f),this.k3Forces.push(new f),this.k3Velocities.push(new f),this.k4Forces.push(new f),this.k4Velocities.push(new f);return this},step:function(b){var e=this.s,c,f,a,d,g,m,n,p;this.allocateParticles();for(d=0;d