]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/boost/geometry/formulas/eccentricity_sqr.hpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / boost / geometry / formulas / eccentricity_sqr.hpp
CommitLineData
7c673cae
FG
1// Boost.Geometry
2
92f5a8d4 3// Copyright (c) 2016, 2018 Oracle and/or its affiliates.
7c673cae
FG
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
b32b8144
FG
11#ifndef BOOST_GEOMETRY_FORMULAS_ECCENCRICITY_SQR_HPP
12#define BOOST_GEOMETRY_FORMULAS_ECCENCRICITY_SQR_HPP
7c673cae 13
92f5a8d4
TL
14#include <boost/geometry/algorithms/not_implemented.hpp>
15
7c673cae
FG
16#include <boost/geometry/core/radius.hpp>
17#include <boost/geometry/core/tag.hpp>
18#include <boost/geometry/core/tags.hpp>
19
92f5a8d4 20#include <boost/geometry/util/math.hpp>
7c673cae
FG
21
22namespace boost { namespace geometry
23{
24
25#ifndef DOXYGEN_NO_DISPATCH
b32b8144 26namespace formula_dispatch
7c673cae
FG
27{
28
29template <typename ResultType, typename Geometry, typename Tag = typename tag<Geometry>::type>
b32b8144 30struct eccentricity_sqr
7c673cae
FG
31 : not_implemented<Tag>
32{};
33
34template <typename ResultType, typename Geometry>
b32b8144 35struct eccentricity_sqr<ResultType, Geometry, srs_sphere_tag>
7c673cae
FG
36{
37 static inline ResultType apply(Geometry const& /*geometry*/)
38 {
39 return ResultType(0);
40 }
41};
42
43template <typename ResultType, typename Geometry>
b32b8144 44struct eccentricity_sqr<ResultType, Geometry, srs_spheroid_tag>
7c673cae
FG
45{
46 static inline ResultType apply(Geometry const& geometry)
47 {
b32b8144
FG
48 // 1 - (b / a)^2
49 return ResultType(1) - math::sqr(ResultType(get_radius<2>(geometry))
50 / ResultType(get_radius<0>(geometry)));
7c673cae
FG
51 }
52};
53
b32b8144 54} // namespace formula_dispatch
7c673cae
FG
55#endif // DOXYGEN_NO_DISPATCH
56
57#ifndef DOXYGEN_NO_DETAIL
b32b8144 58namespace formula
7c673cae
FG
59{
60
61template <typename ResultType, typename Geometry>
b32b8144 62ResultType eccentricity_sqr(Geometry const& geometry)
7c673cae 63{
b32b8144 64 return formula_dispatch::eccentricity_sqr<ResultType, Geometry>::apply(geometry);
7c673cae
FG
65}
66
b32b8144 67} // namespace formula
7c673cae
FG
68#endif // DOXYGEN_NO_DETAIL
69
70}} // namespace boost::geometry
71
b32b8144 72#endif // BOOST_GEOMETRY_FORMULAS_ECCENCRICITY_SQR_HPP