Fix order of arguments passed to deflect()

The poor behavior was discovered thanks to PyEphem testing by @aendie,
reported in: https://github.com/brandon-rhodes/pyephem/issues/220
This commit is contained in:
Brandon Rhodes 2021-11-22 17:34:07 -05:00
parent 426a7bbe21
commit ff85c47db1
1 changed files with 3 additions and 2 deletions

View File

@ -4,6 +4,7 @@
* Michael Sternberg <sternberg@physik.tu-chemnitz.de>
* 3/11/98: deflect was using op->s_hlong before being set in cir_pos().
* 4/19/98: just edit a comment
* 11/22/21: un-swapped arguments "rsn, lsn" in both calls to deflect().
*/
#include <stdio.h>
@ -253,7 +254,7 @@ obj_fixed (Now *np, Obj *op)
sunpos (mjed, &lsn, &rsn, NULL);
/* allow for relativistic light bending near the sun */
deflect (mjed, lam, bet, lsn, rsn, 1e10, &ra, &dec);
deflect (mjed, lam, bet, rsn, lsn, 1e10, &ra, &dec);
/* TODO: correction for annual parallax would go here */
@ -697,7 +698,7 @@ Obj *op) /* object to set s_ra/dec as per equinox */
* (avoid calling deflect() for the sun itself).
*/
if (!is_planet(op,SUN) && !is_planet(op,MOON))
deflect (mjed, op->s_hlong, op->s_hlat, lsn, rsn, *rho, &ra, &dec);
deflect (mjed, op->s_hlong, op->s_hlat, rsn, lsn, *rho, &ra, &dec);
/* correct ra/dec to form geocentric apparent */
nut_eq (mjed, &ra, &dec);