implementation.hpp 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. // Boost.Geometry (aka GGL, Generic Geometry Library)
  2. // Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands.
  3. // Copyright (c) 2008-2014 Bruno Lalande, Paris, France.
  4. // Copyright (c) 2009-2014 Mateusz Loskot, London, UK.
  5. // This file was modified by Oracle on 2013-2017.
  6. // Modifications copyright (c) 2013-2017, Oracle and/or its affiliates.
  7. // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
  8. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
  9. // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
  10. // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
  11. // Use, modification and distribution is subject to the Boost Software License,
  12. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  13. // http://www.boost.org/LICENSE_1_0.txt)
  14. #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_INTERSECTS_IMPLEMENTATION_HPP
  15. #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_INTERSECTS_IMPLEMENTATION_HPP
  16. #include <deque>
  17. #include <boost/geometry/algorithms/detail/intersects/interface.hpp>
  18. #include <boost/geometry/algorithms/detail/disjoint/implementation.hpp>
  19. #include <boost/geometry/algorithms/detail/overlay/self_turn_points.hpp>
  20. #include <boost/geometry/policies/disjoint_interrupt_policy.hpp>
  21. #include <boost/geometry/policies/robustness/no_rescale_policy.hpp>
  22. #include <boost/geometry/policies/robustness/segment_ratio_type.hpp>
  23. #include <boost/geometry/strategies/relate.hpp>
  24. namespace boost { namespace geometry
  25. {
  26. #ifndef DOXYGEN_NO_DETAIL
  27. namespace detail { namespace intersects
  28. {
  29. template <typename Geometry>
  30. struct self_intersects
  31. {
  32. static bool apply(Geometry const& geometry)
  33. {
  34. concepts::check<Geometry const>();
  35. typedef typename geometry::point_type<Geometry>::type point_type;
  36. typedef typename strategy::relate::services::default_strategy
  37. <
  38. Geometry, Geometry
  39. >::type strategy_type;
  40. typedef detail::no_rescale_policy rescale_policy_type;
  41. typedef detail::overlay::turn_info
  42. <
  43. point_type,
  44. typename segment_ratio_type<point_type, rescale_policy_type>::type
  45. > turn_info;
  46. std::deque<turn_info> turns;
  47. typedef detail::overlay::get_turn_info
  48. <
  49. detail::overlay::assign_null_policy
  50. > turn_policy;
  51. strategy_type strategy;
  52. rescale_policy_type robust_policy;
  53. detail::disjoint::disjoint_interrupt_policy policy;
  54. // TODO: skip_adjacent should be set to false
  55. detail::self_get_turn_points::get_turns
  56. <
  57. false, turn_policy
  58. >::apply(geometry, strategy, robust_policy, turns, policy, 0, true);
  59. return policy.has_intersections;
  60. }
  61. };
  62. }} // namespace detail::intersects
  63. #endif // DOXYGEN_NO_DETAIL
  64. }} // namespace boost::geometry
  65. #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_INTERSECTS_IMPLEMENTATION_HPP