From c866dc9d3178d7582966d3ce78be68afb742fed2 Mon Sep 17 00:00:00 2001 From: Nick Foster Date: Mon, 16 Jul 2012 14:35:43 -0700 Subject: [PATCH] How did this go so long without being fixed? Range and bearing were asymptotic due to -- get this -- degree/radian confusion. --- python/cpr.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/cpr.py b/python/cpr.py index 7ee4f00..66ed474 100755 --- a/python/cpr.py +++ b/python/cpr.py @@ -153,10 +153,10 @@ def range_bearing(loc_a, loc_b): delta_lat = b_lat - a_lat delta_lon = b_lon - a_lon - avg_lat = (a_lat + b_lat) / 2.0 + avg_lat = ((a_lat + b_lat) / 2.0) * math.pi / 180 R1 = earth_radius_mi*(1.0-esquared)/pow((1.0-esquared*pow(math.sin(avg_lat),2)),1.5) - + R2 = earth_radius_mi/math.sqrt(1.0-esquared*pow(math.sin(avg_lat),2)) distance_North = R1*delta_lat