[Groonga-commit] groonga/groonga [master] geo: remove needless comparison about longitude

Back to archive index

HAYASHI Kentaro null+****@clear*****
Tue Nov 13 17:39:23 JST 2012


HAYASHI Kentaro	2012-11-13 17:39:23 +0900 (Tue, 13 Nov 2012)

  New Revision: fc2d180e142f14be428f6f3f49562c9bf5b81e7d
  https://github.com/groonga/groonga/commit/fc2d180e142f14be428f6f3f49562c9bf5b81e7d

  Log:
    geo: remove needless comparison about longitude

  Modified files:
    lib/geo.c

  Modified: lib/geo.c (+20 -26)
===================================================================
--- lib/geo.c    2012-11-13 17:21:50 +0900 (6e86e58)
+++ lib/geo.c    2012-11-13 17:39:23 +0900 (4356b04)
@@ -2054,32 +2054,26 @@ geo_distance_rectangle_long_dist_type(quadrant_type quad_type,
                                                     lng2,
                                                     lat2) * GRN_GEO_RADIUS;
     }
-  } else if (quad_type == QUADRANT_1ST_TO_3RD ||
-             quad_type == QUADRANT_3RD_TO_1ST) {
-    if (lng1 > lng2) {
-      distance = geo_distance_rectangle_square_root(lng2 + M_2PI,
-                                                    lat2,
-                                                    lng1,
-                                                    lat1) * GRN_GEO_RADIUS;
-    } else {
-      distance = geo_distance_rectangle_square_root(lng1 + M_2PI,
-                                                    lat1,
-                                                    lng2,
-                                                    lat2) * GRN_GEO_RADIUS;
-    }
-  } else if (quad_type == QUADRANT_2ND_TO_4TH ||
-             quad_type == QUADRANT_4TH_TO_2ND) {
-    if (lng1 > lng2) {
-      distance = geo_distance_rectangle_square_root(lng1,
-                                                    lat1,
-                                                    lng2 + M_2PI,
-                                                    lat2) * GRN_GEO_RADIUS;
-    } else {
-      distance = geo_distance_rectangle_square_root(lng2,
-                                                    lat2,
-                                                    lng1 + M_2PI,
-                                                    lat1) * GRN_GEO_RADIUS;
-    }
+  } else if (quad_type == QUADRANT_1ST_TO_3RD) {
+    distance = geo_distance_rectangle_square_root(lng2 + M_2PI,
+                                                  lat2,
+                                                  lng1,
+                                                  lat1) * GRN_GEO_RADIUS;
+  } else if (quad_type == QUADRANT_3RD_TO_1ST) {
+    distance = geo_distance_rectangle_square_root(lng1 + M_2PI,
+                                                  lat1,
+                                                  lng2,
+                                                  lat2) * GRN_GEO_RADIUS;
+  } else if (quad_type == QUADRANT_2ND_TO_4TH) {
+    distance = geo_distance_rectangle_square_root(lng2,
+                                                  lat2,
+                                                  lng1 + M_2PI,
+                                                  lat1) * GRN_GEO_RADIUS;
+  } else if (quad_type == QUADRANT_4TH_TO_2ND) {
+    distance = geo_distance_rectangle_square_root(lng1,
+                                                  lat1,
+                                                  lng2 + M_2PI,
+                                                  lat2) * GRN_GEO_RADIUS;
   } else {
     if (lng1 > lng2) {
       distance = geo_distance_rectangle_square_root(lng1,
-------------- next part --------------
HTML����������������������������...
Download 



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