pj_ell_set.hpp 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601
  1. // Boost.Geometry (aka GGL, Generic Geometry Library)
  2. // This file is manually converted from PROJ4
  3. // Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
  4. // This file was modified by Oracle on 2017-2020.
  5. // Modifications copyright (c) 2017-2020, Oracle and/or its affiliates.
  6. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
  7. // Use, modification and distribution is subject to the Boost Software License,
  8. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  9. // http://www.boost.org/LICENSE_1_0.txt)
  10. // This file is converted from PROJ4, http://trac.osgeo.org/proj
  11. // PROJ4 is originally written by Gerald Evenden (then of the USGS)
  12. // PROJ4 is maintained by Frank Warmerdam
  13. // PROJ4 is converted to Geometry Library by
  14. // Barend Gehrels (Geodan, Amsterdam)
  15. // Adam Wulkiewicz
  16. // Original copyright notice:
  17. // Permission is hereby granted, free of charge, to any person obtaining a
  18. // copy of this software and associated documentation files (the "Software"),
  19. // to deal in the Software without restriction, including without limitation
  20. // the rights to use, copy, modify, merge, publish, distribute, sublicense,
  21. // and/or sell copies of the Software, and to permit persons to whom the
  22. // Software is furnished to do so, subject to the following conditions:
  23. // The above copyright notice and this permission notice shall be included
  24. // in all copies or substantial portions of the Software.
  25. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  26. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  27. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  28. // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  29. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  30. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  31. // DEALINGS IN THE SOFTWARE.
  32. #ifndef BOOST_GEOMETRY_PROJECTIONS_IMPL_PJ_ELL_SET_HPP
  33. #define BOOST_GEOMETRY_PROJECTIONS_IMPL_PJ_ELL_SET_HPP
  34. #include <string>
  35. #include <type_traits>
  36. #include <vector>
  37. #include <boost/geometry/core/static_assert.hpp>
  38. #include <boost/geometry/formulas/eccentricity_sqr.hpp>
  39. #include <boost/geometry/util/math.hpp>
  40. #include <boost/geometry/srs/projections/dpar.hpp>
  41. #include <boost/geometry/srs/projections/impl/pj_datum_set.hpp>
  42. #include <boost/geometry/srs/projections/impl/pj_ellps.hpp>
  43. #include <boost/geometry/srs/projections/impl/pj_param.hpp>
  44. #include <boost/geometry/srs/projections/proj4.hpp>
  45. #include <boost/geometry/srs/projections/spar.hpp>
  46. namespace boost { namespace geometry { namespace projections {
  47. namespace detail {
  48. /* set ellipsoid parameters a and es */
  49. template <typename T>
  50. inline T SIXTH() { return .1666666666666666667; } /* 1/6 */
  51. template <typename T>
  52. inline T RA4() { return .04722222222222222222; } /* 17/360 */
  53. template <typename T>
  54. inline T RA6() { return .02215608465608465608; } /* 67/3024 */
  55. template <typename T>
  56. inline T RV4() { return .06944444444444444444; } /* 5/72 */
  57. template <typename T>
  58. inline T RV6() { return .04243827160493827160; } /* 55/1296 */
  59. template <typename T>
  60. inline T pj_ell_b_to_es(T const& a, T const& b)
  61. {
  62. return 1. - (b * b) / (a * a);
  63. }
  64. /************************************************************************/
  65. /* pj_ell_init_ellps() */
  66. /************************************************************************/
  67. // Originally a part of pj_ell_set()
  68. template <typename T>
  69. inline bool pj_ell_init_ellps(srs::detail::proj4_parameters const& params, T &a, T &b)
  70. {
  71. /* check if ellps present and temporarily append its values to pl */
  72. std::string name = pj_get_param_s(params, "ellps");
  73. if (! name.empty())
  74. {
  75. const pj_ellps_type<T>* pj_ellps = pj_get_ellps<T>().first;
  76. const int n = pj_get_ellps<T>().second;
  77. int index = -1;
  78. for (int i = 0; i < n && index == -1; i++)
  79. {
  80. if(pj_ellps[i].id == name)
  81. {
  82. index = i;
  83. }
  84. }
  85. if (index == -1) {
  86. BOOST_THROW_EXCEPTION( projection_exception(error_unknown_ellp_param) );
  87. }
  88. pj_ellps_type<T> const& pj_ellp = pj_ellps[index];
  89. a = pj_ellp.a;
  90. b = pj_ellp.b;
  91. return true;
  92. }
  93. return false;
  94. }
  95. template <typename T>
  96. inline bool pj_ell_init_ellps(srs::dpar::parameters<T> const& params, T &a, T &b)
  97. {
  98. /* check if ellps present and temporarily append its values to pl */
  99. typename srs::dpar::parameters<T>::const_iterator
  100. it = pj_param_find(params, srs::dpar::ellps);
  101. if (it != params.end())
  102. {
  103. if (it->template is_value_set<int>())
  104. {
  105. const pj_ellps_type<T>* pj_ellps = pj_get_ellps<T>().first;
  106. const int n = pj_get_ellps<T>().second;
  107. int i = it->template get_value<int>();
  108. if (i < 0 || i >= n) {
  109. BOOST_THROW_EXCEPTION( projection_exception(error_unknown_ellp_param) );
  110. }
  111. pj_ellps_type<T> const& pj_ellp = pj_ellps[i];
  112. a = pj_ellp.a;
  113. b = pj_ellp.b;
  114. }
  115. else if (it->template is_value_set<T>())
  116. {
  117. a = it->template get_value<T>();
  118. b = a;
  119. }
  120. else if (it->template is_value_set<srs::spheroid<T> >())
  121. {
  122. srs::spheroid<T> const& s = it->template get_value<srs::spheroid<T> >();
  123. a = geometry::get_radius<0>(s);
  124. b = geometry::get_radius<2>(s);
  125. }
  126. else
  127. {
  128. BOOST_THROW_EXCEPTION( projection_exception(error_unknown_ellp_param) );
  129. }
  130. return true;
  131. }
  132. return false;
  133. }
  134. template
  135. <
  136. typename Params,
  137. int I = geometry::tuples::find_index_if
  138. <
  139. Params,
  140. srs::spar::detail::is_param_tr<srs::spar::detail::ellps_traits>::pred
  141. >::value,
  142. int N = geometry::tuples::size<Params>::value
  143. >
  144. struct pj_ell_init_ellps_static
  145. {
  146. template <typename T>
  147. static bool apply(Params const& params, T &a, T &b)
  148. {
  149. typedef typename geometry::tuples::element<I, Params>::type param_type;
  150. typedef srs::spar::detail::ellps_traits<param_type> traits_type;
  151. typedef typename traits_type::template model_type<T>::type model_type;
  152. param_type const& param = geometry::tuples::get<I>(params);
  153. model_type const& model = traits_type::template model<T>(param);
  154. a = geometry::get_radius<0>(model);
  155. b = geometry::get_radius<2>(model);
  156. return true;
  157. }
  158. };
  159. template <typename Params, int N>
  160. struct pj_ell_init_ellps_static<Params, N, N>
  161. {
  162. template <typename T>
  163. static bool apply(Params const& , T & , T & )
  164. {
  165. return false;
  166. }
  167. };
  168. template <typename T, typename ...Ps>
  169. inline bool pj_ell_init_ellps(srs::spar::parameters<Ps...> const& params,
  170. T &a, T &b)
  171. {
  172. return pj_ell_init_ellps_static
  173. <
  174. srs::spar::parameters<Ps...>
  175. >::apply(params, a, b);
  176. }
  177. /************************************************************************/
  178. /* pj_ell_init() */
  179. /************************************************************************/
  180. /* initialize geographic shape parameters */
  181. // This function works differently than the original pj_ell_set().
  182. // It doesn't push parameters defined in ellps into params list.
  183. // Instead it tries to use size (a, R) and shape (es, e, rf, f, b) parameters
  184. // and then if needed falls back to ellps, then to datum and then to the default WGS84
  185. template <typename Params, typename T>
  186. inline void pj_ell_init(Params const& params, T &a, T &es)
  187. {
  188. /* check for varying forms of ellipsoid input */
  189. a = es = 0.;
  190. /* R takes precedence */
  191. if (pj_param_f<srs::spar::r>(params, "R", srs::dpar::r, a)) {
  192. /* empty */
  193. } else { /* probable elliptical figure */
  194. // Set ellipsoid's size parameter
  195. a = pj_get_param_f<T, srs::spar::a>(params, "a", srs::dpar::a);
  196. bool is_a_set = a != 0.0;
  197. // Set ellipsoid's shape parameter
  198. T b = 0.0;
  199. bool is_ell_set = false;
  200. if (pj_param_f<srs::spar::es>(params, "es", srs::dpar::es, es)) {/* eccentricity squared */
  201. /* empty */
  202. is_ell_set = true;
  203. } else if (pj_param_f<srs::spar::e>(params, "e", srs::dpar::e, es)) { /* eccentricity */
  204. es = es * es;
  205. is_ell_set = true;
  206. } else if (pj_param_f<srs::spar::rf>(params, "rf", srs::dpar::rf, es)) { /* recip flattening */
  207. if (es == 0.0) {
  208. BOOST_THROW_EXCEPTION( projection_exception(error_rev_flattening_is_zero) );
  209. }
  210. es = 1./ es;
  211. es = es * (2. - es);
  212. is_ell_set = true;
  213. } else if (pj_param_f<srs::spar::f>(params, "f", srs::dpar::f, es)) { /* flattening */
  214. es = es * (2. - es);
  215. is_ell_set = true;
  216. } else if (pj_param_f<srs::spar::b>(params, "b", srs::dpar::b, b)) { /* minor axis */
  217. es = pj_ell_b_to_es(a, b);
  218. is_ell_set = true;
  219. } /* else es == 0. and sphere of radius a */
  220. // NOTE: Below when ellps is used to initialize a and es
  221. // b is not set because it only has sense together with a
  222. // but a could have been set separately before, e.g. consider passing:
  223. // a=1 ellps=airy (a=6377563.396 b=6356256.910)
  224. // after setting size parameter a and shape parameter from ellps
  225. // b has to be recalculated
  226. // If ellipsoid's parameters are not set directly
  227. // use ellps parameter
  228. if (! is_a_set || ! is_ell_set) {
  229. T ellps_a = 0, ellps_b = 0;
  230. if (pj_ell_init_ellps(params, ellps_a, ellps_b)) {
  231. if (! is_a_set) {
  232. a = ellps_a;
  233. is_a_set = true;
  234. }
  235. if (! is_ell_set) {
  236. es = pj_ell_b_to_es(ellps_a, ellps_b);
  237. is_ell_set = true;
  238. }
  239. }
  240. }
  241. // If ellipsoid's parameters are not set
  242. // use ellps defined by datum parameter
  243. if (! is_a_set || ! is_ell_set)
  244. {
  245. const pj_datums_type<T>* datum = pj_datum_find_datum<T>(params);
  246. if (datum != NULL)
  247. {
  248. pj_ellps_type<T> const& pj_ellp = pj_get_ellps<T>().first[datum->ellps];
  249. if (! is_a_set) {
  250. a = pj_ellp.a;
  251. is_a_set = true;
  252. }
  253. if (! is_ell_set) {
  254. es = pj_ell_b_to_es(pj_ellp.a, pj_ellp.b);
  255. is_ell_set = true;
  256. }
  257. }
  258. }
  259. // If ellipsoid's parameters are still not set
  260. // use default WGS84
  261. if ((! is_a_set || ! is_ell_set)
  262. && ! pj_get_param_b<srs::spar::no_defs>(params, "no_defs", srs::dpar::no_defs))
  263. {
  264. pj_ellps_type<T> const& pj_ellp = pj_get_ellps<T>().first[srs::dpar::ellps_wgs84];
  265. if (! is_a_set) {
  266. a = pj_ellp.a;
  267. is_a_set = true;
  268. }
  269. if (! is_ell_set) {
  270. es = pj_ell_b_to_es(pj_ellp.a, pj_ellp.b);
  271. is_ell_set = true;
  272. }
  273. }
  274. if (b == 0.0)
  275. b = a * sqrt(1. - es);
  276. /* following options turn ellipsoid into equivalent sphere */
  277. if (pj_get_param_b<srs::spar::r_au>(params, "R_A", srs::dpar::r_au)) { /* sphere--area of ellipsoid */
  278. a *= 1. - es * (SIXTH<T>() + es * (RA4<T>() + es * RA6<T>()));
  279. es = 0.;
  280. } else if (pj_get_param_b<srs::spar::r_v>(params, "R_V", srs::dpar::r_v)) { /* sphere--vol. of ellipsoid */
  281. a *= 1. - es * (SIXTH<T>() + es * (RV4<T>() + es * RV6<T>()));
  282. es = 0.;
  283. } else if (pj_get_param_b<srs::spar::r_a>(params, "R_a", srs::dpar::r_a)) { /* sphere--arithmetic mean */
  284. a = .5 * (a + b);
  285. es = 0.;
  286. } else if (pj_get_param_b<srs::spar::r_g>(params, "R_g", srs::dpar::r_g)) { /* sphere--geometric mean */
  287. a = sqrt(a * b);
  288. es = 0.;
  289. } else if (pj_get_param_b<srs::spar::r_h>(params, "R_h", srs::dpar::r_h)) { /* sphere--harmonic mean */
  290. a = 2. * a * b / (a + b);
  291. es = 0.;
  292. } else {
  293. T tmp;
  294. bool i = pj_param_r<srs::spar::r_lat_a>(params, "R_lat_a", srs::dpar::r_lat_a, tmp);
  295. if (i || /* sphere--arith. */
  296. pj_param_r<srs::spar::r_lat_g>(params, "R_lat_g", srs::dpar::r_lat_g, tmp)) { /* or geom. mean at latitude */
  297. tmp = sin(tmp);
  298. if (geometry::math::abs(tmp) > geometry::math::half_pi<T>()) {
  299. BOOST_THROW_EXCEPTION( projection_exception(error_ref_rad_larger_than_90) );
  300. }
  301. tmp = 1. - es * tmp * tmp;
  302. a *= i ? .5 * (1. - es + tmp) / ( tmp * sqrt(tmp)) :
  303. sqrt(1. - es) / tmp;
  304. es = 0.;
  305. }
  306. }
  307. }
  308. /* some remaining checks */
  309. if (es < 0.) {
  310. BOOST_THROW_EXCEPTION( projection_exception(error_es_less_than_zero) );
  311. }
  312. if (a <= 0.) {
  313. BOOST_THROW_EXCEPTION( projection_exception(error_major_axis_not_given) );
  314. }
  315. }
  316. template <typename Params>
  317. struct static_srs_tag_check_nonexpanded
  318. {
  319. typedef std::conditional_t
  320. <
  321. geometry::tuples::exists_if
  322. <
  323. Params, srs::spar::detail::is_param_t<srs::spar::r>::pred
  324. >::value
  325. || geometry::tuples::exists_if
  326. <
  327. Params, srs::spar::detail::is_param<srs::spar::r_au>::pred
  328. >::value
  329. || geometry::tuples::exists_if
  330. <
  331. Params, srs::spar::detail::is_param<srs::spar::r_v>::pred
  332. >::value
  333. || geometry::tuples::exists_if
  334. <
  335. Params, srs::spar::detail::is_param<srs::spar::r_a>::pred
  336. >::value
  337. || geometry::tuples::exists_if
  338. <
  339. Params, srs::spar::detail::is_param<srs::spar::r_g>::pred
  340. >::value
  341. || geometry::tuples::exists_if
  342. <
  343. Params, srs::spar::detail::is_param<srs::spar::r_h>::pred
  344. >::value
  345. || geometry::tuples::exists_if
  346. <
  347. Params, srs::spar::detail::is_param_t<srs::spar::r_lat_a>::pred
  348. >::value
  349. || geometry::tuples::exists_if
  350. <
  351. Params, srs::spar::detail::is_param_t<srs::spar::r_lat_g>::pred
  352. >::value,
  353. srs_sphere_tag,
  354. // NOTE: The assumption here is that if the user defines either one of:
  355. // b, es, e, f, rf parameters then he wants to define spheroid, not sphere
  356. std::conditional_t
  357. <
  358. geometry::tuples::exists_if
  359. <
  360. Params, srs::spar::detail::is_param_t<srs::spar::b>::pred
  361. >::value
  362. || geometry::tuples::exists_if
  363. <
  364. Params, srs::spar::detail::is_param_t<srs::spar::es>::pred
  365. >::value
  366. || geometry::tuples::exists_if
  367. <
  368. Params, srs::spar::detail::is_param_t<srs::spar::e>::pred
  369. >::value
  370. || geometry::tuples::exists_if
  371. <
  372. Params, srs::spar::detail::is_param_t<srs::spar::rf>::pred
  373. >::value
  374. || geometry::tuples::exists_if
  375. <
  376. Params, srs::spar::detail::is_param_t<srs::spar::f>::pred
  377. >::value,
  378. srs_spheroid_tag,
  379. void
  380. >
  381. > type;
  382. };
  383. template <typename Params>
  384. struct static_srs_tag_check_ellps
  385. {
  386. typedef typename geometry::tag
  387. <
  388. typename srs::spar::detail::ellps_traits
  389. <
  390. typename geometry::tuples::find_if
  391. <
  392. Params,
  393. srs::spar::detail::is_param_tr<srs::spar::detail::ellps_traits>::pred
  394. >::type
  395. >::template model_type<double>::type // dummy type
  396. >::type type;
  397. };
  398. template <typename Params>
  399. struct static_srs_tag_check_datum
  400. {
  401. typedef typename geometry::tag
  402. <
  403. typename srs::spar::detail::ellps_traits
  404. <
  405. typename srs::spar::detail::datum_traits
  406. <
  407. typename geometry::tuples::find_if
  408. <
  409. Params,
  410. srs::spar::detail::is_param_tr<srs::spar::detail::datum_traits>::pred
  411. >::type
  412. >::ellps_type
  413. >::template model_type<double>::type // dummy type
  414. >::type type;
  415. };
  416. template
  417. <
  418. typename Params,
  419. typename NonExpandedTag = typename static_srs_tag_check_nonexpanded
  420. <
  421. Params
  422. >::type,
  423. typename EllpsTag = typename static_srs_tag_check_ellps
  424. <
  425. Params
  426. >::type,
  427. typename DatumTag = typename static_srs_tag_check_datum
  428. <
  429. Params
  430. >::type
  431. >
  432. struct static_srs_tag
  433. {
  434. // User passed one of the non-ellps, non-datum parameters
  435. typedef NonExpandedTag type;
  436. };
  437. template <typename Params, typename EllpsTag, typename DatumTag>
  438. struct static_srs_tag<Params, void, EllpsTag, DatumTag>
  439. {
  440. // User didn't pass neither one of the non-ellps, non-datum parameters
  441. // but passed ellps
  442. typedef EllpsTag type;
  443. };
  444. template <typename Params, typename DatumTag>
  445. struct static_srs_tag<Params, void, void, DatumTag>
  446. {
  447. // User didn't pass neither one of the non-ellps, non-datum parameters
  448. // nor ellps parameter but passed datum parameter
  449. typedef DatumTag type;
  450. };
  451. template <typename Params>
  452. struct static_srs_tag<Params, void, void, void>
  453. {
  454. // User didn't pass any parameter defining model
  455. // so use default or generate error
  456. typedef std::conditional_t
  457. <
  458. geometry::tuples::exists_if
  459. <
  460. Params, srs::spar::detail::is_param<srs::spar::no_defs>::pred
  461. >::value,
  462. void,
  463. srs_spheroid_tag // WGS84
  464. > type;
  465. static const bool is_found = ! std::is_void<type>::value;
  466. BOOST_GEOMETRY_STATIC_ASSERT((is_found),
  467. "Expected ellipsoid or sphere definition.",
  468. Params);
  469. };
  470. template <typename T>
  471. inline void pj_calc_ellipsoid_params(parameters<T> & p, T const& a, T const& es) {
  472. /****************************************************************************************
  473. Calculate a large number of ancillary ellipsoidal parameters, in addition to
  474. the two traditional PROJ defining parameters: Semimajor axis, a, and the
  475. eccentricity squared, es.
  476. Most of these parameters are fairly cheap to compute in comparison to the overall
  477. effort involved in initializing a PJ object. They may, however, take a substantial
  478. part of the time taken in computing an individual point transformation.
  479. So by providing them up front, we can amortize the (already modest) cost over all
  480. transformations carried out over the entire lifetime of a PJ object, rather than
  481. incur that cost for every single transformation.
  482. Most of the parameter calculations here are based on the "angular eccentricity",
  483. i.e. the angle, measured from the semiminor axis, of a line going from the north
  484. pole to one of the foci of the ellipsoid - or in other words: The arc sine of the
  485. eccentricity.
  486. The formulae used are mostly taken from:
  487. Richard H. Rapp: Geometric Geodesy, Part I, (178 pp, 1991).
  488. Columbus, Ohio: Dept. of Geodetic Science
  489. and Surveying, Ohio State University.
  490. ****************************************************************************************/
  491. p.a = a;
  492. p.es = es;
  493. /* Compute some ancillary ellipsoidal parameters */
  494. if (p.e==0)
  495. p.e = sqrt(p.es); /* eccentricity */
  496. //p.alpha = asin (p.e); /* angular eccentricity */
  497. /* second eccentricity */
  498. //p.e2 = tan (p.alpha);
  499. //p.e2s = p.e2 * p.e2;
  500. /* third eccentricity */
  501. //p.e3 = (0!=p.alpha)? sin (p.alpha) / sqrt(2 - sin (p.alpha)*sin (p.alpha)): 0;
  502. //p.e3s = p.e3 * p.e3;
  503. /* flattening */
  504. //if (0==p.f)
  505. // p.f = 1 - cos (p.alpha); /* = 1 - sqrt (1 - PIN->es); */
  506. //p.rf = p.f != 0.0 ? 1.0/p.f: HUGE_VAL;
  507. /* second flattening */
  508. //p.f2 = (cos(p.alpha)!=0)? 1/cos (p.alpha) - 1: 0;
  509. //p.rf2 = p.f2 != 0.0 ? 1/p.f2: HUGE_VAL;
  510. /* third flattening */
  511. //p.n = pow (tan (p.alpha/2), 2);
  512. //p.rn = p.n != 0.0 ? 1/p.n: HUGE_VAL;
  513. /* ...and a few more */
  514. //if (0==p.b)
  515. // p.b = (1 - p.f)*p.a;
  516. //p.rb = 1. / p.b;
  517. p.ra = 1. / p.a;
  518. p.one_es = 1. - p.es;
  519. if (p.one_es == 0.) {
  520. BOOST_THROW_EXCEPTION( projection_exception(error_eccentricity_is_one) );
  521. }
  522. p.rone_es = 1./p.one_es;
  523. }
  524. } // namespace detail
  525. }}} // namespace boost::geometry::projections
  526. #endif // BOOST_GEOMETRY_PROJECTIONS_IMPL_PJ_ELL_SET_HPP