Iau2000Orientation.js 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. import defined from "./defined.js";
  2. import IauOrientationParameters from "./IauOrientationParameters.js";
  3. import JulianDate from "./JulianDate.js";
  4. import CesiumMath from "./Math.js";
  5. import TimeConstants from "./TimeConstants.js";
  6. /**
  7. * This is a collection of the orientation information available for central bodies.
  8. * The data comes from the Report of the IAU/IAG Working Group on Cartographic
  9. * Coordinates and Rotational Elements: 2000.
  10. *
  11. * @namespace Iau2000Orientation
  12. *
  13. * @private
  14. */
  15. const Iau2000Orientation = {};
  16. const TdtMinusTai = 32.184;
  17. const J2000d = 2451545.0;
  18. const c1 = -0.0529921;
  19. const c2 = -0.1059842;
  20. const c3 = 13.0120009;
  21. const c4 = 13.3407154;
  22. const c5 = 0.9856003;
  23. const c6 = 26.4057084;
  24. const c7 = 13.064993;
  25. const c8 = 0.3287146;
  26. const c9 = 1.7484877;
  27. const c10 = -0.1589763;
  28. const c11 = 0.0036096;
  29. const c12 = 0.1643573;
  30. const c13 = 12.9590088;
  31. let dateTT = new JulianDate();
  32. /**
  33. * Compute the orientation parameters for the Moon.
  34. *
  35. * @param {JulianDate} [date=JulianDate.now()] The date to evaluate the parameters.
  36. * @param {IauOrientationParameters} [result] The object onto which to store the result.
  37. * @returns {IauOrientationParameters} The modified result parameter or a new instance representing the orientation of the Earth's Moon.
  38. * @private
  39. */
  40. Iau2000Orientation.ComputeMoon = function (date, result) {
  41. if (!defined(date)) {
  42. date = JulianDate.now();
  43. }
  44. dateTT = JulianDate.addSeconds(date, TdtMinusTai, dateTT);
  45. const d = JulianDate.totalDays(dateTT) - J2000d;
  46. const T = d / TimeConstants.DAYS_PER_JULIAN_CENTURY;
  47. const E1 = (125.045 + c1 * d) * CesiumMath.RADIANS_PER_DEGREE;
  48. const E2 = (250.089 + c2 * d) * CesiumMath.RADIANS_PER_DEGREE;
  49. const E3 = (260.008 + c3 * d) * CesiumMath.RADIANS_PER_DEGREE;
  50. const E4 = (176.625 + c4 * d) * CesiumMath.RADIANS_PER_DEGREE;
  51. const E5 = (357.529 + c5 * d) * CesiumMath.RADIANS_PER_DEGREE;
  52. const E6 = (311.589 + c6 * d) * CesiumMath.RADIANS_PER_DEGREE;
  53. const E7 = (134.963 + c7 * d) * CesiumMath.RADIANS_PER_DEGREE;
  54. const E8 = (276.617 + c8 * d) * CesiumMath.RADIANS_PER_DEGREE;
  55. const E9 = (34.226 + c9 * d) * CesiumMath.RADIANS_PER_DEGREE;
  56. const E10 = (15.134 + c10 * d) * CesiumMath.RADIANS_PER_DEGREE;
  57. const E11 = (119.743 + c11 * d) * CesiumMath.RADIANS_PER_DEGREE;
  58. const E12 = (239.961 + c12 * d) * CesiumMath.RADIANS_PER_DEGREE;
  59. const E13 = (25.053 + c13 * d) * CesiumMath.RADIANS_PER_DEGREE;
  60. const sinE1 = Math.sin(E1);
  61. const sinE2 = Math.sin(E2);
  62. const sinE3 = Math.sin(E3);
  63. const sinE4 = Math.sin(E4);
  64. const sinE5 = Math.sin(E5);
  65. const sinE6 = Math.sin(E6);
  66. const sinE7 = Math.sin(E7);
  67. const sinE8 = Math.sin(E8);
  68. const sinE9 = Math.sin(E9);
  69. const sinE10 = Math.sin(E10);
  70. const sinE11 = Math.sin(E11);
  71. const sinE12 = Math.sin(E12);
  72. const sinE13 = Math.sin(E13);
  73. const cosE1 = Math.cos(E1);
  74. const cosE2 = Math.cos(E2);
  75. const cosE3 = Math.cos(E3);
  76. const cosE4 = Math.cos(E4);
  77. const cosE5 = Math.cos(E5);
  78. const cosE6 = Math.cos(E6);
  79. const cosE7 = Math.cos(E7);
  80. const cosE8 = Math.cos(E8);
  81. const cosE9 = Math.cos(E9);
  82. const cosE10 = Math.cos(E10);
  83. const cosE11 = Math.cos(E11);
  84. const cosE12 = Math.cos(E12);
  85. const cosE13 = Math.cos(E13);
  86. const rightAscension =
  87. (269.9949 +
  88. 0.0031 * T -
  89. 3.8787 * sinE1 -
  90. 0.1204 * sinE2 +
  91. 0.07 * sinE3 -
  92. 0.0172 * sinE4 +
  93. 0.0072 * sinE6 -
  94. 0.0052 * sinE10 +
  95. 0.0043 * sinE13) *
  96. CesiumMath.RADIANS_PER_DEGREE;
  97. const declination =
  98. (66.5392 +
  99. 0.013 * T +
  100. 1.5419 * cosE1 +
  101. 0.0239 * cosE2 -
  102. 0.0278 * cosE3 +
  103. 0.0068 * cosE4 -
  104. 0.0029 * cosE6 +
  105. 0.0009 * cosE7 +
  106. 0.0008 * cosE10 -
  107. 0.0009 * cosE13) *
  108. CesiumMath.RADIANS_PER_DEGREE;
  109. const rotation =
  110. (38.3213 +
  111. 13.17635815 * d -
  112. 1.4e-12 * d * d +
  113. 3.561 * sinE1 +
  114. 0.1208 * sinE2 -
  115. 0.0642 * sinE3 +
  116. 0.0158 * sinE4 +
  117. 0.0252 * sinE5 -
  118. 0.0066 * sinE6 -
  119. 0.0047 * sinE7 -
  120. 0.0046 * sinE8 +
  121. 0.0028 * sinE9 +
  122. 0.0052 * sinE10 +
  123. 0.004 * sinE11 +
  124. 0.0019 * sinE12 -
  125. 0.0044 * sinE13) *
  126. CesiumMath.RADIANS_PER_DEGREE;
  127. const rotationRate =
  128. ((13.17635815 -
  129. 1.4e-12 * (2.0 * d) +
  130. 3.561 * cosE1 * c1 +
  131. 0.1208 * cosE2 * c2 -
  132. 0.0642 * cosE3 * c3 +
  133. 0.0158 * cosE4 * c4 +
  134. 0.0252 * cosE5 * c5 -
  135. 0.0066 * cosE6 * c6 -
  136. 0.0047 * cosE7 * c7 -
  137. 0.0046 * cosE8 * c8 +
  138. 0.0028 * cosE9 * c9 +
  139. 0.0052 * cosE10 * c10 +
  140. 0.004 * cosE11 * c11 +
  141. 0.0019 * cosE12 * c12 -
  142. 0.0044 * cosE13 * c13) /
  143. 86400.0) *
  144. CesiumMath.RADIANS_PER_DEGREE;
  145. if (!defined(result)) {
  146. result = new IauOrientationParameters();
  147. }
  148. result.rightAscension = rightAscension;
  149. result.declination = declination;
  150. result.rotation = rotation;
  151. result.rotationRate = rotationRate;
  152. return result;
  153. };
  154. export default Iau2000Orientation;