From 5a8fb819126f9b1d9244cd3558a54a7d16b6858e Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Fri, 11 Apr 2014 11:46:55 -0400 Subject: abs --- rectangles.html | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'rectangles.html') diff --git a/rectangles.html b/rectangles.html index 8878985..b6f4ca9 100644 --- a/rectangles.html +++ b/rectangles.html @@ -32,7 +32,7 @@ vec2.prototype.length = function(){ vec2.prototype.clone = function(){ return new vec2(this.a, this.b) } -vec2.prototype.normalize = function(){ +vec2.prototype.abs = function(){ if (this.b < this.a) { this.a = this.a ^ this.b this.b = this.a ^ this.b @@ -99,8 +99,8 @@ rect.prototype.center = function(){ return new vec2(this.x.midpoint(), this.y.midpoint()) } rect.prototype.normalize = function(){ - this.x.normalize().add(this.translation.a) - this.y.normalize().add(this.translation.b) + this.x.abs().add(this.translation.a) + this.y.abs().add(this.translation.b) this.translation.a = this.translation.b = 0 return this } @@ -149,7 +149,6 @@ canvas.addEventListener("mousedown", function(e){ else { creating = true } - }) canvas.addEventListener("mousemove", function(e){ mouse.x.b = e.pageX -- cgit v1.2.3-70-g09d2