Commit 350c4904 authored by Jeroen Vreeken's avatar Jeroen Vreeken Committed by Michel Roelofs
Browse files

Add void ln_get_equ_aber_rev (struct ln_equ_posn * position, double JD, struct...

Add void ln_get_equ_aber_rev (struct ln_equ_posn * position, double JD, struct ln_equ_posn * mean_position)

Calculate mea equatorial coordinates undoing the effects of aberration.
parent 2a385e30
......@@ -14,6 +14,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Copyright (C) 2000 - 2005 Liam Girdwood
* Copyright (C) 2009 Jeroen Vreeken (pe1rxq@amsat.org)
*/
#include <math.h>
......@@ -261,6 +262,12 @@ void ln_get_equ_aber (struct ln_equ_posn * mean_position, double JD, struct ln_e
mean_dec = ln_deg_to_rad (mean_position->dec);
delta_ra = (Y * cos(mean_ra) - X * sin(mean_ra)) / (c * cos(mean_dec));
if (isinf(delta_ra) || isnan(delta_ra) || fabs(delta_ra) > M_PI) {
/* Results get a bit crazy when mean declination approaches 90 degrees:
division by 0 gives inf,-inf or nan.
division by almost zero gives ridiculously large delta_ra. */
delta_ra = 0.0;
}
delta_dec = (X * cos(mean_ra) + Y * sin(mean_ra)) * sin(mean_dec) - Z * cos(mean_dec);
delta_dec /= -c;
......@@ -268,6 +275,75 @@ void ln_get_equ_aber (struct ln_equ_posn * mean_position, double JD, struct ln_e
position->dec = ln_rad_to_deg(mean_dec + delta_dec);
}
/*! \fn void ln_get_equ_aber_rev (struct ln_equ_posn * position, double JD, struct ln_equ_posn * mean_position)
* \param position position of object
* \param JD Julian Day
* \param mean_position Pointer to store new object mean position.
*
* Calculate a stars mean equatorial coordinates from it's equatorial coordinates
* with the effects of aberration and nutation for a given Julian Day.
*/
/* Equ 22.1, 22.1, 22.3, 22.4
*/
void ln_get_equ_mean_from_aber (struct ln_equ_posn * position, double JD, struct ln_equ_posn * mean_position)
{
long double ra, dec, delta_ra, delta_dec;
long double L2, L3, L4, L5, L6, L7, L8, LL, D, MM , F, T, X, Y, Z, A;
long double c;
int i;
/* speed of light in 10-8 au per day */
c = 17314463350.0;
/* calc T */
T = (JD - 2451545.0) / 36525.0;
/* calc planetary perturbutions */
L2 = 3.1761467 + 1021.3285546 * T;
L3 = 1.7534703 + 628.3075849 * T;
L4 = 6.2034809 + 334.0612431 * T;
L5 = 0.5995464 + 52.9690965 * T;
L6 = 0.8740168 + 21.329909095 * T;
L7 = 5.4812939 + 7.4781599 * T;
L8 = 5.3118863 + 3.8133036 * T;
LL = 3.8103444 + 8399.6847337 * T;
D = 5.1984667 + 7771.3771486 * T;
MM = 2.3555559 + 8328.6914289 * T;
F = 1.6279052 + 8433.4661601 * T;
X = 0;
Y = 0;
Z = 0;
/* sum the terms */
for (i=0; i<TERMS; i++) {
A = arguments[i].a_L2 * L2 + arguments[i].a_L3 * L3 + arguments[i].a_L4 * L4 + arguments[i].a_L5 * L5 + arguments[i].a_L6 * L6 +
arguments[i].a_L7 * L7 + arguments[i].a_L8 * L8 + arguments[i].a_LL * LL + arguments[i].a_D * D + arguments[i].a_MM * MM +
arguments[i].a_F * F;
X += (x_coefficients[i].sin1 + x_coefficients[i].sin2 * T) * sin (A) + (x_coefficients[i].cos1 + x_coefficients[i].cos2 * T) * cos (A);
Y += (y_coefficients[i].sin1 + y_coefficients[i].sin2 * T) * sin (A) + (y_coefficients[i].cos1 + y_coefficients[i].cos2 * T) * cos (A);
Z += (z_coefficients[i].sin1 + z_coefficients[i].sin2 * T) * sin (A) + (z_coefficients[i].cos1 + z_coefficients[i].cos2 * T) * cos (A);
}
/* Equ 22.4 */
ra = ln_deg_to_rad (position->ra);
dec = ln_deg_to_rad (position->dec);
delta_ra = (Y * cos(ra) - X * sin(ra)) / (c * cos(dec));
if (isinf(delta_ra) || isnan(delta_ra) || fabs(delta_ra) > M_PI) {
/* Results get a bit crazy when mean declination approaches 90 degrees:
division by 0 gives inf,-inf or nan.
division by almost zero gives ridiculously large delta_ra. */
delta_ra = 0.0;
}
delta_dec = (X * cos(ra) + Y * sin(ra)) * sin(dec) - Z * cos(dec);
delta_dec /= -c;
mean_position->ra = ln_rad_to_deg(ra - delta_ra);
mean_position->dec = ln_rad_to_deg(dec - delta_dec);
}
/*! \fn void ln_get_ecl_aber (struct ln_lnlat_posn * mean_position, double JD, struct ln_lnlat_posn * position)
* \param mean_position Mean position of object
* \param JD Julian Day
......
......@@ -14,6 +14,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Copyright (C) 2000 - 2005 Liam Girdwood
* Copyright (C) 2009 Jeroen Vreeken (pe1rxq@amsat.org)
*/
......@@ -40,6 +41,12 @@ extern "C" {
/* Equ 22.1, 22.3, 22.4 and Ron-Vondrak expression */
void LIBNOVA_EXPORT ln_get_equ_aber (struct ln_equ_posn * mean_position, double JD, struct ln_equ_posn * position);
/*! \fn void ln_get_equ_aber_rev (struct ln_equ_posn * position, double JD, struct ln_equ_posn * mean_position)
* /brief Calculate mea equatorial coordinates undoing the effects of aberration.
* Equ 22.1, 22.1, 22.3, 22.4
*/
void ln_get_equ_mean_from_aber (struct ln_equ_posn * position, double JD, struct ln_equ_posn * mean_position);
/*! \fn void ln_get_ecl_aber (struct ln_lnlat_posn * mean_position, double JD, struct ln_lnlat_posn * position);
* \brief Calculate ecliptical coordinates with the effects of aberration.
* \ingroup aberration
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment