summaryrefslogtreecommitdiff
path: root/boost/geometry/algorithms/detail/get_left_turns.hpp
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2017-09-13 11:24:46 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2017-09-13 11:25:39 +0900
commit4fadd968fa12130524c8380f33fcfe25d4de79e5 (patch)
treefd26a490cd15388d42fc6652b3c5c13012e7f93e /boost/geometry/algorithms/detail/get_left_turns.hpp
parentb5c87084afaef42b2d058f68091be31988a6a874 (diff)
downloadboost-upstream/1.65.0.tar.gz
boost-upstream/1.65.0.tar.bz2
boost-upstream/1.65.0.zip
Imported Upstream version 1.65.0upstream/1.65.0
Change-Id: Icf8400b375482cb11bcf77440a6934ba360d6ba4 Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'boost/geometry/algorithms/detail/get_left_turns.hpp')
-rw-r--r--boost/geometry/algorithms/detail/get_left_turns.hpp40
1 files changed, 20 insertions, 20 deletions
diff --git a/boost/geometry/algorithms/detail/get_left_turns.hpp b/boost/geometry/algorithms/detail/get_left_turns.hpp
index 95ab98c236..e9f6a50859 100644
--- a/boost/geometry/algorithms/detail/get_left_turns.hpp
+++ b/boost/geometry/algorithms/detail/get_left_turns.hpp
@@ -2,6 +2,11 @@
// Copyright (c) 2012-2014 Barend Gehrels, Amsterdam, the Netherlands.
+// This file was modified by Oracle on 2017.
+// Modifications copyright (c) 2017, Oracle and/or its affiliates.
+
+// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
+
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
@@ -60,17 +65,14 @@ inline int squared_length(Vector const& vector)
}
-template <typename Point>
+template <typename Point, typename SideStrategy>
struct angle_less
{
typedef Point vector_type;
- typedef typename strategy::side::services::default_strategy
- <
- typename cs_tag<Point>::type
- >::type side_strategy_type;
- angle_less(Point const& origin)
+ angle_less(Point const& origin, SideStrategy const& strategy)
: m_origin(origin)
+ , m_strategy(strategy)
{}
template <typename Angle>
@@ -89,8 +91,7 @@ struct angle_less
return quadrant_p < quadrant_q;
}
// Same quadrant, check if p is located left of q
- int const side = side_strategy_type::apply(m_origin, q.point,
- p.point);
+ int const side = m_strategy.apply(m_origin, q.point, p.point);
if (side != 0)
{
return side == 1;
@@ -114,19 +115,17 @@ struct angle_less
private:
Point m_origin;
+ SideStrategy m_strategy;
};
-template <typename Point>
+template <typename Point, typename SideStrategy>
struct angle_equal_to
{
typedef Point vector_type;
- typedef typename strategy::side::services::default_strategy
- <
- typename cs_tag<Point>::type
- >::type side_strategy_type;
-
- inline angle_equal_to(Point const& origin)
+
+ inline angle_equal_to(Point const& origin, SideStrategy const& strategy)
: m_origin(origin)
+ , m_strategy(strategy)
{}
template <typename Angle>
@@ -143,13 +142,13 @@ struct angle_equal_to
return false;
}
// Same quadrant, check if p/q are collinear
- int const side = side_strategy_type::apply(m_origin, q.point,
- p.point);
+ int const side = m_strategy.apply(m_origin, q.point, p.point);
return side == 0;
}
private:
Point m_origin;
+ SideStrategy m_strategy;
};
template <typename AngleCollection, typename Turns>
@@ -193,13 +192,14 @@ inline void get_left_turns(AngleCollection const& sorted_angles,
//! Returns the number of clusters
-template <typename Point, typename AngleCollection>
-inline std::size_t assign_cluster_indices(AngleCollection& sorted, Point const& origin)
+template <typename Point, typename AngleCollection, typename SideStrategy>
+inline std::size_t assign_cluster_indices(AngleCollection& sorted, Point const& origin,
+ SideStrategy const& strategy)
{
// Assign same cluster_index for all turns in same direction
BOOST_GEOMETRY_ASSERT(boost::size(sorted) >= 4u);
- angle_equal_to<Point> comparator(origin);
+ angle_equal_to<Point, SideStrategy> comparator(origin, strategy);
typename boost::range_iterator<AngleCollection>::type it = sorted.begin();
std::size_t cluster_index = 0;