]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/include/boost/geometry/algorithms/detail/expand/segment.hpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / geometry / include / boost / geometry / algorithms / detail / expand / segment.hpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2
3 // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
4 // Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
5 // Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
6 // Copyright (c) 2014-2015 Samuel Debionne, Grenoble, France.
7
8 // This file was modified by Oracle on 2015.
9 // Modifications copyright (c) 2015, Oracle and/or its affiliates.
10
11 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
12
13 // Distributed under the Boost Software License, Version 1.0.
14 // (See accompanying file LICENSE_1_0.txt or copy at
15 // http://www.boost.org/LICENSE_1_0.txt)
16
17 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_EXPAND_SEGMENT_HPP
18 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_EXPAND_SEGMENT_HPP
19
20 #include <boost/mpl/assert.hpp>
21 #include <boost/type_traits/is_same.hpp>
22
23 #include <boost/geometry/core/coordinate_dimension.hpp>
24 #include <boost/geometry/core/tags.hpp>
25
26 #include <boost/geometry/algorithms/detail/envelope/box.hpp>
27 #include <boost/geometry/algorithms/detail/envelope/range_of_boxes.hpp>
28 #include <boost/geometry/algorithms/detail/envelope/segment.hpp>
29
30 #include <boost/geometry/algorithms/detail/expand/indexed.hpp>
31
32 #include <boost/geometry/algorithms/dispatch/expand.hpp>
33
34
35 namespace boost { namespace geometry
36 {
37
38 #ifndef DOXYGEN_NO_DETAIL
39 namespace detail { namespace expand
40 {
41
42
43 struct segment_on_sphere
44 {
45 template <typename Box, typename Segment>
46 static inline void apply(Box& box, Segment const& segment)
47 {
48 Box mbrs[2];
49
50 // compute the envelope of the segment
51 detail::envelope::envelope_segment_on_sphere
52 <
53 dimension<Segment>::value
54 >::apply(segment, mbrs[0]);
55
56 // normalize the box
57 detail::envelope::envelope_box_on_spheroid::apply(box, mbrs[1]);
58
59 // compute the envelope of the two boxes
60 detail::envelope::envelope_range_of_boxes::apply(mbrs, box);
61 }
62 };
63
64
65 }} // namespace detail::expand
66 #endif // DOXYGEN_NO_DETAIL
67
68 #ifndef DOXYGEN_NO_DISPATCH
69 namespace dispatch
70 {
71
72
73 template
74 <
75 typename Box, typename Segment,
76 typename StrategyLess, typename StrategyGreater,
77 typename CSTagOut, typename CSTag
78 >
79 struct expand
80 <
81 Box, Segment,
82 StrategyLess, StrategyGreater,
83 box_tag, segment_tag,
84 CSTagOut, CSTag
85 > : detail::expand::expand_indexed
86 <
87 0, dimension<Segment>::value, StrategyLess, StrategyGreater
88 >
89 {
90 BOOST_MPL_ASSERT_MSG((boost::is_same<CSTagOut, CSTag>::value),
91 COORDINATE_SYSTEMS_MUST_BE_THE_SAME,
92 (types<CSTagOut, CSTag>()));
93 };
94
95 template
96 <
97 typename Box, typename Segment,
98 typename StrategyLess, typename StrategyGreater
99 >
100 struct expand
101 <
102 Box, Segment,
103 StrategyLess, StrategyGreater,
104 box_tag, segment_tag,
105 spherical_equatorial_tag, spherical_equatorial_tag
106 > : detail::expand::segment_on_sphere
107 {};
108
109
110 } // namespace dispatch
111 #endif // DOXYGEN_NO_DISPATCH
112
113 }} // namespace boost::geometry
114
115 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_EXPAND_SEGMENT_HPP