diff --git a/vector.coffee b/vector.coffee index 0701c17..a7fe93f 100644 --- a/vector.coffee +++ b/vector.coffee @@ -44,7 +44,7 @@ class Vector @y *= v.y @z *= v.z - normalize -> + normalize: -> m = @mag() @div m if m > 0 diff --git a/vector.js b/vector.js index 752991e..35f5056 100644 --- a/vector.js +++ b/vector.js @@ -56,13 +56,13 @@ this.y *= v.y; return this.z *= v.z; }; - normalize(function() { + Vector.prototype.normalize = function() { var m; m = this.mag(); if (m > 0) { return this.div(m); } - }); + }; Vector.prototype.set = function(x, y, z) { var _ref; return _ref = [x, y, z], this.x = _ref[0], this.y = _ref[1], this.z = _ref[2], _ref;