PageRenderTime 41ms CodeModel.GetById 27ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/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
 1package dynamics 
 2{
 3	import math.Vec2;
 4	
 5	/**
 6	 * ...
 7	 * @author Peter Mackay
 8	 */
 9	internal final class Derivative
10	{
11		
12		internal var velocity:Vec2;
13		internal var acceleration:Vec2;
14		
15		public function Derivative(velocity:Vec2, acceleration:Vec2) 
16		{
17			this.velocity = velocity;
18			this.acceleration = acceleration;
19		}
20		
21		public function add(other:Derivative):Derivative
22		{
23			return new Derivative(velocity.add(other.velocity), acceleration.add(other.acceleration));
24		}
25		
26		public function mul(dt:Number):Derivative
27		{
28			return new Derivative(velocity.mul(dt), acceleration.mul(dt));
29		}
30	}
31
32}