Azimuth, polar and radius from xyz

Latitude starts from the equator, positive to the North, negative to the South.
Spherical coordinate phi starts from the positive Y-asix and its maximum value is Math.PI.
Thus to transform one to another:

var paris = {
  lat: 48.864716,
  lon: 2.349014
}
console.log(paris);

var parisSpherical = {
  lat: THREE.Math.degToRad( 90 - paris.lat ),
  lon: THREE.Math.degToRad( paris.lon )
}
console.log(parisSpherical);

var radius = 10;

var parisVector = new THREE.Vector3().setFromSphericalCoords( radius, parisSpherical.lat, parisSpherical.lon);
// check we did it correctly
var spherical = new THREE.Spherical().setFromVector3(parisVector);
console.log(spherical);
////////////////////////////

2 Likes