null+****@clear*****
null+****@clear*****
2012年 6月 6日 (水) 14:26:45 JST
HAYASHI Kentaro 2012-06-06 14:26:45 +0900 (Wed, 06 Jun 2012)
New Revision: 2397b46bd0b4f5fd7a0c3bc73b2d596321c2c4e5
Log:
geo: fix to return correct kind of quadrant
refs #1386
Modified files:
lib/geo.c
Modified: lib/geo.c (+10 -2)
===================================================================
--- lib/geo.c 2012-06-06 13:07:04 +0900 (a3916b0)
+++ lib/geo.c 2012-06-06 14:26:45 +0900 (d5ce403)
@@ -1890,8 +1890,16 @@ geo_quadrant_type(grn_geo_point *point1, grn_geo_point *point2)
} else if (QUADRANT_4TH_WITH_AXIS(point1) && QUADRANT_4TH_WITH_AXIS(point2)) {
return QUADRANT_4TH;
} else {
- /* FIXME */
- return QUADRANT_1ST;
+ if (point1->longitude > 0 && point2->longitude < 0 &&
+ point1->latitude >= 0 && point2->latitude >= 0) {
+ return QUADRANT_1ST_TO_2ND;
+ } else if (point1->longitude < 0 && point2->longitude > 0 &&
+ point1->latitude >= 0 && point2->latitude >= 0) {
+ return QUADRANT_2ND_TO_1ST;
+ } else {
+ /* FIXME */
+ return QUADRANT_1ST;
+ }
}
#undef QUADRANT_1ST_WITH_AXIS
#undef QUADRANT_2ND_WITH_AXIS