Changeset: 73d44a1a193c for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=73d44a1a193c
Modified Files:
geom/monetdb5/geom.mx
Branch: Aug2011
Log Message:
geom: fixed mbroverlaps()
- use proper signature / argument types,
i.e., **mbr instead of *mbr
- use correct logic to detect overlap
(Credits go to Thibault Sellam for detecting the bug
and providing the correct logic.)
diffs (27 lines):
diff --git a/geom/monetdb5/geom.mx b/geom/monetdb5/geom.mx
--- a/geom/monetdb5/geom.mx
+++ b/geom/monetdb5/geom.mx
@@ -1072,18 +1072,16 @@ wkbcreatepoint_bat(int *out, int *ix, in
throw(MAL, "geom.point", "bunins failed");
}
-geom_export str mbroverlaps(bit *out, mbr *b1, mbr *b2);
+geom_export str mbroverlaps(bit *out, mbr **b1, mbr **b2);
str
-mbroverlaps(bit *out, mbr *b1, mbr *b2)
+mbroverlaps(bit *out, mbr **b1, mbr **b2)
{
- if (mbr_isnil(b1) || mbr_isnil(b2))
+ if (mbr_isnil(*b1) || mbr_isnil(*b2))
*out = 0;
else
- *out = ((b1->ymax >= b2->ymax && b1->xmin <= b2->ymax) ||
- (b2->ymax >= b1->ymax && b2->xmin <= b1->ymax)) &&
- ((b1->xmax >= b2->xmax && b1->ymin <= b2->xmax) ||
- (b2->xmax >= b1->xmax && b2->ymin <= b1->xmax));
+ *out = !(((*b2)->ymax < (*b1)->ymin) || ((*b2)->ymin >
(*b1)->ymax) ||
+ ((*b2)->xmax < (*b1)->xmin) || ((*b2)->xmin >
(*b1)->xmax));
return MAL_SUCCEED;
}
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list