radii.c 3.0 KB

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