Boost logo

Geometry :

Subject: [ggl] (spatial_)index::is_overlapping
From: Mateusz Loskot (mateusz)
Date: 2009-06-18 19:39:34


Barend Gehrels wrote:
> Hi Chris,
>
>> I've simplified the function to this:
>>
>> template <typename Box>
>> inline bool is_overlapping(Box const& b1, Box const& b2)
>> {
>> if (ggl::get<min_corner, 0>(b1) > ggl::get<max_corner, 0>(b2))
>> return false
>>
>> if (ggl::get<max_corner, 0>(b1) < ggl::get<min_corner, 0>(b2))
>> return false;
>>
>> if (ggl::get<min_corner, 1>(b1) > ggl::get<max_corner, 1>(b2))
>> return false;
>>
>> if (ggl::get<max_corner, 1>(b1) < ggl::get<min_corner, 1>(b2))
>> return false;
>>
>> return true;
>> }
>>
>>
>> This should dramatically reduce the numbers of "get". Do you see an
>> obvious flaw?
>>
> OK and much better than what I just checked in, and somewhat faster.

Barend,

Just a side note, How do we know that?

These accessors are very good candidates to be completely optimized out
and then no function calls will occur.

Cheers

-- 
Mateusz Loskot, http://mateusz.loskot.net
Charter Member of OSGeo, http://osgeo.org

Geometry list run by mateusz at loskot.net