From b327a40e9bc5ffeb2ea1b463b1b59e4bc2e10eb7 Mon Sep 17 00:00:00 2001 From: liabru Date: Sat, 24 Jan 2015 19:40:23 +0000 Subject: [PATCH] added Vector.create --- src/geometry/Vector.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/geometry/Vector.js b/src/geometry/Vector.js index 2e2d7ba..c66f29d 100644 --- a/src/geometry/Vector.js +++ b/src/geometry/Vector.js @@ -15,6 +15,17 @@ var Vector = {}; (function() { + /** + * Creates a new vector. + * @method create + * @param {number} x + * @param {number} y + * @return {vector} A new vector + */ + Vector.create = function(x, y) { + return { x: x || 0, y: y || 0 }; + }; + /** * Returns a new vector with `x` and `y` copied from the given `vector`. * @method clone