123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169 |
- #ifndef BOOST_GEOMETRY_PROJECTIONS_ECK4_HPP
- #define BOOST_GEOMETRY_PROJECTIONS_ECK4_HPP
- #include <boost/geometry/srs/projections/impl/base_static.hpp>
- #include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
- #include <boost/geometry/srs/projections/impl/projects.hpp>
- #include <boost/geometry/srs/projections/impl/factory_entry.hpp>
- #include <boost/geometry/srs/projections/impl/aasincos.hpp>
- namespace boost { namespace geometry
- {
- namespace projections
- {
- #ifndef DOXYGEN_NO_DETAIL
- namespace detail { namespace eck4
- {
- static const double C_x = .42223820031577120149;
- static const double C_y = 1.32650042817700232218;
- static const double RC_y = .75386330736002178205;
- static const double C_p = 3.57079632679489661922;
- static const double RC_p = .28004957675577868795;
- static const double epsilon = 1e-7;
- static const int n_iter = 6;
- template <typename T, typename Parameters>
- struct base_eck4_spheroid
- {
-
-
- inline void fwd(Parameters const& , T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
- {
- T p, V, s, c;
- int i;
- p = C_p * sin(lp_lat);
- V = lp_lat * lp_lat;
- lp_lat *= 0.895168 + V * ( 0.0218849 + V * 0.00826809 );
- for (i = n_iter; i ; --i) {
- c = cos(lp_lat);
- s = sin(lp_lat);
- lp_lat -= V = (lp_lat + s * (c + 2.) - p) /
- (1. + c * (c + 2.) - s * s);
- if (fabs(V) < epsilon)
- break;
- }
- if (!i) {
- xy_x = C_x * lp_lon;
- xy_y = lp_lat < 0. ? -C_y : C_y;
- } else {
- xy_x = C_x * lp_lon * (1. + cos(lp_lat));
- xy_y = C_y * sin(lp_lat);
- }
- }
-
-
- inline void inv(Parameters const& , T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
- {
- T c;
- lp_lat = aasin(xy_y * RC_y);
- lp_lon = xy_x / (C_x * (1. + (c = cos(lp_lat))));
- lp_lat = aasin((lp_lat + sin(lp_lat) * (c + 2.)) * RC_p);
- }
- static inline std::string get_name()
- {
- return "eck4_spheroid";
- }
- };
-
- template <typename Parameters>
- inline void setup_eck4(Parameters& par)
- {
- par.es = 0.;
- }
- }}
- #endif
-
- template <typename T, typename Parameters>
- struct eck4_spheroid : public detail::eck4::base_eck4_spheroid<T, Parameters>
- {
- template <typename Params>
- inline eck4_spheroid(Params const& , Parameters & par)
- {
- detail::eck4::setup_eck4(par);
- }
- };
- #ifndef DOXYGEN_NO_DETAIL
- namespace detail
- {
-
- BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_eck4, eck4_spheroid)
-
- BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(eck4_entry, eck4_spheroid)
- BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(eck4_init)
- {
- BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(eck4, eck4_entry);
- }
- }
- #endif
- }
- }}
- #endif
|