Skip to content

Instantly share code, notes, and snippets.

@dundalek
Created July 19, 2012 00:21
Show Gist options
  • Save dundalek/3139898 to your computer and use it in GitHub Desktop.
Save dundalek/3139898 to your computer and use it in GitHub Desktop.
function Point(x, y, a, i) {
if (y === void 0) {
a = x.slice(1, -1).replace(/}{/g,',').split(',').map(parseFloat);
for (x = y = i = 0; i < a.length; i += 2) x += a[i], y += a[i+1];
}
this.toString = function () {return '{' + [x, y] + '}'};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment