1 // Boost.Geometry (aka GGL, Generic Geometry Library)
3 // Copyright (c) 2014, Oracle and/or its affiliates.
5 // Licensed under the Boost Software License version 1.0.
6 // http://www.boost.org/users/license.html
8 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
11 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_TURNS_REMOVE_DUPLICATE_TURNS_HPP
12 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_TURNS_REMOVE_DUPLICATE_TURNS_HPP
15 #include <boost/geometry/algorithms/equals.hpp>
17 namespace boost { namespace geometry
20 namespace detail { namespace turns
23 template <typename Turns, bool Enable>
24 struct remove_duplicate_turns
26 static inline void apply(Turns&) {}
31 template <typename Turns>
32 class remove_duplicate_turns<Turns, true>
37 template <typename Turn>
38 bool operator()(Turn const& t1, Turn const& t2) const
40 return geometry::equals(t1.point, t2.point)
41 && t1.operations[0].seg_id == t2.operations[0].seg_id
42 && t1.operations[1].seg_id == t2.operations[1].seg_id;
47 static inline void apply(Turns& turns)
49 turns.erase( std::unique(turns.begin(), turns.end(),
58 }} // namespace detail::turns
60 }} // namespect boost::geometry
62 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_TURNS_REMOVE_DUPLICATE_TURNS_HPP