intersection.hpp 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. // Boost.Geometry (aka GGL, Generic Geometry Library)
  2. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
  3. // Use, modification and distribution is subject to the Boost Software License,
  4. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  5. // http://www.boost.org/LICENSE_1_0.txt)
  6. #ifndef BOOST_GEOMETRY_STRATEGIES_INTERSECTION_HPP
  7. #define BOOST_GEOMETRY_STRATEGIES_INTERSECTION_HPP
  8. #include <boost/geometry/core/point_type.hpp>
  9. #include <boost/geometry/geometries/segment.hpp>
  10. #include <boost/geometry/policies/relate/intersection_points.hpp>
  11. #include <boost/geometry/policies/relate/direction.hpp>
  12. #include <boost/geometry/policies/relate/tupled.hpp>
  13. #include <boost/geometry/strategies/side.hpp>
  14. #include <boost/geometry/strategies/intersection_result.hpp>
  15. #include <boost/geometry/strategies/cartesian/cart_intersect.hpp>
  16. #include <boost/geometry/policies/robustness/segment_ratio_type.hpp>
  17. namespace boost { namespace geometry
  18. {
  19. /*!
  20. \brief "compound strategy", containing a segment-intersection-strategy
  21. and a side-strategy
  22. */
  23. template
  24. <
  25. typename Tag,
  26. typename Geometry1,
  27. typename Geometry2,
  28. typename IntersectionPoint,
  29. typename RobustPolicy,
  30. typename CalculationType = void
  31. >
  32. struct strategy_intersection
  33. {
  34. private :
  35. // for development BOOST_STATIC_ASSERT((! boost::is_same<RobustPolicy, void>::type::value));
  36. typedef typename geometry::point_type<Geometry1>::type point1_type;
  37. typedef typename geometry::point_type<Geometry2>::type point2_type;
  38. typedef typename model::referring_segment<point1_type const> segment1_type;
  39. typedef typename model::referring_segment<point2_type const> segment2_type;
  40. typedef segment_intersection_points
  41. <
  42. IntersectionPoint,
  43. typename geometry::segment_ratio_type
  44. <
  45. IntersectionPoint, RobustPolicy
  46. >::type
  47. > ip_type;
  48. public:
  49. typedef strategy::intersection::relate_cartesian_segments
  50. <
  51. policies::relate::segments_tupled
  52. <
  53. policies::relate::segments_intersection_points
  54. <
  55. ip_type
  56. > ,
  57. policies::relate::segments_direction
  58. >,
  59. CalculationType
  60. > segment_intersection_strategy_type;
  61. typedef typename strategy::side::services::default_strategy
  62. <
  63. Tag,
  64. CalculationType
  65. >::type side_strategy_type;
  66. typedef RobustPolicy rescale_policy_type;
  67. };
  68. // Version for box_box intersection or other detail calls not needing a strategy
  69. struct strategy_intersection_empty {};
  70. }} // namespace boost::geometry
  71. #endif // BOOST_GEOMETRY_STRATEGIES_INTERSECTION_HPP