2d And 3d Distance Calculating

If Planet1 is x1 = 20, y1 = 20, z1 = 100 and Planet2 is x2 = 40, y2 = 40, z2 = 200

3D

distance=Sqr((x1-x2)^2 +(y1-y2)^2+(z1-z2)^2)

2D

distance = Sqr( (x1-x2)^2 + (y1-y2)^2 )
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Share Alike 2.5 License.