Imported Upstream version 1.72.0
[platform/upstream/boost.git] / boost / geometry / strategies / intersection_strategies.hpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2
3 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
4
5 // This file was modified by Oracle on 2016, 2017.
6 // Modifications copyright (c) 2016-2017, Oracle and/or its affiliates.
7 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
8
9 // Use, modification and distribution is subject to the Boost Software License,
10 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
11 // http://www.boost.org/LICENSE_1_0.txt)
12
13 #ifndef BOOST_GEOMETRY_STRATEGIES_INTERSECTION_HPP
14 #define BOOST_GEOMETRY_STRATEGIES_INTERSECTION_HPP
15
16
17 #include <boost/geometry/core/point_type.hpp>
18 #include <boost/geometry/geometries/segment.hpp>
19
20 #include <boost/geometry/policies/relate/intersection_points.hpp>
21 #include <boost/geometry/policies/relate/direction.hpp>
22 #include <boost/geometry/policies/relate/tupled.hpp>
23
24 #include <boost/geometry/strategies/intersection.hpp>
25 #include <boost/geometry/strategies/intersection_result.hpp>
26 #include <boost/geometry/strategies/side.hpp>
27
28 #include <boost/geometry/strategies/cartesian/intersection.hpp>
29 #include <boost/geometry/strategies/cartesian/side_by_triangle.hpp>
30 #include <boost/geometry/strategies/spherical/intersection.hpp>
31 #include <boost/geometry/strategies/spherical/ssf.hpp>
32
33 #include <boost/geometry/policies/robustness/segment_ratio_type.hpp>
34
35
36 namespace boost { namespace geometry
37 {
38
39
40 /*!
41 \brief "compound strategy", containing a segment-intersection-strategy
42        and a side-strategy
43  */
44 template
45 <
46     typename Tag,
47     typename Geometry1,
48     typename Geometry2,
49     typename IntersectionPoint,
50     typename RobustPolicy,
51     typename CalculationType = void
52 >
53 struct intersection_strategies
54 {
55 private :
56     // for development BOOST_STATIC_ASSERT((! boost::is_same<RobustPolicy, void>::type::value));
57
58     typedef typename geometry::point_type<Geometry1>::type point1_type;
59     typedef typename geometry::point_type<Geometry2>::type point2_type;
60     typedef typename model::referring_segment<point1_type const> segment1_type;
61     typedef typename model::referring_segment<point2_type const> segment2_type;
62
63     typedef segment_intersection_points
64     <
65         IntersectionPoint,
66         typename detail::segment_ratio_type
67         <
68             IntersectionPoint, RobustPolicy
69         >::type
70     > ip_type;
71
72 public:
73     typedef policies::relate::segments_tupled
74         <
75             policies::relate::segments_intersection_points
76                 <
77                     ip_type
78                 > ,
79             policies::relate::segments_direction
80         > intersection_policy_type;
81
82     typedef typename strategy::intersection::services::default_strategy
83             <
84                 Tag,
85                 CalculationType
86             >::type segment_intersection_strategy_type;
87
88     typedef typename strategy::side::services::default_strategy
89         <
90             Tag,
91             CalculationType
92         >::type side_strategy_type;
93
94     typedef RobustPolicy rescale_policy_type;
95 };
96
97
98 }} // namespace boost::geometry
99
100
101 #endif // BOOST_GEOMETRY_STRATEGIES_INTERSECTION_HPP