// Boost.Geometry (aka GGL, Generic Geometry Library) // Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2014 Bruno Lalande, Paris, France. // Copyright (c) 2009-2014 Mateusz Loskot, London, UK. // Copyright (c) 2013-2014 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2013-2017. // Modifications copyright (c) 2013-2017, Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. // 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) #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_DISJOINT_LINEAR_LINEAR_HPP #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_DISJOINT_LINEAR_LINEAR_HPP #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace boost { namespace geometry { #ifndef DOXYGEN_NO_DETAIL namespace detail { namespace disjoint { template struct disjoint_segment { template static inline bool apply(Segment1 const& segment1, Segment2 const& segment2, Strategy const& strategy) { typedef typename point_type::type point_type; typedef segment_intersection_points intersection_return_type; typedef policies::relate::segments_intersection_points < intersection_return_type > intersection_policy; detail::segment_as_subrange sub_range1(segment1); detail::segment_as_subrange sub_range2(segment2); intersection_return_type is = strategy.apply(sub_range1, sub_range2, intersection_policy()); return is.count == 0; } }; struct assign_disjoint_policy { // We want to include all points: static bool const include_no_turn = true; static bool const include_degenerate = true; static bool const include_opposite = true; }; template struct disjoint_linear { template static inline bool apply(Geometry1 const& geometry1, Geometry2 const& geometry2, Strategy const& strategy) { typedef typename geometry::point_type::type point_type; typedef geometry::segment_ratio < typename coordinate_type::type > ratio_type; typedef overlay::turn_info < point_type, ratio_type, typename detail::get_turns::turn_operation_type < Geometry1, Geometry2, ratio_type >::type > turn_info_type; std::deque turns; // Specify two policies: // 1) Stop at any intersection // 2) In assignment, include also degenerate points (which are normally skipped) disjoint_interrupt_policy interrupt_policy; dispatch::get_turns < typename geometry::tag::type, typename geometry::tag::type, Geometry1, Geometry2, overlay::do_reverse::value>::value, // should be false overlay::do_reverse::value>::value, // should be false detail::get_turns::get_turn_info_type < Geometry1, Geometry2, assign_disjoint_policy > >::apply(0, geometry1, 1, geometry2, strategy, detail::no_rescale_policy(), turns, interrupt_policy); return !interrupt_policy.has_intersections; } }; }} // namespace detail::disjoint #endif // DOXYGEN_NO_DETAIL #ifndef DOXYGEN_NO_DISPATCH namespace dispatch { template struct disjoint : detail::disjoint::disjoint_linear {}; template struct disjoint : detail::disjoint::disjoint_segment {}; } // namespace dispatch #endif // DOXYGEN_NO_DISPATCH }} // namespace boost::geometry #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_DISJOINT_LINEAR_LINEAR_HPP