summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/rectangles/models/rect.js
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2014-06-20 14:13:29 -0400
committerJules Laplace <jules@okfoc.us>2014-06-20 14:13:29 -0400
commit712387da2f75c845807ad4489b29fec34bfe9a56 (patch)
tree2fab35671b730b7305b920ba1b63299fd8fa4922 /public/assets/javascripts/rectangles/models/rect.js
parent9151023c978bd3aed20ad00d5d3301dfe7ed2a2a (diff)
parent1668d6e2e20c9bd53f3f6a299541c582da9742b4 (diff)
merge
Diffstat (limited to 'public/assets/javascripts/rectangles/models/rect.js')
-rw-r--r--public/assets/javascripts/rectangles/models/rect.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/public/assets/javascripts/rectangles/models/rect.js b/public/assets/javascripts/rectangles/models/rect.js
index cb14e66..a4fbd87 100644
--- a/public/assets/javascripts/rectangles/models/rect.js
+++ b/public/assets/javascripts/rectangles/models/rect.js
@@ -25,6 +25,12 @@ 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.maxDimension = function(){
+ return abs(this.width) > abs(this.height) ? this.width : this.height
+ }
Rect.prototype.mul = function(n){
this.x.mul(n)