123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 |
- #ifndef BOOST_GEOMETRY_FORMULAS_MAXIMUM_LATITUDE_HPP
- #define BOOST_GEOMETRY_FORMULAS_MAXIMUM_LATITUDE_HPP
- #include <boost/geometry/core/static_assert.hpp>
- #include <boost/geometry/formulas/flattening.hpp>
- #include <boost/geometry/formulas/spherical.hpp>
- namespace boost { namespace geometry { namespace formula
- {
- template <typename CT>
- class vertex_latitude_on_sphere
- {
- public:
- template<typename T1, typename T2>
- static inline CT apply(T1 const& lat1,
- T2 const& alp1)
- {
- return std::acos( math::abs(cos(lat1) * sin(alp1)) );
- }
- };
- template <typename CT>
- class vertex_latitude_on_spheroid
- {
- public:
-
- template <typename T1, typename T2, typename Spheroid>
- static inline CT apply(T1 const& lat1,
- T2 const& alp1,
- Spheroid const& spheroid)
- {
- CT const f = formula::flattening<CT>(spheroid);
- CT const one_minus_f = (CT(1) - f);
-
- CT const bet1 = atan( one_minus_f * tan(lat1) );
-
- CT const betv = vertex_latitude_on_sphere<CT>::apply(bet1, alp1);
-
- return atan( tan(betv) / one_minus_f );
- }
-
- };
- template <typename CT, typename CS_Tag>
- struct vertex_latitude
- {
- BOOST_GEOMETRY_STATIC_ASSERT_FALSE(
- "Not implemented for this coordinate system.",
- CT, CS_Tag);
- };
- template <typename CT>
- struct vertex_latitude<CT, spherical_equatorial_tag>
- : vertex_latitude_on_sphere<CT>
- {};
- template <typename CT>
- struct vertex_latitude<CT, geographic_tag>
- : vertex_latitude_on_spheroid<CT>
- {};
- }}}
- #endif
|