View Single Post

  #4 (permalink)  
Old 02-04-2006
Wilfried Wilfried is offline
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,177
Hi,

See following drawing:

Code:
                           B
                         / |
                       /   |
                     /     |
                   /       |
               c /         | a
               /           |
             /             |
           /               |
         /_________________|
       A         b          C
you know from both points latitude and longitude. Substract them from each other and you know a (delta latitude) and b (delta longitude). First we calculate c (the distance between the points:
Code:
c := Sqrt(Power(a, 2) + Power(b, 2));
Now we calcualte A (the Angle):
Code:
A := ArcSin(a / c);
Now the only thing that rest, is calculate a and b in steps of c until we are at the length of c.

Code:
a := Sin(A) * c_step;
b := Cos(A) * c_step;
So you have to add a and b by the latitude and longitude of the from A and you have the new point on the line.

Note that this is from the top of my head and I could mistake here and there. I also did not check these (Delphi) functions for degree or radians because you could have it idfferent in your programming language.

I also think we have to correct longitude for the latitude because this only count on the equator. Someone has a better view on this ? When I have some spare time I want to check, but difficult at the moment.

I hope this let you in the right direction
Reply With Quote