1

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. enter image description here

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?

Cœur
  • 32,421
  • 21
  • 173
  • 232
Iskander Raimbaev
  • 1,233
  • 2
  • 13
  • 27
  • Maybe you could use this information: http://stackoverflow.com/questions/8914669/algorithm-for-calculating-a-distance-between-2-3-dimensional-points – MrApnea May 09 '16 at 07:23
  • Your question is incomplete. Do you want the shortest distance between two points in space? The shortest great circle distance not moving through earth? – SpamBot May 09 '16 at 08:32

0 Answers0