intersection.hpp 2.7 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. namespace boost { namespace geometry
  17. {
  18. // The intersection strategy is a "compound strategy",
  19. // it contains a segment-intersection-strategy
  20. // and a side-strategy
  21. /*!
  22. \tparam CalculationType \tparam_calculation
  23. */
  24. template
  25. <
  26. typename Tag,
  27. typename Geometry1,
  28. typename Geometry2,
  29. typename IntersectionPoint,
  30. typename CalculationType = void
  31. >
  32. struct strategy_intersection
  33. {
  34. private :
  35. typedef typename geometry::point_type<Geometry1>::type point1_type;
  36. typedef typename geometry::point_type<Geometry2>::type point2_type;
  37. typedef typename model::referring_segment<point1_type const> segment1_type;
  38. typedef typename model::referring_segment<point2_type const> segment2_type;
  39. typedef segment_intersection_points
  40. <
  41. IntersectionPoint
  42. > ip_type;
  43. public:
  44. typedef strategy::intersection::relate_cartesian_segments
  45. <
  46. policies::relate::segments_tupled
  47. <
  48. policies::relate::segments_intersection_points
  49. <
  50. segment1_type,
  51. segment2_type,
  52. ip_type,
  53. CalculationType
  54. > ,
  55. policies::relate::segments_direction
  56. <
  57. segment1_type,
  58. segment2_type,
  59. CalculationType
  60. >,
  61. CalculationType
  62. >,
  63. CalculationType
  64. > segment_intersection_strategy_type;
  65. typedef typename strategy::side::services::default_strategy
  66. <
  67. Tag,
  68. CalculationType
  69. >::type side_strategy_type;
  70. };
  71. }} // namespace boost::geometry
  72. #endif // BOOST_GEOMETRY_STRATEGIES_INTERSECTION_HPP