Skip to content

Instantly share code, notes, and snippets.

View valmormn's full-sized avatar
🦉

Valmor valmormn

🦉
View GitHub Profile
@valmormn
valmormn / Vector.js
Created February 21, 2018 14:20 — forked from jjgrainger/Vector.js
A simple Vector class in javascript
var Vector = function(x, y) {
this.x = x || 0;
this.y = y || 0;
};
// return the angle of the vector in radians
Vector.prototype.getDirection = function() {
return Math.atan2(this.y, this.x);
};