Skip Menu |

This queue is for tickets about the Tree-R CPAN distribution.

Report information
The Basics
Id: 116219
Status: rejected
Worked: 30 min
Priority: 0/
Queue: Tree-R

People
Owner: Nobody in particular
Requestors: sdotp [...] yahoo.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



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
On Sat Jul 16 16:19:09 2016, sdotp@yahoo.com wrote: Show quoted text
> 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
R Tree stores objects organized by their bounding boxes query_point returns the objects within whose bbox a given point is - your understanding is more or less correct query_completely_within_rect returns the objects whose bbox are completely within the given rect - this is your 2nd check I believe the semantic issue is with you and the code is correct. Best regards, Ari