1 // Boost.Geometry
2 
3 // Copyright (c) 2017 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_FORMULAS_UNIT_SPHEROID_HPP
12 #define BOOST_GEOMETRY_FORMULAS_UNIT_SPHEROID_HPP
13 
14 #include <boost/geometry/core/radius.hpp>
15 
16 namespace boost { namespace geometry
17 {
18 
19 #ifndef DOXYGEN_NO_DETAIL
20 namespace formula
21 {
22 
23 template <typename ResultType, typename Spheroid>
unit_spheroid_b(Spheroid const & spheroid)24 inline ResultType unit_spheroid_b(Spheroid const& spheroid)
25 {
26     return ResultType(get_radius<2>(spheroid))
27          / ResultType(get_radius<0>(spheroid));
28 }
29 
30 template <typename ResultSpheroid, typename Spheroid>
unit_spheroid(Spheroid const & spheroid)31 inline ResultSpheroid unit_spheroid(Spheroid const& spheroid)
32 {
33     typedef typename radius_type<ResultSpheroid>::type radius_t;
34     return ResultSpheroid(radius_t(1),
35                           unit_spheroid_b<radius_t>(spheroid));
36 }
37 
38 } // namespace formula
39 #endif // DOXYGEN_NO_DETAIL
40 
41 }} // namespace boost::geometry
42 
43 #endif // BOOST_GEOMETRY_FORMULAS_UNIT_SPHEROID_HPP
44