[extensions][iterators] In section_iterator take into account machine epsilon.

This commit is contained in:
Adam Wulkiewicz 2015-08-05 01:02:17 +02:00
parent 3a522f11f6
commit 94b198e23f

View File

@ -1,8 +1,9 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
// Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland.
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
@ -28,6 +29,7 @@
#include <boost/geometry/iterators/base.hpp>
#include <boost/geometry/algorithms/overlaps.hpp>
#include <boost/geometry/util/math.hpp>
namespace boost { namespace geometry
{
@ -39,15 +41,15 @@ namespace detail
template <size_t D, typename P, typename B>
inline bool exceeding(short int dir, P const& point, B const& box)
{
return (dir == 1 && get<D>(point) > get<1, D>(box))
|| (dir == -1 && get<D>(point) < get<0, D>(box));
return (dir == 1 && math::larger(get<D>(point), get<1, D>(box)))
|| (dir == -1 && math::smaller(get<D>(point), get<0, D>(box)));
}
template <size_t D, typename P, typename B>
inline bool preceding(short int dir, P const& point, B const& box)
{
return (dir == 1 && get<D>(point) < get<0, D>(box))
|| (dir == -1 && get<D>(point) > get<1, D>(box));
return (dir == 1 && math::smaller(get<D>(point), get<0, D>(box)))
|| (dir == -1 && math::larger(get<D>(point), get<1, D>(box)));
}
}