summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/rectangles/models
diff options
context:
space:
mode:
authorJulie Lala <jules@okfoc.us>2014-08-11 00:10:24 -0400
committerJulie Lala <jules@okfoc.us>2014-08-11 00:10:24 -0400
commit02bde51c24ae1c6e189d031b80226e6a9f7cbc59 (patch)
treea64f5a040787b0b513c20ab8582aea171184736e /public/assets/javascripts/rectangles/models
parent04c2c21ad2ed872137b7a7e633d6bebcd7b04b61 (diff)
parent9cd88d59e45b530e483490804503e6b47030fd4d (diff)
merge master
Diffstat (limited to 'public/assets/javascripts/rectangles/models')
-rw-r--r--public/assets/javascripts/rectangles/models/rect.js4
-rw-r--r--public/assets/javascripts/rectangles/models/vec2.js3
2 files changed, 7 insertions, 0 deletions
diff --git a/public/assets/javascripts/rectangles/models/rect.js b/public/assets/javascripts/rectangles/models/rect.js
index 500ee6d..ec32ab7 100644
--- a/public/assets/javascripts/rectangles/models/rect.js
+++ b/public/assets/javascripts/rectangles/models/rect.js
@@ -110,6 +110,10 @@
Rect.prototype.fits = function(v){
return this.x.length() >= v.a && this.y.length() >= v.b
}
+ Rect.prototype.zero = function(){
+ this.a.zero()
+ this.b.zero()
+ }
Rect.prototype.nearEdge = function (x, y, r) {
var edges = 0
if (x < this.x.a+r) {
diff --git a/public/assets/javascripts/rectangles/models/vec2.js b/public/assets/javascripts/rectangles/models/vec2.js
index 2bf286b..104c6f7 100644
--- a/public/assets/javascripts/rectangles/models/vec2.js
+++ b/public/assets/javascripts/rectangles/models/vec2.js
@@ -55,6 +55,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