123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- #ifndef BOOST_GEOMETRY_PROJECTIONS_FAHEY_HPP
- #define BOOST_GEOMETRY_PROJECTIONS_FAHEY_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 fahey
- {
- static const double tolerance = 1e-6;
- template <typename T, typename Parameters>
- struct base_fahey_spheroid
- {
-
-
- inline void fwd(Parameters const& , T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
- {
- xy_x = tan(0.5 * lp_lat);
- xy_y = 1.819152 * xy_x;
- xy_x = 0.819152 * lp_lon * asqrt(1 - xy_x * xy_x);
- }
-
-
- inline void inv(Parameters const& , T const& xy_x, T xy_y, T& lp_lon, T& lp_lat) const
- {
- xy_y /= 1.819152;
- lp_lat = 2. * atan(xy_y);
- xy_y = 1. - xy_y * xy_y;
- lp_lon = fabs(xy_y) < tolerance ? 0. : xy_x / (0.819152 * sqrt(xy_y));
- }
- static inline std::string get_name()
- {
- return "fahey_spheroid";
- }
- };
-
- template <typename Parameters>
- inline void setup_fahey(Parameters& par)
- {
- par.es = 0.;
- }
- }}
- #endif
-
- template <typename T, typename Parameters>
- struct fahey_spheroid : public detail::fahey::base_fahey_spheroid<T, Parameters>
- {
- template <typename Params>
- inline fahey_spheroid(Params const& , Parameters & par)
- {
- detail::fahey::setup_fahey(par);
- }
- };
- #ifndef DOXYGEN_NO_DETAIL
- namespace detail
- {
-
- BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_fahey, fahey_spheroid)
-
- BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(fahey_entry, fahey_spheroid)
- BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(fahey_init)
- {
- BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(fahey, fahey_entry);
- }
- }
- #endif
- }
- }}
- #endif
|