Boost logo

Geometry :

Subject: [ggl] box/box clipping
From: Barend Gehrels (barend.gehrels)
Date: 2010-12-30 05:02:05


Hi Arash,

Op 30-12-2010 7:00, Arash Partow schreef:
> On 29/12/2010 8:42 PM, Barend Gehrels wrote:
>> Op 29-12-2010 8:51, Arash Partow schreef:
>>> On 28/12/2010 11:00 PM, barend wrote:
>>>> If this all is possible, with or without is_range (it probably is),
>>>> the
>>>> function would look like
>>>> bool intersection(Box const& b1, Box const& b2, Box& clipped), so the
>>>> function you proposed but with the old name...
>>>>
>>>
>>> What if one only wants to know if the boxes intersect? that check if
>>> done for AABB's is _far cheaper_ than actually constructing the
>>> intersection box itself(and far more common). In that scenario what
>>> would the function look like?
>>>
>>
>> The user can call the function intersects then.
>>
>> template <typename Geometry1, typename Geometry2>
>> bool intersects(Geometry2 const& a, Geometry2 const& b)
>>
>> Or ! disjoint, which is similar.
>>
>
> Ahhhhhh I see, I was looking in intersection.hpp :D

OK. Actually, after sending my answer, I thought there is something more
in your question that I missed. The intersects function and intersection
function now both return bool, and now have an overlap... Users will
indeed be tended to use intersection instead of intersects.

So maybe it is better to reverse it and let it return void (initializing
the box to inverse-infinite if there is no), as one of the suggestions
of Feverish was.

>
> btw is there a line type? - I can see that there is a line-segment,
> however can't seem to find a line.

No, a line type and a ray type are not (yet) supported.

Regards, Barend


Geometry list run by mateusz at loskot.net