1 /* 2 * This library is free software; you can redistribute it and/or 3 * modify it under the terms of the GNU Lesser General Public 4 * License as published by the Free Software Foundation; either 5 * version 2 of the License, or (at your option) any later version. 6 * 7 * This library is distributed in the hope that it will be useful, 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 10 * Lesser General Public License for more details. 11 * 12 * You should have received a copy of the GNU General Public License 13 * along with this program; if not, write to the Free Software 14 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 15 * 16 * Copyright (C) 2000 - 2005 Liam Girdwood <lgirdwood@gmail.com> 17 */ 18 19 module nova.proper_motion; 20 21 import nova.utility; 22 import nova.ln_types; 23 24 extern (C) { 25 26 /* 27 ** Proper Motion. 28 */ 29 30 /*! \fn void ln_get_equ_pm(struct ln_equ_posn *mean_position, struct ln_equ_posn *proper_motion, double JD, struct ln_equ_posn *position) 31 * \param mean_position Mean position of object. 32 * \param proper_motion Annual Proper motion of object. 33 * \param JD Julian Day. 34 * \param position Pointer to store new object position. 35 * 36 * Calculate a stars equatorial coordinates from it's mean coordinates (J2000.0) 37 * with the effects of proper motion for a given Julian Day. 38 */ 39 /* Example 20.b pg 126 40 */ 41 @nogc void ln_get_equ_pm(const ref ln_equ_posn mean_position, 42 const ref ln_equ_posn proper_motion, double JD, ref ln_equ_posn position) nothrow 43 { 44 ln_get_equ_pm_epoch (mean_position, proper_motion, JD, JD2000, position); 45 } 46 47 /*! 48 * \param mean_position Mean position of object. 49 * \param proper_motion Annual Proper motion of object. 50 * \param JD Julian Day. 51 * \param epoch_JD Mean position epoch in JD 52 * \param position Pointer to store new object position. 53 * 54 * Calculate a stars equatorial coordinates from it's mean coordinates and epoch 55 * with the effects of proper motion for a given Julian Day. 56 */ 57 /* Example 20.b, pg 126 58 */ 59 @nogc void ln_get_equ_pm_epoch(const ref ln_equ_posn mean_position, 60 const ref ln_equ_posn proper_motion, double JD, double epoch_JD, 61 ref ln_equ_posn position) nothrow 62 { 63 real T; 64 65 T = (JD - epoch_JD) / 365.25; 66 67 /* calc proper motion */ 68 position.ra = mean_position.ra + T * proper_motion.ra; 69 position.dec = mean_position.dec + T * proper_motion.dec; 70 71 /* change to degrees */ 72 position.ra = ln_range_degrees(position.ra); 73 } 74 75 }