This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/********************************************************* | |
COPYRIGHT RAONI OLIVEIRA 2018 | |
Please don't use my code without mentioning me. | |
I can be reached at [email protected] | |
The following code is written in JavaScript using p5.js library. | |
*********************************************************/ |