From 28da2a26238ff76f87f4e086a9832a5478c35b23 Mon Sep 17 00:00:00 2001 From: Julie Lala Date: Tue, 15 Apr 2014 20:13:49 -0400 Subject: nomenclature --- vec2.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'vec2.js') diff --git a/vec2.js b/vec2.js index 973613f..aae1c25 100644 --- a/vec2.js +++ b/vec2.js @@ -38,6 +38,11 @@ vec2.prototype.div = function(n){ this.a /= n this.b /= n } +vec2.normalize = function(){ + var dim = max(this.a, this.b) + this.a = this.a/dim + this.b = this.b/dim +} vec2.prototype.contains = function(n){ return this.a <= n && n <= this.b } -- cgit v1.2.3-70-g09d2