]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/geometry/include/boost/geometry/algorithms/detail/flattening.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / geometry / include / boost / geometry / algorithms / detail / flattening.hpp
CommitLineData
7c673cae
FG
1// Boost.Geometry
2
3// Copyright (c) 2014 Oracle and/or its affiliates.
4
5// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
6
7// Use, modification and distribution is subject to the Boost Software License,
8// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
9// http://www.boost.org/LICENSE_1_0.txt)
10
11#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_FLATTENING_HPP
12#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_FLATTENING_HPP
13
14#include <boost/geometry/core/radius.hpp>
15#include <boost/geometry/core/tag.hpp>
16#include <boost/geometry/core/tags.hpp>
17
18#include <boost/geometry/algorithms/not_implemented.hpp>
19
20namespace boost { namespace geometry
21{
22
23#ifndef DOXYGEN_NO_DISPATCH
24namespace detail_dispatch
25{
26
27template <typename ResultType, typename Geometry, typename Tag = typename tag<Geometry>::type>
28struct flattening
29 : not_implemented<Tag>
30{};
31
32template <typename ResultType, typename Geometry>
33struct flattening<ResultType, Geometry, srs_sphere_tag>
34{
35 static inline ResultType apply(Geometry const& /*geometry*/)
36 {
37 return ResultType(0);
38 }
39};
40
41template <typename ResultType, typename Geometry>
42struct flattening<ResultType, Geometry, srs_spheroid_tag>
43{
44 static inline ResultType apply(Geometry const& geometry)
45 {
46 return ResultType(get_radius<0>(geometry) - get_radius<2>(geometry))
47 / ResultType(get_radius<0>(geometry));
48 }
49};
50
51} // namespace detail_dispatch
52#endif // DOXYGEN_NO_DISPATCH
53
54#ifndef DOXYGEN_NO_DETAIL
55namespace detail
56{
57
58template <typename ResultType, typename Geometry>
59ResultType flattening(Geometry const& geometry)
60{
61 return detail_dispatch::flattening<ResultType, Geometry>::apply(geometry);
62}
63
64} // namespace detail
65#endif // DOXYGEN_NO_DETAIL
66
67}} // namespace boost::geometry
68
69#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_FLATTENING_HPP