Distance from Point To Line great circle function not working right. -
I need to get distance from distance / LNG point. I undoubtedly need to follow the great circle.
I found a great article on this
but the code is not working right. Either I am doing something wrong or missing something. This is the function in question. If necessary, look for the link for other functions.
var R = 3961.3 LatLon.crossTrack = function (lat1, lon1, lat2, lon2, lat3, lon3) {var d13 = LatLon.distHaversine Lat1, lon1, lat3, lon3); Var brng12 = lotalon. Bearing (lat1, lon1, lat2, lon2); Var brng13 = lotalon. Effect (lat1, lon1, lat3, lon3); Var dXt = Math.Sin (Math (D13 / R) * Math (Bronze13-Brande 12)) * R; Return DXT; }
lat / lon1 = -94.127592, 41.81762
latitude / lon2 = -94.087257, 41.848202
lat / lon3 = -94.046875, 41.791057
It reports 0.865 miles, the actual distance is 4.2 9 0.9 miles
How does any clue determine this? I'm not a mathematician, it's just long in the tooth programmer.
Most triangular tasks require radians. What degree are your angular measures? They may need to be changed using the normal formula:
2 * & pi; Radian = 360 degree
If you look under the formula for Harveyen formula, you will see:
(Note that the angles are in radians Should pass triangular tasks).
Comments
Post a Comment