[Groonga-commit] groonga/groonga [master] geo: simplify codes when the value of longitude is same

Back to archive index

HAYASHI Kentaro null+****@clear*****
Wed Nov 7 17:09:28 JST 2012


HAYASHI Kentaro	2012-11-07 17:09:28 +0900 (Wed, 07 Nov 2012)

  New Revision: 8e7dd748a37497b53decdfbee9e20569c6ff7442
  https://github.com/groonga/groonga/commit/8e7dd748a37497b53decdfbee9e20569c6ff7442

  Log:
    geo: simplify codes when the value of longitude is same

  Modified files:
    lib/geo.c

  Modified: lib/geo.c (+2 -8)
===================================================================
--- lib/geo.c    2012-11-07 15:34:57 +0900 (cf4e44a)
+++ lib/geo.c    2012-11-07 17:09:28 +0900 (536f481)
@@ -2013,14 +2013,8 @@ geo_distance_rectangle_short_dist_type(quadrant_type quad_type,
                                                       lng2,
                                                       lat2);
     } else {
-      distance = (geo_distance_rectangle_square_root(lng1,
-                                                     lat1,
-                                                     lng2,
-                                                     0) +
-                  geo_distance_rectangle_square_root(lng1,
-                                                     0,
-                                                     lng2,
-                                                     lat2)) * GRN_GEO_RADIUS;
+      latitude_delta = fabs(lat1) + fabs(lat2);
+      distance = sqrt(latitude_delta * latitude_delta) * GRN_GEO_RADIUS;
     }
   } else if (quad_type == QUADRANT_1ST_TO_3RD ||
              quad_type == QUADRANT_3RD_TO_1ST ||
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index