mirror of
https://github.com/boostorg/geometry.git
synced 2026-02-01 20:42:10 +00:00
[extensions][nsphere][within][strategies] For NSphere/Box and Point/Nsphere take into account machine epsilon.
This commit is contained in:
@@ -1,9 +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) 2013 Adam Wulkiewicz, Lodz, Poland.
|
||||
// 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) 2013-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 +28,8 @@
|
||||
#include <boost/geometry/extensions/nsphere/core/tags.hpp>
|
||||
#include <boost/geometry/extensions/nsphere/algorithms/assign.hpp>
|
||||
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
@@ -66,7 +68,7 @@ inline bool point_in_circle(P const& p, C const& c)
|
||||
strategy_type, P, point_type
|
||||
>::apply(strategy, get_radius<0>(c));
|
||||
|
||||
return r < rad;
|
||||
return math::smaller(r, rad);
|
||||
}
|
||||
/// 2D version
|
||||
template<typename T, typename C>
|
||||
|
||||
@@ -1,9 +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) 2013 Adam Wulkiewicz, 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) 2013-2015 Adam Wulkiewicz, London, UK.
|
||||
|
||||
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
|
||||
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <boost/geometry/core/coordinate_dimension.hpp>
|
||||
#include <boost/geometry/strategies/covered_by.hpp>
|
||||
#include <boost/geometry/strategies/within.hpp>
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
|
||||
|
||||
namespace boost { namespace geometry { namespace strategy
|
||||
@@ -36,7 +37,8 @@ struct nsphere_within_range
|
||||
, ContainingValue const& ing_min
|
||||
, ContainingValue const& ing_max)
|
||||
{
|
||||
return ing_min < ed_min && ed_max < ing_max;
|
||||
return math::smaller(ing_min, ed_min)
|
||||
&& math::smaller(ed_max, ing_max);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -49,7 +51,8 @@ struct nsphere_covered_by_range
|
||||
, ContainingValue const& ing_min
|
||||
, ContainingValue const& ing_max)
|
||||
{
|
||||
return ing_min <= ed_min && ed_max <= ing_max;
|
||||
return math::smaller_or_equals(ing_min, ed_min)
|
||||
&& math::smaller_or_equals(ed_max, ing_max);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,9 +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) 2013 Adam Wulkiewicz, 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) 2013-2015 Adam Wulkiewicz, London, UK.
|
||||
|
||||
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
|
||||
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
|
||||
@@ -23,6 +23,8 @@
|
||||
|
||||
#include <boost/geometry/extensions/nsphere/views/center_view.hpp>
|
||||
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
|
||||
namespace boost { namespace geometry { namespace strategy
|
||||
{
|
||||
|
||||
@@ -32,10 +34,10 @@ namespace within
|
||||
struct point_nsphere_within_comparable_distance
|
||||
{
|
||||
template <typename ComparableDistance, typename Radius>
|
||||
static inline bool apply(ComparableDistance const& ed_comp_dist
|
||||
, Radius const& ing_radius)
|
||||
static inline bool apply(ComparableDistance const& ed_comp_dist,
|
||||
Radius const& ing_radius)
|
||||
{
|
||||
return ed_comp_dist < ing_radius * ing_radius;
|
||||
return math::smaller(ed_comp_dist, ing_radius * ing_radius);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -43,10 +45,10 @@ struct point_nsphere_within_comparable_distance
|
||||
struct point_nsphere_covered_by_comparable_distance
|
||||
{
|
||||
template <typename ComparableDistance, typename Radius>
|
||||
static inline bool apply(ComparableDistance const& ed_comp_dist
|
||||
, Radius const& ing_radius)
|
||||
static inline bool apply(ComparableDistance const& ed_comp_dist,
|
||||
Radius const& ing_radius)
|
||||
{
|
||||
return ed_comp_dist <= ing_radius * ing_radius;
|
||||
return math::smaller_or_equals(ed_comp_dist, ing_radius * ing_radius);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user