Skip to content

Instantly share code, notes, and snippets.

@yomotsu
Created December 5, 2013 17:24
Show Gist options
  • Save yomotsu/7809608 to your computer and use it in GitHub Desktop.
Save yomotsu/7809608 to your computer and use it in GitHub Desktop.
function convertLatLonToVec3 ( lat, lon ) {
lat = lat * Math.PI / 180.0;
lon = -lon * Math.PI / 180.0;
return new THREE.Vector3(
Math.cos( lat ) * Math.cos( lon ),
Math.sin( lat ),
Math.cos( lat ) * Math.sin( lon ) );
}
marker.position = convertLatLonToVec3( lat, lon ).multiplyScalar( earthRadius );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment