• Advertisement
Sign in to follow this  

Generate geographic coordinates given a vertex in a sphere

This topic is 4039 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I need a way to get the geographic coordinates (longitude and latitude) of a selected vertex in a sphere. Does anybody know of any material on this subject? Thanks.

Share this post


Link to post
Share on other sites
Advertisement
Geographic coordinates are virtually the same as spherical polar coordinates. The differences are superficial:
1. It is often assumed that the normalised altitude (cf. radius) is 1.
2. Angles are taken to run from 0° to 360° and -90° to 90°, using imperial degrees-minutes-seconds rather than 0 to 2p in a decimal expansion.

Assuming the sphere is centred at the origin (if it isn't, translate), has radius r, and has poles at (0, r, 0) and (0, -r, 0):

φ = arccos(y/r)
θ = arctan(z/x)

(If you're working in C or C++, you should want to use atan2(y, x) rather than atan(y/x)).

This will get you to spherical polar coordinates. To convert this to geographics:

lat = φ * (180 / Pi) - 90
lon = θ * (180 / Pi)

The conversion into minutes has as much to do with string-processing as mathematics, so I take it you're not interested.

Admiral

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement