Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:35:16

0001 // Boost.Geometry (aka GGL, Generic Geometry Library)
0002 
0003 // Copyright (c) 2014-2022, Oracle and/or its affiliates.
0004 
0005 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
0006 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
0007 
0008 // Licensed under the Boost Software License version 1.0.
0009 // http://www.boost.org/users/license.html
0010 
0011 
0012 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_TURNS_REMOVE_DUPLICATE_TURNS_HPP
0013 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_TURNS_REMOVE_DUPLICATE_TURNS_HPP
0014 
0015 #include <algorithm>
0016 #include <boost/geometry/algorithms/detail/equals/point_point.hpp>
0017 
0018 namespace boost { namespace geometry
0019 {
0020 
0021 namespace detail { namespace turns
0022 {
0023 
0024 template <typename Turns, bool Enable>
0025 struct remove_duplicate_turns
0026 {
0027     template <typename Strategy>
0028     static inline void apply(Turns const&, Strategy const&) {}
0029 };
0030 
0031 
0032 
0033 template <typename Turns>
0034 struct remove_duplicate_turns<Turns, true>
0035 {
0036     template <typename Strategy>
0037     static inline void apply(Turns& turns, Strategy const& strategy)
0038     {
0039         turns.erase(
0040             std::unique(turns.begin(), turns.end(),
0041                 [&](auto const& t1, auto const& t2)
0042                 {
0043                     return detail::equals::equals_point_point(t1.point, t2.point, strategy)
0044                         && t1.operations[0].seg_id == t2.operations[0].seg_id
0045                         && t1.operations[1].seg_id == t2.operations[1].seg_id;
0046                 }),
0047             turns.end());
0048     }
0049 };
0050 
0051 
0052 
0053 }} // namespace detail::turns
0054 
0055 }} // namespect boost::geometry
0056 
0057 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_TURNS_REMOVE_DUPLICATE_TURNS_HPP