/Hammy/src/dynamics/Derivative.as
https://bitbucket.org/peterm/hammy-as3 · ActionScript · 32 lines · 22 code · 6 blank · 4 comment · 0 complexity · 85cecbc34ef8ec9baef00e17981a5221 MD5 · raw file
- package dynamics
- {
- import math.Vec2;
-
- /**
- * ...
- * @author Peter Mackay
- */
- internal final class Derivative
- {
-
- internal var velocity:Vec2;
- internal var acceleration:Vec2;
-
- public function Derivative(velocity:Vec2, acceleration:Vec2)
- {
- this.velocity = velocity;
- this.acceleration = acceleration;
- }
-
- public function add(other:Derivative):Derivative
- {
- return new Derivative(velocity.add(other.velocity), acceleration.add(other.acceleration));
- }
-
- public function mul(dt:Number):Derivative
- {
- return new Derivative(velocity.mul(dt), acceleration.mul(dt));
- }
- }
-
- }