Guest User

Untitled

a guest
Nov 19th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. export function coordinateToPosition(lat, lng, radius) {
  2. const phi = (90 - lat) * DEGREE_TO_RADIAN;
  3. const theta = (lng + 180) * DEGREE_TO_RADIAN;
  4.  
  5. return new THREE.Vector3(
  6. - radius * Math.sin(phi) * Math.cos(theta),
  7. radius * Math.cos(phi),
  8. radius * Math.sin(phi) * Math.sin(theta)
  9. );
  10. }
Add Comment
Please, Sign In to add comment