File indexing completed on 2025-01-18 09:35:46
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
0041
0042 #ifndef BOOST_GEOMETRY_PROJECTIONS_ROUSS_HPP
0043 #define BOOST_GEOMETRY_PROJECTIONS_ROUSS_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 #include <boost/geometry/srs/projections/impl/proj_mdist.hpp>
0050
0051 namespace boost { namespace geometry
0052 {
0053
0054 namespace projections
0055 {
0056 #ifndef DOXYGEN_NO_DETAIL
0057 namespace detail { namespace rouss
0058 {
0059 template <typename T>
0060 struct par_rouss
0061 {
0062 T s0;
0063 T A1, A2, A3, A4, A5, A6;
0064 T B1, B2, B3, B4, B5, B6, B7, B8;
0065 T C1, C2, C3, C4, C5, C6, C7, C8;
0066 T D1, D2, D3, D4, D5, D6, D7, D8, D9, D10, D11;
0067 mdist<T> en;
0068 };
0069
0070 template <typename T, typename Parameters>
0071 struct base_rouss_ellipsoid
0072 {
0073 par_rouss<T> m_proj_parm;
0074
0075
0076
0077 inline void fwd(Parameters const& par, T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
0078 {
0079 T s, al, cp, sp, al2, s2;
0080
0081 cp = cos(lp_lat);
0082 sp = sin(lp_lat);
0083 s = proj_mdist(lp_lat, sp, cp, this->m_proj_parm.en) - this->m_proj_parm.s0;
0084 s2 = s * s;
0085 al = lp_lon * cp / sqrt(1. - par.es * sp * sp);
0086 al2 = al * al;
0087 xy_x = par.k0 * al*(1.+s2*(this->m_proj_parm.A1+s2*this->m_proj_parm.A4)-al2*(this->m_proj_parm.A2+s*this->m_proj_parm.A3+s2*this->m_proj_parm.A5
0088 +al2*this->m_proj_parm.A6));
0089 xy_y = par.k0 * (al2*(this->m_proj_parm.B1+al2*this->m_proj_parm.B4)+
0090 s*(1.+al2*(this->m_proj_parm.B3-al2*this->m_proj_parm.B6)+s2*(this->m_proj_parm.B2+s2*this->m_proj_parm.B8)+
0091 s*al2*(this->m_proj_parm.B5+s*this->m_proj_parm.B7)));
0092 }
0093
0094
0095
0096 inline void inv(Parameters const& par, T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
0097 {
0098 T s, al, x = xy_x / par.k0, y = xy_y / par.k0, x2, y2;
0099
0100 x2 = x * x;
0101 y2 = y * y;
0102 al = x*(1.-this->m_proj_parm.C1*y2+x2*(this->m_proj_parm.C2+this->m_proj_parm.C3*y-this->m_proj_parm.C4*x2+this->m_proj_parm.C5*y2-this->m_proj_parm.C7*x2*y)
0103 +y2*(this->m_proj_parm.C6*y2-this->m_proj_parm.C8*x2*y));
0104 s = this->m_proj_parm.s0 + y*(1.+y2*(-this->m_proj_parm.D2+this->m_proj_parm.D8*y2))+
0105 x2*(-this->m_proj_parm.D1+y*(-this->m_proj_parm.D3+y*(-this->m_proj_parm.D5+y*(-this->m_proj_parm.D7+y*this->m_proj_parm.D11)))+
0106 x2*(this->m_proj_parm.D4+y*(this->m_proj_parm.D6+y*this->m_proj_parm.D10)-x2*this->m_proj_parm.D9));
0107 lp_lat=proj_inv_mdist(s, this->m_proj_parm.en);
0108 s = sin(lp_lat);
0109 lp_lon=al * sqrt(1. - par.es * s * s)/cos(lp_lat);
0110 }
0111
0112 static inline std::string get_name()
0113 {
0114 return "rouss_ellipsoid";
0115 }
0116
0117 };
0118
0119
0120 template <typename Parameters, typename T>
0121 inline void setup_rouss(Parameters const& par, par_rouss<T>& proj_parm)
0122 {
0123 T N0, es2, t, t2, R_R0_2, R_R0_4;
0124
0125 if (!proj_mdist_ini(par.es, proj_parm.en))
0126 BOOST_THROW_EXCEPTION( projection_exception(0) );
0127
0128 es2 = sin(par.phi0);
0129 proj_parm.s0 = proj_mdist(par.phi0, es2, cos(par.phi0), proj_parm.en);
0130 t = 1. - (es2 = par.es * es2 * es2);
0131 N0 = 1./sqrt(t);
0132 R_R0_2 = t * t / par.one_es;
0133 R_R0_4 = R_R0_2 * R_R0_2;
0134 t = tan(par.phi0);
0135 t2 = t * t;
0136 proj_parm.C1 = proj_parm.A1 = R_R0_2 / 4.;
0137 proj_parm.C2 = proj_parm.A2 = R_R0_2 * (2 * t2 - 1. - 2. * es2) / 12.;
0138 proj_parm.A3 = R_R0_2 * t * (1. + 4. * t2)/ ( 12. * N0);
0139 proj_parm.A4 = R_R0_4 / 24.;
0140 proj_parm.A5 = R_R0_4 * ( -1. + t2 * (11. + 12. * t2))/24.;
0141 proj_parm.A6 = R_R0_4 * ( -2. + t2 * (11. - 2. * t2))/240.;
0142 proj_parm.B1 = t / (2. * N0);
0143 proj_parm.B2 = R_R0_2 / 12.;
0144 proj_parm.B3 = R_R0_2 * (1. + 2. * t2 - 2. * es2)/4.;
0145 proj_parm.B4 = R_R0_2 * t * (2. - t2)/(24. * N0);
0146 proj_parm.B5 = R_R0_2 * t * (5. + 4.* t2)/(8. * N0);
0147 proj_parm.B6 = R_R0_4 * (-2. + t2 * (-5. + 6. * t2))/48.;
0148 proj_parm.B7 = R_R0_4 * (5. + t2 * (19. + 12. * t2))/24.;
0149 proj_parm.B8 = R_R0_4 / 120.;
0150 proj_parm.C3 = R_R0_2 * t * (1. + t2)/(3. * N0);
0151 proj_parm.C4 = R_R0_4 * (-3. + t2 * (34. + 22. * t2))/240.;
0152 proj_parm.C5 = R_R0_4 * (4. + t2 * (13. + 12. * t2))/24.;
0153 proj_parm.C6 = R_R0_4 / 16.;
0154 proj_parm.C7 = R_R0_4 * t * (11. + t2 * (33. + t2 * 16.))/(48. * N0);
0155 proj_parm.C8 = R_R0_4 * t * (1. + t2 * 4.)/(36. * N0);
0156 proj_parm.D1 = t / (2. * N0);
0157 proj_parm.D2 = R_R0_2 / 12.;
0158 proj_parm.D3 = R_R0_2 * (2 * t2 + 1. - 2. * es2) / 4.;
0159 proj_parm.D4 = R_R0_2 * t * (1. + t2)/(8. * N0);
0160 proj_parm.D5 = R_R0_2 * t * (1. + t2 * 2.)/(4. * N0);
0161 proj_parm.D6 = R_R0_4 * (1. + t2 * (6. + t2 * 6.))/16.;
0162 proj_parm.D7 = R_R0_4 * t2 * (3. + t2 * 4.)/8.;
0163 proj_parm.D8 = R_R0_4 / 80.;
0164 proj_parm.D9 = R_R0_4 * t * (-21. + t2 * (178. - t2 * 26.))/720.;
0165 proj_parm.D10 = R_R0_4 * t * (29. + t2 * (86. + t2 * 48.))/(96. * N0);
0166 proj_parm.D11 = R_R0_4 * t * (37. + t2 * 44.)/(96. * N0);
0167 }
0168
0169 }}
0170 #endif
0171
0172
0173
0174
0175
0176
0177
0178
0179
0180
0181
0182
0183
0184 template <typename T, typename Parameters>
0185 struct rouss_ellipsoid : public detail::rouss::base_rouss_ellipsoid<T, Parameters>
0186 {
0187 template <typename Params>
0188 inline rouss_ellipsoid(Params const& , Parameters const& par)
0189 {
0190 detail::rouss::setup_rouss(par, this->m_proj_parm);
0191 }
0192 };
0193
0194 #ifndef DOXYGEN_NO_DETAIL
0195 namespace detail
0196 {
0197
0198
0199 BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_rouss, rouss_ellipsoid)
0200
0201
0202 BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(rouss_entry, rouss_ellipsoid)
0203
0204 BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(rouss_init)
0205 {
0206 BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(rouss, rouss_entry)
0207 }
0208
0209 }
0210 #endif
0211
0212 }
0213
0214 }}
0215
0216 #endif
0217