|
Geometry : |
Subject: [ggl] Point/Box in Box Test (Border Cases - 3D)
From: Barend Gehrels (barend)
Date: 2011-06-29 16:04:59
On 28-6-2011 20:27, Simonson, Lucanus J wrote:
> Adam Wulkiewicz wrote:
>> 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);
> I would suggest an optional runtime argument with default to the current behavior:
>
> intersects(g1, g2);
> intersects(g1, g2, true);
>
> Since it should inline constant propigation should eliminate the cost of the runtime argument and make it the same cost as a template parameter. The runtime argument allows runtime use cases whereas the template parameter forces the awkward if(true) return contains<true>(g1, g2); else return contains<false>(g1,g2); syntax onto user code.
I agree, I like in this case the runtime arguments more, also because
the template parameters cannot be added anymore without breaking the
current interface. Another reason is that the samples above are not
valid C++03 combinations.
Another possibility is to use strategies, we might expose a strategy
returning true if inside or on border (strategies are already an
optional runtime parameter)
Regards, Barend
Geometry list run by mateusz at loskot.net