// 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-2014. // Modifications copyright (c) 2013-2014, 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 { static inline bool apply(Segment1 const& segment1, Segment2 const& segment2) { typedef typename point_type::type point_type; // We don't need to rescale to detect disjointness typedef no_rescale_policy rescale_policy_type; rescale_policy_type robust_policy; typedef segment_intersection_points < point_type, typename segment_ratio_type < point_type, rescale_policy_type >::type > intersection_return_type; intersection_return_type is = strategy::intersection::relate_cartesian_segments < policies::relate::segments_intersection_points < intersection_return_type > >::apply(segment1, segment2, robust_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; // We don't assign extra info: template < typename Info, typename Point1, typename Point2, typename IntersectionInfo, typename DirInfo > static inline void apply(Info& , Point1 const& , Point2 const&, IntersectionInfo const&, DirInfo const&) {} }; template struct disjoint_linear { static inline bool apply(Geometry1 const& geometry1, Geometry2 const& geometry2) { typedef typename geometry::point_type::type point_type; typedef detail::no_rescale_policy rescale_policy_type; typedef overlay::turn_info < point_type, typename segment_ratio_type::type > turn_info; std::deque turns; static const bool reverse1 = overlay::do_reverse::value>::value; // should be false static const bool reverse2 = overlay::do_reverse::value>::value; // should be false // Specify two policies: // 1) Stop at any intersection // 2) In assignment, include also degenerate points (which are normally skipped) disjoint_interrupt_policy policy; rescale_policy_type robust_policy; geometry::get_turns < reverse1, reverse2, assign_disjoint_policy >(geometry1, geometry2, robust_policy, turns, policy); return !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