]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/geometry/include/boost/geometry/algorithms/detail/envelope/point.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / geometry / include / boost / geometry / algorithms / detail / envelope / point.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
7// This file was modified by Oracle on 2015.
8// Modifications copyright (c) 2015, Oracle and/or its affiliates.
9
10// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
11
12// Distributed under the Boost Software License, Version 1.0.
13// (See accompanying file LICENSE_1_0.txt or copy at
14// http://www.boost.org/LICENSE_1_0.txt)
15
16#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_ENVELOPE_POINT_HPP
17#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_ENVELOPE_POINT_HPP
18
19#include <cstddef>
20
21#include <boost/geometry/core/access.hpp>
22#include <boost/geometry/core/cs.hpp>
23#include <boost/geometry/core/coordinate_dimension.hpp>
24#include <boost/geometry/core/coordinate_system.hpp>
25#include <boost/geometry/core/tags.hpp>
26
27#include <boost/geometry/views/detail/indexed_point_view.hpp>
28
29#include <boost/geometry/algorithms/detail/convert_point_to_point.hpp>
30#include <boost/geometry/algorithms/detail/normalize.hpp>
31
32#include <boost/geometry/algorithms/detail/envelope/transform_units.hpp>
33
34#include <boost/geometry/algorithms/dispatch/envelope.hpp>
35
36
37namespace boost { namespace geometry
38{
39
40#ifndef DOXYGEN_NO_DETAIL
41namespace detail { namespace envelope
42{
43
44
45template <std::size_t Dimension, std::size_t DimensionCount>
46struct envelope_one_point
47{
48 template <std::size_t Index, typename Point, typename Box>
49 static inline void apply(Point const& point, Box& mbr)
50 {
51 detail::indexed_point_view<Box, Index> box_corner(mbr);
52 detail::conversion::point_to_point
53 <
54 Point,
55 detail::indexed_point_view<Box, Index>,
56 Dimension,
57 DimensionCount
58 >::apply(point, box_corner);
59 }
60
61 template <typename Point, typename Box>
62 static inline void apply(Point const& point, Box& mbr)
63 {
64 apply<min_corner>(point, mbr);
65 apply<max_corner>(point, mbr);
66 }
67};
68
69
70struct envelope_point_on_spheroid
71{
72 template<typename Point, typename Box>
73 static inline void apply(Point const& point, Box& mbr)
74 {
75 Point normalized_point = detail::return_normalized<Point>(point);
76
77 typename point_type<Box>::type box_point;
78
79 // transform units of input point to units of a box point
80 transform_units(normalized_point, box_point);
81
82 geometry::set<min_corner, 0>(mbr, geometry::get<0>(box_point));
83 geometry::set<min_corner, 1>(mbr, geometry::get<1>(box_point));
84
85 geometry::set<max_corner, 0>(mbr, geometry::get<0>(box_point));
86 geometry::set<max_corner, 1>(mbr, geometry::get<1>(box_point));
87
88 envelope_one_point
89 <
90 2, dimension<Point>::value
91 >::apply(normalized_point, mbr);
92 }
93};
94
95
96}} // namespace detail::envelope
97#endif // DOXYGEN_NO_DETAIL
98
99#ifndef DOXYGEN_NO_DISPATCH
100namespace dispatch
101{
102
103
104template <typename Point, typename CS_Tag>
105struct envelope<Point, point_tag, CS_Tag>
106 : detail::envelope::envelope_one_point<0, dimension<Point>::value>
107{};
108
109
110template <typename Point>
111struct envelope<Point, point_tag, spherical_equatorial_tag>
112 : detail::envelope::envelope_point_on_spheroid
113{};
114
115
116template <typename Point>
117struct envelope<Point, point_tag, geographic_tag>
118 : detail::envelope::envelope_point_on_spheroid
119{};
120
121
122} // namespace dispatch
123#endif // DOXYGEN_NO_DISPATCH
124
125}} // namespace boost::geometry
126
127#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_ENVELOPE_POINT_HPP