diff options
| author | Jules Laplace <jules@okfoc.us> | 2014-08-13 17:56:31 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2014-08-13 17:56:31 -0400 |
| commit | c4c45b64c2c0fc109f4c21effe7f73f5c46a1ae9 (patch) | |
| tree | f6e5e703af41a53fe3a9daa3de23e671a1c6ab74 /public/assets/javascripts/rectangles/models/vec2.js | |
| parent | 466ccfdccd2d761f31ba78a74a40544b77b358e5 (diff) | |
| parent | b7b881a00a9b73ba54cc3a62edc402a903ec9142 (diff) | |
merge
Diffstat (limited to 'public/assets/javascripts/rectangles/models/vec2.js')
| -rw-r--r-- | public/assets/javascripts/rectangles/models/vec2.js | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/public/assets/javascripts/rectangles/models/vec2.js b/public/assets/javascripts/rectangles/models/vec2.js index 2bf286b..214feb9 100644 --- a/public/assets/javascripts/rectangles/models/vec2.js +++ b/public/assets/javascripts/rectangles/models/vec2.js @@ -17,6 +17,10 @@ vec2.prototype.clone = function(){ return new vec2(this.a, this.b) } + vec2.prototype.assign = function(v){ + this.a = v.a + this.b = v.b + } vec2.prototype.abs = function(){ if (this.b < this.a) { this.invert() @@ -55,6 +59,9 @@ this.b /= n return this } + vec2.prototype.zero = function(){ + this.a = this.b = 0 + } vec2.prototype.setPosition = function(n){ var len = this.length() this.a = n |
