604 const int d_lng[] = { 0, 2, 2, 0, 0, 0, 2, 2, 2, 2,
605 0, 1, 0, 2, 0, 0, 4, 0, 4, 2,
606 2, 1, 1, 2, 2, 4, 2, 0, 2, 2,
607 1, 2, 0, 0, 2, 2, 2, 4, 0, 3,
608 2, 4, 0, 2, 2, 2, 4, 0, 4, 1,
609 2, 0, 1, 3, 4, 2, 0, 1, 2, 2};
610 const int m_lng[] = { 0, 0, 0, 0, 1, 0, 0,-1, 0,-1,
611 1, 0, 1, 0, 0, 0, 0, 0, 0, 1,
612 1, 0, 1,-1, 0, 0, 0, 1, 0,-1,
613 0,-2, 1, 2,-2, 0, 0,-1, 0, 0,
614 1,-1, 2, 2, 1,-1, 0, 0,-1, 0,
615 1, 0, 1, 0, 0,-1, 2, 1, 0,0};
616 const int mp_lng[] = { 1,-1, 0, 2, 0, 0,-2,-1, 1, 0,
617 -1, 0, 1, 0, 1, 1,-1, 3,-2,-1,
618 0,-1, 0, 1, 2, 0,-3,-2,-1,-2,
619 1, 0, 2, 0,-1, 1, 0,-1, 2,-1,
620 1,-2,-1,-1,-2, 0, 1, 4, 0,-2,
621 0, 2, 1,-2,-3, 2, 1,-1, 3,-1};
622 const int f_lng[] = { 0, 0, 0, 0, 0, 2, 0, 0, 0, 0,
623 0, 0, 0,-2, 2,-2, 0, 0, 0, 0,
624 0, 0, 0, 0, 0, 0, 0, 0, 2, 0,
625 0, 0, 0, 0, 0,-2, 2, 0, 2, 0,
626 0, 0, 0, 0, 0,-2, 0, 0, 0, 0,
627 -2,-2, 0, 0, 0, 0, 0, 0, 0,-2};
628 const int sin_lng[] = { 6288774, 1274027, 658314, 213618,-185116,
629 -114332, 58793, 57066, 53322, 45758,
630 -40923, -34720, -30383, 15327, -12528,
631 10980, 10675, 10034, 8548, -7888,
632 -6766, -5163, 4987, 4036, 3994,
633 3861, 3665, -2689, -2602, 2390,
634 -2348, 2236, -2120, -2069, 2048,
635 -1773, -1595, 1215, -1110, -892,
636 -810, 759, -713, -700, 691,
637 596, 549, 537, 520, -487,
638 -399, -381, 351, -340, 330,
639 327, -323, 299, 294, 0};
656 const int d_lat[] = { 0, 0, 0, 2, 2, 2, 2, 0, 2, 0,
657 2, 2, 2, 2, 2, 2, 2, 0, 4, 0,
658 0, 0, 1, 0, 0, 0, 1, 0, 4, 4,
659 0, 4, 2, 2, 2, 2, 0, 2, 2, 2,
660 2, 4, 2, 2, 0, 2, 1, 1, 0, 2,
661 1, 2, 0, 4, 4, 1, 4, 1, 4, 2};
662 const int m_lat[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
663 -1, 0, 0, 1,-1,-1,-1, 1, 0, 1,
664 0, 1, 0, 1, 1, 1, 0, 0, 0, 0,
665 0, 0, 0, 0,-1, 0, 0, 0, 0, 1,
666 1, 0,-1,-2, 0, 1, 1, 1, 1, 1,
667 0,-1, 1, 0,-1, 0, 0, 0,-1,-2};
668 const int mp_lat[] = { 0, 1, 1, 0,-1,-1, 0, 2, 1, 2,
669 0,-2, 1, 0,-1, 0,-1,-1,-1, 0,
670 0,-1, 0, 1, 1, 0, 0, 3, 0,-1,
671 1,-2, 0, 2, 1,-2, 3, 2,-3,-1,
672 0, 0, 1, 0, 1, 1, 0, 0,-2,-1,
673 1,-2, 2,-2,-1, 1, 1,-1, 0, 0};
674 const int f_lat[] = { 1, 1,-1,-1, 1,-1, 1, 1,-1,-1,
675 -1,-1, 1,-1, 1, 1,-1,-1,-1, 1,
676 3, 1, 1, 1,-1,-1,-1, 1,-1, 1,
677 -3, 1,-3,-1,-1, 1,-1, 1,-1, 1,
678 1, 1, 1,-1, 3,-1,-1, 1,-1,-1,
679 1,-1, 1,-1,-1,-1,-1,-1,-1, 1};
680 const int sin_lat[] = {5128122, 280602, 277693, 173237, 55413,
681 46271, 32573, 17198, 9266, 8822,
682 8216, 4324, 4200, -3359, 2463,
683 2211, 2065, -1870, 1828, -1794,
684 -1749, -1565, -1491, -1475, -1410,
685 -1344, -1335, 1107, 1021, 833,
686 777, 671, 607, 596, 491,
687 -451, 439, 422, 421, -366,
688 -351, 331, 315, 302, -283,
689 -229, 223, 223, -220, -220,
690 -185, 181, -177, 176, 166,
691 -164, 132, -119, 115, 107};
698 const int nutate_d_lng[] = { 0,-2, 0, 0, 0, 0,-2, 0, 0,-2,
699 -2,-2, 0, 2, 0, 2, 0, 0,-2, 0,
700 2, 0, 0,-2, 0,-2, 0, 0, 2,-2,
701 0,-2, 0, 0, 2, 2, 0,-2, 0, 2,
702 2,-2,-2, 2, 2, 0,-2,-2, 0,-2,
703 -2, 0,-1,-2, 1, 0, 0,-1, 0, 0,
705 const int nutate_m_lng[] = { 0, 0, 0, 0, 1, 0, 1, 0, 0,-1,
706 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
707 0, 0, 0, 0, 0, 0, 0, 2, 0, 2,
708 1, 0,-1, 0, 0, 0, 1, 1,-1, 0,
709 0, 0, 0, 0, 0,-1,-1, 0, 0, 0,
710 1, 0, 0, 1, 0, 0, 0,-1, 1,-1,
712 const int nutate_mp_lng[] = { 0, 0, 0, 0, 0, 1, 0, 0, 1, 0,
713 1, 0,-1, 0, 1,-1,-1, 1, 2,-2,
714 0, 2, 2, 1, 0, 0,-1, 0,-1, 0,
715 0, 1, 0, 2,-1, 1, 0, 1, 0, 0,
716 1, 2, 1,-2, 0, 1, 0, 0, 2, 2,
717 0, 1, 1, 0, 0, 1,-2, 1, 1, 1,
719 const int nutate_f_lng[] = { 0, 2, 2, 0, 0, 0, 2, 2, 2, 2,
720 0, 2, 2, 0, 0, 2, 0, 2, 0, 2,
721 2, 2, 0, 2, 2, 2, 2, 0, 0, 2,
722 0, 0, 0,-2, 2, 2, 2, 0, 2, 2,
723 0, 2, 2, 0, 0, 0, 2, 0, 2, 0,
724 2,-2, 0, 0, 0, 2, 2, 0, 0, 2,
726 const int nutate_om_lng[] = { 1, 2, 2, 2, 0, 0, 2, 1, 2, 2,
727 0, 1, 2, 0, 1, 2, 1, 1, 0, 1,
728 2, 2, 0, 2, 0, 0, 1, 0, 1, 2,
729 1, 1, 1, 0, 1, 2, 2, 0, 2, 1,
730 0, 2, 1, 1, 1, 0, 1, 1, 1, 1,
731 1, 0, 0, 0, 0, 0, 2, 0, 0, 2,
733 const int nutate_sin_lng[] = {-171996, -13187, -2274, 2062, 1426,
734 712, -517, -386, -301, 217,
735 -158, 129, 123, 63, 63,
736 -59, -58, -51, 48, 46,
737 -38, -31, 29, 29, 26,
738 -22, 21, 17, 16, -16,
739 -15, -13, -12, 11, -10,
746 const int nutate_cos_lng[] = { 92025, 5736, 977, -895, 54,
747 -7, 224, 200, 129, -95,
759 const double nutate_sdelt[] = {-174.2, -1.6, -0.2, 0.2, -3.4,
760 0.1, 1.2, -0.4, 0.0, -0.5,
761 0.0, 0.1, 0.0, 0.0, 0.1,
762 0.0, -0.1, 0.0, 0.0, 0.0,
763 0.0, 0.0, 0.0, 0.0, 0.0,
764 0.0, 0.0, -0.1, 0.0, 0.1,
765 0.0, 0.0, 0.0, 0.0, 0.0,
766 0.0, 0.0, 0.0, 0.0, 0.0,
767 0.0, 0.0, 0.0, 0.0, 0.0,
768 0.0, 0.0, 0.0, 0.0, 0.0,
769 0.0, 0.0, 0.0, 0.0, 0.0,
770 0.0, 0.0, 0.0, 0.0, 0.0,
772 const double nutate_cdelt[] = {8.9, -3.1, -0.5, 0.5, -0.1,
773 0.0, -0.6, 0.0, -0.1, 0.3,
774 0.0, 0.0, 0.0, 0.0, 0.0,
775 0.0, 0.0, 0.0, 0.0, 0.0,
776 0.0, 0.0, 0.0, 0.0, 0.0,
777 0.0, 0.0, 0.0, 0.0, 0.0,
778 0.0, 0.0, 0.0, 0.0, 0.0,
779 0.0, 0.0, 0.0, 0.0, 0.0,
780 0.0, 0.0, 0.0, 0.0, 0.0,
781 0.0, 0.0, 0.0, 0.0, 0.0,
782 0.0, 0.0, 0.0, 0.0, 0.0,
783 0.0, 0.0, 0.0, 0.0, 0.0,
787 double t = (time.
jd() - 2451545.0) / 36525.0;
791 double Lprimed = 218.3164477 +
794 (1.0/538841.0 - 1.0/65194000.0 * t) * t) * t) * t;
798 double D = (297.8501921 +
801 (1.0/545868.0 - 1.0/113065000.0 * t) * t) * t) * t) *
805 double M = (357.5291092 +
807 (-0.0001536 + 1.0/24490000.0 * t) * t) * t) *
811 double Mprime = (134.9633964 +
814 (1.0/69699.0 - 1.0/14712000.0 * t) * t) * t) * t) *
818 double F = (93.2720950 +
821 (-1.0/35260000 + 1.0/863310000 * t) * t) * t) * t) *
826 double Omega = (125.04452 +
828 (0.0020708 + 1.0/4.5e5 * t) * t) * t) *
837 double Al = 3958.0 * std::sin(A1) +
838 1962.0 * std::sin(Lprime - F) +
839 318.0 * std::sin(A2);
840 double Ab = -2235.0 * std::sin(Lprime) +
841 382.0 * std::sin(A3) +
842 175.0 * std::sin(A1 - F) +
843 175.0 * std::sin(A1 + F) +
844 127.0 * std::sin(Lprime - Mprime) -
845 115.0 * std::sin(Lprime + Mprime);
848 double E = 1.0 - (0.002516 + 7.4e-6 * t) * t;
855 for (
int i = 0; i < 60; ++i) {
858 double sinlng = sin_lng[i];
860 double sinlat = sin_lat[i];
861 if (std::abs(m_lng[i]) == 1) {
865 else if (std::abs(m_lng[i]) == 2) {
869 if (std::abs(m_lat[i]) == 1) {
872 else if (std::abs(m_lat[i]) == 2) {
877 double s_l = d_lng[i] * D + m_lng[i] * M + mp_lng[i] * Mprime +
879 double s_b = d_lat[i] * D + m_lat[i] * M + mp_lat[i] * Mprime +
883 sum_l += sinlng * std::sin(s_l);
884 sum_b += sinlat * std::sin(s_b);
890 double geolong = Lprimed + 1.0e-6 * sum_l;
891 double geolat = 1.0e-6 * sum_b;
897 double nut_long = 0.0;
898 double nut_obliq = 0.0;
899 for (
int i = 0; i < 63; ++i) {
900 double arg = nutate_d_lng[i] * D + nutate_m_lng[i] * M +
901 nutate_mp_lng[i] * Mprime + nutate_f_lng[i] * F +
902 nutate_om_lng[i] * Omega;
903 nut_long += (nutate_sdelt[i] * t + nutate_sin_lng[i]) * std::sin(arg);
904 nut_obliq += (nutate_cdelt[i] * t + nutate_cos_lng[i]) * std::cos(arg);
910 geolong += nut_long / 3600.0;
920 double y = t / 100.0;
921 double epsilon = (84381.448 +
930 (5.79 + 2.45 * y)*y)*y)*y)*y)*y)*y)*y)*y)*y)/3600.0;
934 double ra = std::atan2(std::sin(lambda) * std::cos(eps) -
935 std::tan(beta) * std::sin(eps), std::cos(lambda)) *
937 double dec = std::asin(std::sin(beta) * std::cos(eps) +
938 std::cos(beta) * std::sin(eps) * std::sin(lambda)) *