HAYASHI Kentaro
null+****@clear*****
Wed Oct 31 18:45:57 JST 2012
HAYASHI Kentaro 2012-10-31 18:45:57 +0900 (Wed, 31 Oct 2012) New Revision: 0d01a3e07b06f14c03ae9370b6b3d50a297a4240 https://github.com/groonga/groonga/commit/0d01a3e07b06f14c03ae9370b6b3d50a297a4240 Log: geo: return the value of correct distance according to quadrant type Support to calculate the value of distance across the equator in eastern hemisphere. (4th quadrant to 1st one) refs #1534 Modified files: lib/geo.c Modified: lib/geo.c (+5 -1) =================================================================== --- lib/geo.c 2012-10-31 18:20:55 +0900 (48815c3) +++ lib/geo.c 2012-10-31 18:45:57 +0900 (1af34df) @@ -1906,6 +1906,9 @@ geo_quadrant_type(grn_geo_point *point1, grn_geo_point *point2) } else if (point1->longitude >= 0 && point2->longitude >= 0 && point1->latitude > 0 && point2->latitude < 0) { return QUADRANT_1ST_TO_4TH; + } else if (point1->longitude >= 0 && point2->longitude >= 0 && + point1->latitude < 0 && point2->latitude > 0) { + return QUADRANT_4TH_TO_1ST; } else { /* FIXME */ return QUADRANT_1ST; @@ -1961,7 +1964,8 @@ grn_geo_distance_rectangle_raw(grn_ctx *ctx, latitude_delta = lat2 - lat1; slope = latitude_delta / longitude_delta; intercept = lat1 - slope * lng1; - if (quad_type == QUADRANT_1ST_TO_4TH) { + if (quad_type == QUADRANT_1ST_TO_4TH || + quad_type == QUADRANT_4TH_TO_1ST) { if (longitude_delta == 0) { north_distance = geo_distance_rectangle_square_root(lng1, lat1, -------------- next part -------------- HTML����������������������������...Download