From 1a1009d5cbfb1deb7cc110bacf3fd76236cf25a9 Mon Sep 17 00:00:00 2001 From: Julie Lala Date: Fri, 20 Jun 2014 01:40:43 -0400 Subject: resize based on magnitude.. --- public/assets/javascripts/rectangles/models/rect.js | 3 +++ 1 file changed, 3 insertions(+) (limited to 'public/assets/javascripts/rectangles/models/rect.js') 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) -- cgit v1.2.3-70-g09d2