summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/rectangles/models/rect.js
diff options
context:
space:
mode:
authorJulie Lala <jules@okfoc.us>2014-06-20 01:40:43 -0400
committerJulie Lala <jules@okfoc.us>2014-06-20 01:40:43 -0400
commit1a1009d5cbfb1deb7cc110bacf3fd76236cf25a9 (patch)
tree5ee025477a0ccc54e2ec11c71bdac47d2092ad1e /public/assets/javascripts/rectangles/models/rect.js
parentbefeb2ed9b7f7086ec0861cbfe4ab6450e1987af (diff)
resize based on magnitude..
Diffstat (limited to 'public/assets/javascripts/rectangles/models/rect.js')
-rw-r--r--public/assets/javascripts/rectangles/models/rect.js3
1 files changed, 3 insertions, 0 deletions
diff --git a/public/assets/javascripts/rectangles/models/rect.js b/public/assets/javascripts/rectangles/models/rect.js
index cb14e66..0bab0e4 100644
--- a/public/assets/javascripts/rectangles/models/rect.js
+++ b/public/assets/javascripts/rectangles/models/rect.js
@@ -25,6 +25,9 @@ window.Rect = (function(){
Rect.prototype.area = function(){
return this.x.length() * this.y.length()
}
+ Rect.prototype.magnitude = function(){
+ return dist(this.x.a, this.y.a, this.x.b, this.y.b)
+ }
Rect.prototype.mul = function(n){
this.x.mul(n)