💿🐜 Antkeeper source code https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
2.3 KiB

  1. /*
  2. * Copyright (C) 2020 Christopher J. Howard
  3. *
  4. * This file is part of Antkeeper source code.
  5. *
  6. * Antkeeper source code is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * Antkeeper source code is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #ifndef ANTKEEPER_CELESTIAL_MECHANICS_HPP
  20. #define ANTKEEPER_CELESTIAL_MECHANICS_HPP
  21. #include "utility/fundamental-types.hpp"
  22. namespace ast
  23. {
  24. /**
  25. * Approximates the obliquity of the ecliptic.
  26. *
  27. * @param jd Julian date.
  28. * @return Obliquity of the ecliptic, in radians.
  29. */
  30. double approx_ecliptic_obliquity(double jd);
  31. /**
  32. * Approximates the ecliptic coordinates of the Earth's sun.
  33. *
  34. * @param jd Julian date.
  35. * @return Ecliptic rectangular geocentric coordinates of the Earth's sun, with distance in AU.
  36. */
  37. double3 approx_sun_ecliptic(double jd);
  38. /**
  39. * Approximates the ecliptic coordinates of the Earth's moon.
  40. *
  41. * @param jd Julian date.
  42. * @return Ecliptic rectangular geocentric coordinates of the Earth's moon, with distance in Earth radii.
  43. */
  44. double3 approx_moon_ecliptic(double jd);
  45. /**
  46. * Approximates the ecliptic rotation of the Earth's moon.
  47. *
  48. * @param jd Julian date.
  49. * @return Rotation matrix representing the moon's rotation in ecliptic space.
  50. */
  51. double3x3 approx_moon_ecliptic_rotation(double jd);
  52. struct kepler_orbit
  53. {
  54. double a; ///< Semi-major axis, a
  55. double ec; ///< Eccentricity, e
  56. double w; ///< Argument of periapsis, w (radians)
  57. double ma; ///< Mean anomaly, M (radians)
  58. double i; ///< Inclination, i (radians)
  59. double om; ///< Longitude of the ascending node, OMEGA (radians)
  60. };
  61. double3 solve_kepler(const kepler_orbit& orbit, double t);
  62. double3 solve_kepler(double a, double ec, double w, double ma, double i, double om);
  63. } // namespace ast
  64. #endif // ANTKEEPER_CELESTIAL_MECHANICS_HPP