unit_spheroid.hpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // Boost.Geometry
  2. // Copyright (c) 2017 Oracle and/or its affiliates.
  3. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
  4. // Use, modification and distribution is subject to the Boost Software License,
  5. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  6. // http://www.boost.org/LICENSE_1_0.txt)
  7. #ifndef BOOST_GEOMETRY_FORMULAS_UNIT_SPHEROID_HPP
  8. #define BOOST_GEOMETRY_FORMULAS_UNIT_SPHEROID_HPP
  9. #include <boost/geometry/core/radius.hpp>
  10. namespace boost { namespace geometry
  11. {
  12. #ifndef DOXYGEN_NO_DETAIL
  13. namespace formula
  14. {
  15. template <typename ResultType, typename Spheroid>
  16. inline ResultType unit_spheroid_b(Spheroid const& spheroid)
  17. {
  18. return ResultType(get_radius<2>(spheroid))
  19. / ResultType(get_radius<0>(spheroid));
  20. }
  21. template <typename ResultSpheroid, typename Spheroid>
  22. inline ResultSpheroid unit_spheroid(Spheroid const& spheroid)
  23. {
  24. typedef typename radius_type<ResultSpheroid>::type radius_t;
  25. return ResultSpheroid(radius_t(1),
  26. unit_spheroid_b<radius_t>(spheroid));
  27. }
  28. } // namespace formula
  29. #endif // DOXYGEN_NO_DETAIL
  30. }} // namespace boost::geometry
  31. #endif // BOOST_GEOMETRY_FORMULAS_UNIT_SPHEROID_HPP