helio.c 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. * This file is part of the UCB release of Plan 9. It is subject to the license
  3. * terms in the LICENSE file found in the top-level directory of this
  4. * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
  5. * part of the UCB release of Plan 9, including this file, may be copied,
  6. * modified, propagated, or distributed except according to the terms contained
  7. * in the LICENSE file.
  8. */
  9. #include "astro.h"
  10. void
  11. helio(void)
  12. {
  13. /*
  14. * uses lambda, beta, rad, motion
  15. * sets alpha, delta, rp
  16. */
  17. /*
  18. * helio converts from ecliptic heliocentric coordinates
  19. * referred to the mean equinox of date
  20. * to equatorial geocentric coordinates referred to
  21. * the true equator and equinox
  22. */
  23. double xmp, ymp, zmp;
  24. double beta2;
  25. /*
  26. * compute geocentric distance of object and
  27. * compute light-time correction (i.i. planetary aberration)
  28. */
  29. xmp = rad*cos(beta)*cos(lambda);
  30. ymp = rad*cos(beta)*sin(lambda);
  31. zmp = rad*sin(beta);
  32. rp = sqrt((xmp+xms)*(xmp+xms) +
  33. (ymp+yms)*(ymp+yms) +
  34. (zmp+zms)*(zmp+zms));
  35. lmb2 = lambda - .0057756e0*rp*motion;
  36. xmp = rad*cos(beta)*cos(lmb2);
  37. ymp = rad*cos(beta)*sin(lmb2);
  38. zmp = rad*sin(beta);
  39. /*
  40. * compute annual parallax from the position of the sun
  41. */
  42. xmp += xms;
  43. ymp += yms;
  44. zmp += zms;
  45. rp = sqrt(xmp*xmp + ymp*ymp + zmp*zmp);
  46. /*
  47. * compute annual (i.e. stellar) aberration
  48. * from the orbital velocity of the earth
  49. * (by an incorrect method)
  50. */
  51. xmp -= xdot*rp;
  52. ymp -= ydot*rp;
  53. zmp -= zdot*rp;
  54. /*
  55. * perform the nutation and so convert from the mean
  56. * equator and equinox to the true
  57. */
  58. lmb2 = atan2(ymp, xmp);
  59. beta2 = atan2(zmp, sqrt(xmp*xmp+ymp*ymp));
  60. lmb2 += phi;
  61. /*
  62. * change to equatorial coordinates
  63. */
  64. xmp = rp*cos(lmb2)*cos(beta2);
  65. ymp = rp*(sin(lmb2)*cos(beta2)*cos(tobliq) - sin(tobliq)*sin(beta2));
  66. zmp = rp*(sin(lmb2)*cos(beta2)*sin(tobliq) + cos(tobliq)*sin(beta2));
  67. alpha = atan2(ymp, xmp);
  68. delta = atan2(zmp, sqrt(xmp*xmp+ymp*ymp));
  69. hp = 8.794e0*radsec/rp;
  70. semi /= rp;
  71. if(rad > 0 && rad < 2.e5)
  72. mag += 2.17*log(rad*rp);
  73. }