summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/rectangles/models/vec2.js
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2014-08-13 17:56:31 -0400
committerJules Laplace <jules@okfoc.us>2014-08-13 17:56:31 -0400
commitc4c45b64c2c0fc109f4c21effe7f73f5c46a1ae9 (patch)
treef6e5e703af41a53fe3a9daa3de23e671a1c6ab74 /public/assets/javascripts/rectangles/models/vec2.js
parent466ccfdccd2d761f31ba78a74a40544b77b358e5 (diff)
parentb7b881a00a9b73ba54cc3a62edc402a903ec9142 (diff)
merge
Diffstat (limited to 'public/assets/javascripts/rectangles/models/vec2.js')
-rw-r--r--public/assets/javascripts/rectangles/models/vec2.js7
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