implementation.hpp 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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-2020.
  6. // Modifications copyright (c) 2013-2020, 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/strategies/relate/services.hpp>
  23. namespace boost { namespace geometry
  24. {
  25. #ifndef DOXYGEN_NO_DETAIL
  26. namespace detail { namespace intersects
  27. {
  28. template <typename Geometry>
  29. struct self_intersects
  30. {
  31. static bool apply(Geometry const& geometry)
  32. {
  33. concepts::check<Geometry const>();
  34. typedef typename geometry::point_type<Geometry>::type point_type;
  35. typedef typename strategies::relate::services::default_strategy
  36. <
  37. Geometry, Geometry
  38. >::type strategy_type;
  39. typedef detail::overlay::turn_info<point_type> turn_info;
  40. std::deque<turn_info> turns;
  41. typedef detail::overlay::get_turn_info
  42. <
  43. detail::overlay::assign_null_policy
  44. > turn_policy;
  45. strategy_type strategy;
  46. detail::disjoint::disjoint_interrupt_policy policy;
  47. // TODO: skip_adjacent should be set to false
  48. detail::self_get_turn_points::get_turns
  49. <
  50. false, turn_policy
  51. >::apply(geometry, strategy, detail::no_rescale_policy(), turns, policy, 0, true);
  52. return policy.has_intersections;
  53. }
  54. };
  55. }} // namespace detail::intersects
  56. #endif // DOXYGEN_NO_DETAIL
  57. }} // namespace boost::geometry
  58. #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_INTERSECTS_IMPLEMENTATION_HPP