Port of Java Android Geodesic Inverse function