Skip to content

Instantly share code, notes, and snippets.

@teoyoung
Created March 18, 2019 21:31
Show Gist options
  • Save teoyoung/6157f3fc446f75310f3ed908137db287 to your computer and use it in GitHub Desktop.
Save teoyoung/6157f3fc446f75310f3ed908137db287 to your computer and use it in GitHub Desktop.
Math
let radius = 200;
let separation = 10;
for ( var s = 0; s <= 180; s+=separation ) {
var radianS = s*Math.PI / 180;
var pZ = radius * Math.cos(radianS);
for ( var t = 0; t < 360; t+=separation ) {
var radianT = t*Math.PI / 180;
var pX = radius* Math.sin(radianS) * Math.cos(radianT);
var pY = radius* Math.sin(radianS) * Math.sin(radianT);
let date = {
point: { x: pX, y: pY, z: pZ },
stars: [{ x: 0, y: 0, z: 0 },{ x: 0, y: 0, z: 0 }]
};
this.memory_stars.push( date );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment