Boost logo

Geometry :

Subject: [ggl] Point/Box in Box Test (Border Cases - 3D)
From: Adam Wulkiewicz (adam.wulkiewicz)
Date: 2011-06-29 12:09:53


Frank Glinka wrote:
> Hi Barend,
>
> thank you very much for the quick response and for the GGL library! :)
>
>> Hi Frank,
>>
>> "within" should be (according to OGC) "completely within", so a point
>> lying on a border, or a box touching a border, should return false.
>>
>> Internally, it is handled by a sort of "within code", returning 1 if
>> within, 0 if on border, -1 if outside. This is not (yet) accessable to
>> end users.
>>
>> So your question is not completely clear to me, "tests including border
>> cases" means "tests returning true if on a border"?
>
> I am searching a predicate slightly different than 'within' (don't
> know the common term) such that expressions like:
>
> withinX(Box(Point(0,0,0), Point(1,1,1)),Box(Point(0,0,0), Point(2,2,2))
>
> would be true. So using < or > for the comparisons of the boxes' edges
> instead of <= or >= (in within.hpp:117). That wouldn't be equivalent to
> "within(Box, Box) || onBorder(Box, Box)" in my understanding.
>
> I had a look into the 'within_util.hpp' file with the within_code
> function and it would be sufficient for point-in-box or point-in-ring
> tests (although it is currently only prepared to work with 2D
> points!?). But what about box-in-box or ring-in-ring use cases?

Hi,

There are functions which could take edges and corners into account:
within, disjoint, overlaps, intersects. Maby configurable by additional
function or better template bool parameter?

I had to implemented nD versions of needed functions in geometry::index.
Funny thing is that my version of within takes edges into account so
works different than the official one. This should be unified I guess.
within with edges is needed if one wants to test if there is a point/box
inside some other expanded bounding box. The same thing with intersects
which I didn't implement and use geometry::intersects. Does it take
borders into account?

What is more, if someone perform the querry for points inside some
Geometry, points that are on the edge of this Geometry should be
returned or not? This should be configurable by some template parameter
I guess.

Maby something like this:

within(g1, g2); // default one
within<with_border>(g1, g2);
within<without_border>(g1, g2);

intersects(g1, g2); // default one
intersects<with_border>(g1, g2);
intersects<without_border>(g1, g2);

index | spatially_filtered(g); // default one
index | spatially_filtered<with_border>(g);
index | spatially_filtered<without_border>(g);

?

Regards,
Adam


Geometry list run by mateusz at loskot.net