radii.c 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. /*!
  2. \file lib/gis/radii.c
  3. \brief GIS Library - Calculating the Meridional Radius of Curvature
  4. \todo Suggestion: all "lon"s in the file "radii.c" should read as "lat"
  5. Comments:
  6. on page http://www.mentorsoftwareinc.com/cc/gistips/TIPS0899.HTM
  7. down where it says "Meridional Radius of Curvature" is the exact formula
  8. out of "radii.c".
  9. Quote: "essentially, the radius of curvature, at a specific latitude ...".
  10. See also http://williams.best.vwh.net/ellipsoid/node1.html which has a nice
  11. picture showning the parametric latitude and phi, the geodetic latitude.
  12. On the next page,
  13. http://williams.best.vwh.net/ellipsoid/node2.html, in equation 3, the
  14. Meridional Radius of Curvature shows up.
  15. So, it looks like you are calculating the Meridional Radius of Curvature
  16. as a function of GEODETIC LATITUDE.
  17. Various formulas for the ellipsoid.
  18. Reference: Map Projections by Peter Richardus and Ron K. Alder
  19. University of Illinois Library Call Number: 526.8 R39m
  20. Parameters are:
  21. - lon = longitude of the meridian
  22. - a = ellipsoid semi-major axis
  23. - e2 = ellipsoid eccentricity squared
  24. meridional radius of curvature (p. 16)
  25. \verbatim
  26. 2
  27. a ( 1 - e )
  28. M = ------------------
  29. 2 2 3/2
  30. (1 - e sin lon)
  31. \endverbatim
  32. transverse radius of curvature (p. 16)
  33. \verbatim
  34. a
  35. N = ------------------
  36. 2 2 1/2
  37. (1 - e sin lon)
  38. \endverbatim
  39. radius of the tangent sphere onto which angles are mapped
  40. conformally (p. 24)
  41. \verbatim
  42. R = sqrt ( N * M )
  43. \endverbatim
  44. (C) 2001-2009 by the GRASS Development Team
  45. This program is free software under the GNU General Public License
  46. (>=v2). Read the file COPYING that comes with GRASS for details.
  47. \author CERL
  48. */
  49. #include <math.h>
  50. #include <grass/gis.h>
  51. #include "pi.h"
  52. /*!
  53. * \brief Meridional radius of curvature
  54. *
  55. * Returns the meridional radius of curvature at a given longitude:
  56. *
  57. \f$
  58. \rho = \frac{a (1-e^2)}{(1-e^2\sin^2 lon)^{3/2}}
  59. \f$
  60. *
  61. * \param lon longitude
  62. * \param a ellipsoid semi-major axis
  63. * \param e2 ellipsoid eccentricity squared
  64. *
  65. * \return radius value
  66. */
  67. double G_meridional_radius_of_curvature(double lon, double a, double e2)
  68. {
  69. double x;
  70. double s;
  71. s = sin(Radians(lon));
  72. x = 1 - e2 * s * s;
  73. return a * (1 - e2) / (x * sqrt(x));
  74. }
  75. /*!
  76. * \brief Transverse radius of curvature
  77. *
  78. * Returns the transverse radius of curvature at a given longitude:
  79. *
  80. \f$
  81. \nu = \frac{a}{(1-e^2\sin^2 lon)^{1/2}}
  82. \f$
  83. *
  84. * \param lon longitude
  85. * \param a ellipsoid semi-major axis
  86. * \param e2 ellipsoid eccentricity squared
  87. *
  88. * \return radius value
  89. */
  90. double G_transverse_radius_of_curvature(double lon, double a, double e2)
  91. {
  92. double x;
  93. double s;
  94. s = sin(Radians(lon));
  95. x = 1 - e2 * s * s;
  96. return a / sqrt(x);
  97. }
  98. /*!
  99. * \brief Radius of conformal tangent sphere
  100. *
  101. * Returns the radius of the conformal sphere tangent to ellipsoid at
  102. * a given longitude:
  103. *
  104. \f$
  105. r = \frac{a (1-e^2)^{1/2}}{(1-e^2\sin^2 lon)}
  106. \f$
  107. *
  108. * \param lon longitude
  109. * \param a ellipsoid semi-major axis
  110. * \param e2 ellipsoid eccentricity squared
  111. *
  112. * \return radius value
  113. */
  114. double G_radius_of_conformal_tangent_sphere(double lon, double a, double e2)
  115. {
  116. double x;
  117. double s;
  118. s = sin(Radians(lon));
  119. x = 1 - e2 * s * s;
  120. return a * sqrt(1 - e2) / x;
  121. }