helio.c 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #include "astro.h"
  2. void
  3. helio(void)
  4. {
  5. /*
  6. * uses lambda, beta, rad, motion
  7. * sets alpha, delta, rp
  8. */
  9. /*
  10. * helio converts from ecliptic heliocentric coordinates
  11. * referred to the mean equinox of date
  12. * to equatorial geocentric coordinates referred to
  13. * the true equator and equinox
  14. */
  15. double xmp, ymp, zmp;
  16. double beta2;
  17. /*
  18. * compute geocentric distance of object and
  19. * compute light-time correction (i.i. planetary aberration)
  20. */
  21. xmp = rad*cos(beta)*cos(lambda);
  22. ymp = rad*cos(beta)*sin(lambda);
  23. zmp = rad*sin(beta);
  24. rp = sqrt((xmp+xms)*(xmp+xms) +
  25. (ymp+yms)*(ymp+yms) +
  26. (zmp+zms)*(zmp+zms));
  27. lmb2 = lambda - .0057756e0*rp*motion;
  28. xmp = rad*cos(beta)*cos(lmb2);
  29. ymp = rad*cos(beta)*sin(lmb2);
  30. zmp = rad*sin(beta);
  31. /*
  32. * compute annual parallax from the position of the sun
  33. */
  34. xmp += xms;
  35. ymp += yms;
  36. zmp += zms;
  37. rp = sqrt(xmp*xmp + ymp*ymp + zmp*zmp);
  38. /*
  39. * compute annual (i.e. stellar) aberration
  40. * from the orbital velocity of the earth
  41. * (by an incorrect method)
  42. */
  43. xmp -= xdot*rp;
  44. ymp -= ydot*rp;
  45. zmp -= zdot*rp;
  46. /*
  47. * perform the nutation and so convert from the mean
  48. * equator and equinox to the true
  49. */
  50. lmb2 = atan2(ymp, xmp);
  51. beta2 = atan2(zmp, sqrt(xmp*xmp+ymp*ymp));
  52. lmb2 += phi;
  53. /*
  54. * change to equatorial coordinates
  55. */
  56. xmp = rp*cos(lmb2)*cos(beta2);
  57. ymp = rp*(sin(lmb2)*cos(beta2)*cos(tobliq) - sin(tobliq)*sin(beta2));
  58. zmp = rp*(sin(lmb2)*cos(beta2)*sin(tobliq) + cos(tobliq)*sin(beta2));
  59. alpha = atan2(ymp, xmp);
  60. delta = atan2(zmp, sqrt(xmp*xmp+ymp*ymp));
  61. hp = 8.794e0*radsec/rp;
  62. semi /= rp;
  63. if(rad > 0 && rad < 2.e5)
  64. mag += 2.17*log(rad*rp);
  65. }