summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/rectangles/models/vec2.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/assets/javascripts/rectangles/models/vec2.js')
-rw-r--r--public/assets/javascripts/rectangles/models/vec2.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/public/assets/javascripts/rectangles/models/vec2.js b/public/assets/javascripts/rectangles/models/vec2.js
index 214feb9..0040435 100644
--- a/public/assets/javascripts/rectangles/models/vec2.js
+++ b/public/assets/javascripts/rectangles/models/vec2.js
@@ -20,6 +20,7 @@
vec2.prototype.assign = function(v){
this.a = v.a
this.b = v.b
+ return this
}
vec2.prototype.abs = function(){
if (this.b < this.a) {
@@ -123,12 +124,12 @@
}
vec2.prototype.union = function(v){
if (this.intersects(v)) {
- return new vec2( min(this.a,v.a), max(this.b, v.b) )
+ return new vec2( Math.min(this.a,v.a), Math.max(this.b, v.b) )
}
}
vec2.prototype.intersection = function(v){
if (this.intersects(v)) {
- return new vec2( max(this.a,v.a), min(this.b, v.b) )
+ return new vec2( Math.max(this.a,v.a), Math.min(this.b, v.b) )
}
}