File indexing completed on 2025-01-18 09:35:44
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040 #ifndef BOOST_GEOMETRY_PROJECTIONS_NELL_H_HPP
0041 #define BOOST_GEOMETRY_PROJECTIONS_NELL_H_HPP
0042
0043 #include <boost/geometry/util/math.hpp>
0044
0045 #include <boost/geometry/srs/projections/impl/base_static.hpp>
0046 #include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
0047 #include <boost/geometry/srs/projections/impl/projects.hpp>
0048 #include <boost/geometry/srs/projections/impl/factory_entry.hpp>
0049
0050 namespace boost { namespace geometry
0051 {
0052
0053 namespace projections
0054 {
0055 #ifndef DOXYGEN_NO_DETAIL
0056 namespace detail { namespace nell_h
0057 {
0058
0059 static const int n_iter = 9;
0060 static const double epsilon = 1e-7;
0061
0062 template <typename T, typename Parameters>
0063 struct base_nell_h_spheroid
0064 {
0065
0066
0067 inline void fwd(Parameters const& , T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
0068 {
0069 xy_x = 0.5 * lp_lon * (1. + cos(lp_lat));
0070 xy_y = 2.0 * (lp_lat - tan(0.5 *lp_lat));
0071 }
0072
0073
0074
0075 inline void inv(Parameters const& , T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
0076 {
0077 static const T half_pi = detail::half_pi<T>();
0078
0079 T V, c, p;
0080 int i;
0081
0082 p = 0.5 * xy_y;
0083 for (i = n_iter; i ; --i) {
0084 c = cos(0.5 * lp_lat);
0085 lp_lat -= V = (lp_lat - tan(lp_lat/2) - p)/(1. - 0.5/(c*c));
0086 if (fabs(V) < epsilon)
0087 break;
0088 }
0089 if (!i) {
0090 lp_lat = p < 0. ? -half_pi : half_pi;
0091 lp_lon = 2. * xy_x;
0092 } else
0093 lp_lon = 2. * xy_x / (1. + cos(lp_lat));
0094 }
0095
0096 static inline std::string get_name()
0097 {
0098 return "nell_h_spheroid";
0099 }
0100
0101 };
0102
0103
0104 template <typename Parameters>
0105 inline void setup_nell_h(Parameters& par)
0106 {
0107 par.es = 0.;
0108 }
0109
0110 }}
0111 #endif
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124
0125 template <typename T, typename Parameters>
0126 struct nell_h_spheroid : public detail::nell_h::base_nell_h_spheroid<T, Parameters>
0127 {
0128 template <typename Params>
0129 inline nell_h_spheroid(Params const& , Parameters & par)
0130 {
0131 detail::nell_h::setup_nell_h(par);
0132 }
0133 };
0134
0135 #ifndef DOXYGEN_NO_DETAIL
0136 namespace detail
0137 {
0138
0139
0140 BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_nell_h, nell_h_spheroid)
0141
0142
0143 BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(nell_h_entry, nell_h_spheroid)
0144
0145 BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(nell_h_init)
0146 {
0147 BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(nell_h, nell_h_entry)
0148 }
0149
0150 }
0151 #endif
0152
0153 }
0154
0155 }}
0156
0157 #endif
0158