Subject: | Potential bug or semantic issue with query_completely_within_rect |
Date: | Sat, 16 Jul 2016 20:16:47 +0000 (UTC) |
To: | "bug-Tree-R [...] rt.cpan.org" <bug-Tree-R [...] rt.cpan.org> |
From: | anand <sdotp [...] yahoo.com> |
Hello,
R Tree I believe stores rectangles which can be thought of as "bounding boxes". So when we query for a point using query_point(point..), I believe it queries the following:"Does point lie in any of the bounding boxes in the R Tree?"
Is my above understanding right?
Likewise, when we query for a rectangle using query_completely_within_rect(rect...), we are querying:(1) whether rect lies within any of the bounding boxes in the R Tree
By any chance does the current implementation instead check:(2) whether rect encloses any of the rectangles stored within the R Tree?
If (1) is the case, then the implementation of the query_completely_within_rect() function should do this check:
if ((!${$N}->[0])
and (${$N}->[2] <= $minx)
and (${$N}->[4] >= $maxx)
and (${$N}->[3] <= $miny)
and (${$N}->[5] >= $maxy))
{
#print("DEBUG2: found @${$N}\n");
push @$objects,${$N}->[1];
}
instead of what is currently done:
else {
if ((!${$N}->[0])
and (${$N}->[2] >= $minx)
and (${$N}->[4] <= $maxx)
and (${$N}->[3] >= $miny)
and (${$N}->[5] <= $maxy))
{
push @$objects,${$N}->[1];
}
Note the change in inequalities. Please let me know what you think.
Thanks,Anand