I've been trying to work out the bearing between two lat lon co ordinates but am having trouble grasping the concept.
I have been to http://www.movable-type.co.uk/scripts/latlong.html and have been able to change to distance code to work with lua, however the bearing code in the paragraphs under has me a little confused.
local y = Math.sin(dLon) * Math.cos(lat2)
local x = Math.cos(lat1)*Math.sin(lat2) - Math.sin(lat1)*Math.cos(lat2)*Math.cos(dLon)
local brng = Math.atan2(y, x).toDeg()
The naming of the variables (lat1, lat2, dLon) has me confused.
If my initial lat lon is:
Latitude = -33.8830555556 Longitude = 151.216666667
and my destination lat and lon is:
Latitude = 22.25 Longitude = 114.1667
What variables need to match up to which lat and lons?
Is the dLon variable refering to the distance between the two points longitudinally?
Thanks a bunch!