00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifdef HAVE_CONFIG_H
00025 # include <simgear_config.h>
00026 #endif
00027
00028 #include <iostream>
00029
00030 #include "ephemeris.hxx"
00031
00032
00033
00034 SGEphemeris::SGEphemeris( const std::string &path ) {
00035 our_sun = new Star;
00036 moon = new MoonPos;
00037 mercury = new Mercury;
00038 venus = new Venus;
00039 mars = new Mars;
00040 jupiter = new Jupiter;
00041 saturn = new Saturn;
00042 uranus = new Uranus;
00043 neptune = new Neptune;
00044 nplanets = 7;
00045 for ( int i = 0; i < nplanets; ++i )
00046 planets[i] = SGVec3d::zeros();
00047 stars = new SGStarData( SGPath(path) );
00048 }
00049
00050
00051
00052 SGEphemeris::~SGEphemeris( void ) {
00053 delete our_sun;
00054 delete moon;
00055 delete mercury;
00056 delete venus;
00057 delete mars;
00058 delete jupiter;
00059 delete saturn;
00060 delete uranus;
00061 delete neptune;
00062 delete stars;
00063 }
00064
00065
00066
00067
00068 void SGEphemeris::update( double mjd, double lst, double lat ) {
00069
00070 our_sun->updatePosition( mjd );
00071 moon->updatePosition( mjd, lst, lat, our_sun );
00072 mercury->updatePosition( mjd, our_sun );
00073 venus->updatePosition( mjd, our_sun );
00074 mars->updatePosition( mjd, our_sun );
00075 jupiter->updatePosition( mjd, our_sun );
00076 saturn->updatePosition( mjd, our_sun );
00077 uranus->updatePosition( mjd, our_sun );
00078 neptune->updatePosition( mjd, our_sun );
00079
00080
00081 nplanets = 7;
00082 mercury->getPos( &planets[0][0], &planets[0][1], &planets[0][2] );
00083 venus ->getPos( &planets[1][0], &planets[1][1], &planets[1][2] );
00084 mars ->getPos( &planets[2][0], &planets[2][1], &planets[2][2] );
00085 jupiter->getPos( &planets[3][0], &planets[3][1], &planets[3][2] );
00086 saturn ->getPos( &planets[4][0], &planets[4][1], &planets[4][2] );
00087 uranus ->getPos( &planets[5][0], &planets[5][1], &planets[5][2] );
00088 neptune->getPos( &planets[6][0], &planets[6][1], &planets[6][2] );
00089 }
00090