See http://geographiclib.sourceforge.net/