Last active
February 6, 2019 10:57
-
-
Save Mamboleoo/2b4ecae5da39610c368bd8f6880cf8a0 to your computer and use it in GitHub Desktop.
Polar coordinates [3D-2D]
This file contains hidden or 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
let GLOBE_RADIUS = width / 3; // Radius of the globe based on the canvas width | |
class Dot { | |
constructor() { | |
this.theta = Math.random() * 2 * Math.PI; // Random value between [0, 2Pi] | |
this.phi = Math.acos((Math.random() * 2) - 1); // Random value between [0, Pi] | |
} | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment