Boost logo

Geometry :

Subject: [ggl] Point/Box in Box Test (Border Cases - 3D)
From: Simonson, Lucanus J (lucanus.j.simonson)
Date: 2011-06-29 16:26:37

Barend Gehrels wrote:
> 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)

I thought of strategies as a way to allow different algorithms to be specified, for example a smooth() function that accepts different strategies that implement various kinds of smooth operation and defaults to one of the most common/simpler smooth algorithms. It might be overkill to use strategies for specifying an option. I don't foresee the need to make within() extensible in the way that strategies would allow, but I could be missing something in the bigger picture.


Geometry list run by mateusz at