I current studying at Sprite and want to place lot of photos on a sphere and select them . After fiddle with Three.Spherical I finally success . But now I can only place radomly on the sphere by the following code
let spherical = new THREE.Spherical();
let point = new THREE.Vector3();
function randomOnSphere(radius, PhiRange, ThetaRange) {
let randomPhi = Math.random() * PhiRange * Math.PI / 180;
let randomTheta = Math.random() * ThetaRange * Math.PI / 180;
spherical.set(radius, randomPhi, randomTheta);
point.setFromSpherical(spherical);
return point;
}
sometimes photo behind others never show completely. Is there any function that I can place them evenly
here is my result https://relaxslow.herokuapp.com/
function randomOnSphereEven(radius) {
//pick numbers between 0 and 1
var u = Math.random();
var v = Math.random();
// create random spherical coordinate
var theta =Math.acos(2 * u - 1);
var phi = Math.acos(2 * v - 1);
spherical.set(radius, phi, theta);
point.setFromSpherical(spherical);
return point;
}
and get following result
Maybe I have misunderstood the code , I don’t get desired result .Can you explain the code . Sorry , I’m not good at math , but I do want to learn them.