summaryrefslogtreecommitdiff
path: root/boost/geometry/algorithms/detail/overlay/get_clusters.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/geometry/algorithms/detail/overlay/get_clusters.hpp')
-rw-r--r--boost/geometry/algorithms/detail/overlay/get_clusters.hpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/boost/geometry/algorithms/detail/overlay/get_clusters.hpp b/boost/geometry/algorithms/detail/overlay/get_clusters.hpp
index 1e612d6577..2747fa68ba 100644
--- a/boost/geometry/algorithms/detail/overlay/get_clusters.hpp
+++ b/boost/geometry/algorithms/detail/overlay/get_clusters.hpp
@@ -35,19 +35,29 @@ namespace detail { namespace overlay
template <typename Tag = no_rescale_policy_tag, bool Integral = false>
struct sweep_equal_policy
{
+private:
+ template <typename T>
+ static inline T threshold()
+ {
+ // Points within some epsilons are considered as equal.
+ return T(100);
+ }
+public:
+ // Returns true if point are considered equal (within an epsilon)
template <typename P>
static inline bool equals(P const& p1, P const& p2)
{
- // Points within a kilo epsilon are considered as equal
- return approximately_equals(p1, p2, 1000.0);
+ using coor_t = typename coordinate_type<P>::type;
+ return approximately_equals(p1, p2, threshold<coor_t>());
}
template <typename T>
static inline bool exceeds(T value)
{
// This threshold is an arbitrary value
- // as long as it is than the used kilo-epsilon
- return value > 1.0e-3;
+ // as long as it is bigger than the used value above
+ T const limit = T(1) / threshold<T>();
+ return value > limit;
}
};