Skip to content

Instantly share code, notes, and snippets.

@Mamboleoo
Last active February 6, 2019 10:57
Show Gist options
  • Save Mamboleoo/2b4ecae5da39610c368bd8f6880cf8a0 to your computer and use it in GitHub Desktop.
Save Mamboleoo/2b4ecae5da39610c368bd8f6880cf8a0 to your computer and use it in GitHub Desktop.
Polar coordinates [3D-2D]
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