]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/boost/geometry/algorithms/detail/envelope/segment.hpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / boost / geometry / algorithms / detail / envelope / segment.hpp
CommitLineData
7c673cae
FG
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
92f5a8d4
TL
7// This file was modified by Oracle on 2015-2018.
8// Modifications copyright (c) 2015-2018, Oracle and/or its affiliates.
7c673cae 9
b32b8144 10// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
7c673cae
FG
11// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
12// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
13
14// Distributed under the Boost Software License, Version 1.0.
15// (See accompanying file LICENSE_1_0.txt or copy at
16// http://www.boost.org/LICENSE_1_0.txt)
17
18#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_ENVELOPE_SEGMENT_HPP
19#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_ENVELOPE_SEGMENT_HPP
20
21#include <cstddef>
7c673cae 22
7c673cae
FG
23#include <boost/geometry/core/tags.hpp>
24
7c673cae 25#include <boost/geometry/algorithms/detail/assign_indexed_point.hpp>
7c673cae
FG
26#include <boost/geometry/algorithms/dispatch/envelope.hpp>
27
92f5a8d4
TL
28// For backward compatibility
29#include <boost/geometry/strategies/cartesian/envelope_segment.hpp>
30#include <boost/geometry/strategies/spherical/envelope_segment.hpp>
31#include <boost/geometry/strategies/geographic/envelope_segment.hpp>
32
7c673cae
FG
33namespace boost { namespace geometry
34{
35
36#ifndef DOXYGEN_NO_DETAIL
37namespace detail { namespace envelope
38{
39
7c673cae 40template <std::size_t DimensionCount>
b32b8144
FG
41struct envelope_segment
42{
43 template <typename Point, typename Box, typename Strategy>
44 static inline void apply(Point const& p1,
45 Point const& p2,
46 Box& mbr,
47 Strategy const& strategy)
48 {
b32b8144 49 strategy.apply(p1, p2, mbr);
b32b8144 50 }
7c673cae 51
b32b8144
FG
52 template <typename Segment, typename Box, typename Strategy>
53 static inline void apply(Segment const& segment, Box& mbr,
54 Strategy const& strategy)
55 {
56 typename point_type<Segment>::type p[2];
57 detail::assign_point_from_index<0>(segment, p[0]);
58 detail::assign_point_from_index<1>(segment, p[1]);
59 apply(p[0], p[1], mbr, strategy);
60 }
61};
7c673cae
FG
62
63}} // namespace detail::envelope
64#endif // DOXYGEN_NO_DETAIL
65
66
67#ifndef DOXYGEN_NO_DISPATCH
68namespace dispatch
69{
70
71
b32b8144
FG
72template <typename Segment>
73struct envelope<Segment, segment_tag>
7c673cae 74{
b32b8144
FG
75 template <typename Box, typename Strategy>
76 static inline void apply(Segment const& segment,
77 Box& mbr,
78 Strategy const& strategy)
7c673cae
FG
79 {
80 typename point_type<Segment>::type p[2];
81 detail::assign_point_from_index<0>(segment, p[0]);
82 detail::assign_point_from_index<1>(segment, p[1]);
83 detail::envelope::envelope_segment
84 <
b32b8144
FG
85 dimension<Segment>::value
86 >::apply(p[0], p[1], mbr, strategy);
7c673cae
FG
87 }
88};
89
7c673cae
FG
90} // namespace dispatch
91#endif // DOXYGEN_NO_DISPATCH
92
93}} // namespace boost::geometry
94
95#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_ENVELOPE_SEGMENT_HPP