Guest User

Untitled

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