00001 /************************************************************************** 00002 * saturn.cxx 00003 * Written by Durk Talsma. Originally started October 1997, for distribution 00004 * with the FlightGear project. Version 2 was written in August and 00005 * September 1998. This code is based upon algorithms and data kindly 00006 * provided by Mr. Paul Schlyter. (pausch@saaf.se). 00007 * 00008 * This library is free software; you can redistribute it and/or 00009 * modify it under the terms of the GNU Library General Public 00010 * License as published by the Free Software Foundation; either 00011 * version 2 of the License, or (at your option) any later version. 00012 * 00013 * This library is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 * Library General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU General Public License 00019 * along with this program; if not, write to the Free Software 00020 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00021 * 00022 * $Id: saturn_8cxx-source.html,v 1.15 2007-12-17 15:37:10 curt Exp $ 00023 **************************************************************************/ 00024 00025 #ifdef __BORLANDC__ 00026 # define exception c_exception 00027 #endif 00028 #include <math.h> 00029 00030 #include "saturn.hxx" 00031 00032 /************************************************************************* 00033 * Saturn::Saturn(double mjd) 00034 * Public constructor for class Saturn 00035 * Argument: The current time. 00036 * the hard coded orbital elements for Saturn are passed to 00037 * CelestialBody::CelestialBody(); 00038 ************************************************************************/ 00039 Saturn::Saturn(double mjd) : 00040 CelestialBody(113.6634, 2.3898000E-5, 00041 2.4886, -1.081E-7, 00042 339.3939, 2.9766100E-5, 00043 9.5547500, 0.000000, 00044 0.055546, -9.499E-9, 00045 316.9670, 0.03344422820, mjd) 00046 { 00047 } 00048 Saturn::Saturn() : 00049 CelestialBody(113.6634, 2.3898000E-5, 00050 2.4886, -1.081E-7, 00051 339.3939, 2.9766100E-5, 00052 9.5547500, 0.000000, 00053 0.055546, -9.499E-9, 00054 316.9670, 0.03344422820) 00055 { 00056 } 00057 00058 /************************************************************************* 00059 * void Saturn::updatePosition(double mjd, Star *ourSun) 00060 * 00061 * calculates the current position of Saturn, by calling the base class, 00062 * CelestialBody::updatePosition(); The current magnitude is calculated using 00063 * a Saturn specific equation 00064 *************************************************************************/ 00065 void Saturn::updatePosition(double mjd, Star *ourSun) 00066 { 00067 CelestialBody::updatePosition(mjd, ourSun); 00068 00069 double actTime = sgCalcActTime(mjd); 00070 double ir = 0.4897394; 00071 double Nr = 2.9585076 + 6.6672E-7*actTime; 00072 double B = asin (sin(declination) * cos(ir) - 00073 cos(declination) * sin(ir) * 00074 sin(rightAscension - Nr)); 00075 double ring_magn = -2.6 * sin(fabs(B)) + 1.2 * pow(sin(B), 2); 00076 magnitude = -9.0 + 5*log10(r*R) + 0.044 * FV + ring_magn; 00077 } 00078
1.5.1