-
Hi there,
A little bit math also... How it would be possible to find out the distance and magnetic course between two different points on the globe? The latitude & longitude of the points is known. I have been looking for a free OCX or code strip for this, but haven't found any. So does anyone have any idea how this kind of function could be carried out?
Thanks,
- Ville
-
have u tried researching science books or on the internet to see how you would go about coding it?
i'm sure there must a site that talks about something like that ...
i wonder is NASA can be emailed?
-
The latitude and longitude -> distance problem got my attention, it's easy if you know how to do it.
First you need both positions, the latitude and longitude angles gives you this:
X1=R*cos(lat1)*cos(long1)
Y1=R*cos(lat1)*sin(long1)
Z1=R*sin(lat1)
X2=R*cos(lat2)*cos(long2)
Y2=R*cos(lat2)*sin(long2)
Z2=R*sin(lat2)
the distance d between them is easy pythagoras:
D = sqr((X1 -X2)^2 + (Y1-Y2)^2 + (Z1-Z2)^2)
Now the distance is the secant of a circle projection in the sphere, whereas you don't want that distance but the arc that is the distance on the surface of the sphere.
You calculate the angle between the points on that projected circle:
a= arcsin(d/(2*r))
since you can't do arcsin in vb you have to use arcus tangens instead, looked this up in vb5 help file:
Arcsin(X) = Atn(X / Sqr(-X * X + 1))
the arc you want can be calculated easily from the angle and the radius:
Distance=a*R
Note that vb trigs are done in radians so you need to convert the inputed longitudes and latitudes to radians:
rad=deg/180*3.1415