Skip to content

Instantly share code, notes, and snippets.

View sincness's full-sized avatar
🎯
Focusing

Malthe Buss sincness

🎯
Focusing
View GitHub Profile
@sincness
sincness / Vector.js
Created September 14, 2021 17:10 — 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);
};