Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const DEGREE_TO_RADIAN = Math.PI / 180;
- export function coordinateToPosition(lat, lng, radius) {
- const phi = (90 - lat) * DEGREE_TO_RADIAN;
- const theta = (lng + 180) * DEGREE_TO_RADIAN;
- return new THREE.Vector3(
- - radius * Math.sin(phi) * Math.cos(theta),
- radius * Math.cos(phi),
- radius * Math.sin(phi) * Math.sin(theta)
- );
- }
Add Comment
Please, Sign In to add comment