diff options
Diffstat (limited to 'assets/javascripts/rectangles/models/rect.js')
| -rw-r--r-- | assets/javascripts/rectangles/models/rect.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/assets/javascripts/rectangles/models/rect.js b/assets/javascripts/rectangles/models/rect.js index 548e16a..5623dc8 100644 --- a/assets/javascripts/rectangles/models/rect.js +++ b/assets/javascripts/rectangles/models/rect.js @@ -26,6 +26,16 @@ window.rect = (function(){ rect.prototype.area = function(){ return this.x.length() * this.y.length() } + + rect.prototype.mul = function(n){ + this.x.mul(n) + this.y.mul(n) + } + rect.prototype.div = function(n){ + this.x.div(n) + this.y.div(n) + } + rect.prototype.translate = function(translation){ var translation = translation || this.translation this.x.abs().add(translation.a) |
