I am implementing an algorithm to calculate distance between two objects (points) on the some custom map. However, the standard distance-formula, for example, implemented in this post AnotherPostOnStackOverflow
calculate distance between (lat1,lon1) and (lat2,lon2) in some 2d-space. I mean that it takes Ox and Oz but doesn't pay attention to Oy. See picture.
I wonder what if my objects also placed in different Oy, i mean Object_1 (10,10, 2) - earth and Object_2 (10,10, 20) - sky. How should i add calculation of distance by Oy too?
I want to use the following approach: Calculate distance between (lat1,lon1) and (lat2,lon2) normally, then change this values to simple (x,y) coordinates and find Euclidean distance. But then how to convert distance((lat1,lon1),(lat2,lon2)) to coordinates?
My inputs : double lat1, double lon1, int kilometersFromEarthFixedPoint.
Sample : object_1 : (43.222015, 76.851248, 5)
Sample : object_2 : (51.160523, 71.470356, 2)
It means that this two objects are above the normal earth-point 0 such 0+2 and 0+5.
Expected output : miles\km
214 km (sample too)
Should i ask this question in mathematics? And does this task contains the correct initial conditions?