/
| 21 | |
| 22 | /***************************************************************************************/ |
| 23 | int pj_ellipsoid (PJ *P) { |
| 24 | /**************************************************************************************** |
| 25 | This is a replacement for the classic PROJ pj_ell_set function. The main difference |
| 26 | is that pj_ellipsoid augments the PJ object with a copy of the exact tags used to |
| 27 | define its related ellipsoid. |
| 28 | |
| 29 | This makes it possible to let a new PJ object inherit the geometrical properties |
| 30 | of an existing one. |
| 31 | |
| 32 | A complete ellipsoid definition comprises a size (primary) and a shape (secondary) |
| 33 | parameter. |
| 34 | |
| 35 | Size parameters supported are: |
| 36 | R, defining the radius of a spherical planet |
| 37 | a, defining the semimajor axis of an ellipsoidal planet |
| 38 | |
| 39 | Shape parameters supported are: |
| 40 | rf, the reverse flattening of the ellipsoid |
| 41 | f, the flattening of the ellipsoid |
| 42 | es, the eccentricity squared |
| 43 | e, the eccentricity |
| 44 | b, the semiminor axis |
| 45 | |
| 46 | The ellps=xxx parameter provides both size and shape for a number of built in |
| 47 | ellipsoid definitions. |
| 48 | |
| 49 | The ellipsoid definition may be augmented with a spherification flag, turning |
| 50 | the ellipsoid into a sphere with features defined by the ellipsoid. |
| 51 | |
| 52 | Spherification parameters supported are: |
| 53 | R_A, which gives a sphere with the same surface area as the ellipsoid |
| 54 | R_A, which gives a sphere with the same volume as the ellipsoid |
| 55 | |
| 56 | R_a, which gives a sphere with R = (a + b)/2 (arithmetic mean) |
| 57 | R_g, which gives a sphere with R = sqrt(a*b) (geometric mean) |
| 58 | R_h, which gives a sphere with R = 2*a*b/(a+b) (harmonic mean) |
| 59 | |
| 60 | R_lat_a=phi, which gives a sphere with R being the arithmetic mean of |
| 61 | of the corresponding ellipsoid at latitude phi. |
| 62 | R_lat_g=phi, which gives a sphere with R being the geometric mean of |
| 63 | of the corresponding ellipsoid at latitude phi. |
| 64 | |
| 65 | If R is given as size parameter, any shape and spherification parameters |
| 66 | given are ignored. |
| 67 | |
| 68 | If size and shape are given as ellps=xxx, later shape and size parameters |
| 69 | are are taken into account as modifiers for the built in ellipsoid definition. |
| 70 | |
| 71 | While this may seem strange, it is in accordance with historical PROJ |
| 72 | behavior. It can e.g. be used to define coordinates on the ellipsoid |
| 73 | scaled to unit semimajor axis by specifying "+ellps=xxx +a=1" |
| 74 | |
| 75 | ****************************************************************************************/ |
| 76 | int err = proj_errno_reset (P); |
| 77 | const char *empty = {""}; |
| 78 | |
| 79 | free(P->def_size); |
| 80 | P->def_size = nullptr; |
no test coverage detected