head 1.4; access; symbols; locks; strict; comment @# @; 1.4 date 2002.09.07.01.50.38; author curt; state Exp; branches; next 1.3; 1.3 date 2002.08.31.19.01.53; author curt; state Exp; branches; next 1.2; 1.2 date 2002.08.31.18.54.00; author curt; state Exp; branches; next 1.1; 1.1 date 2002.02.15.17.21.56; author curt; state Exp; branches; next ; desc @@ 1.4 log @Updated doxygen docs. @ text @
Main Page Class Hierarchy Compound List File List Compound Members File Members

# ephemeris.cxx

    00001 // ephemeris.cxx -- Top level class for calculating current positions of
    00002 //                  astronomical objects
    00003 //
    00004 // Written by Curtis Olson, started March 2000.
    00005 //
    00006 // Copyright (C) 2000  Curtis L. Olson - curt@@flightgear.org
    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 Library General Public
    00019 // License along with this library; if not, write to the
    00020 // Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00021 // Boston, MA  02111-1307, USA.
    00022 //
    00023 // $Id: ephemeris.cxx,v 1.11 2001/03/25 12:06:10 curt Exp $
    00024
    00025
    00026 #include "ephemeris.hxx"
    00027
    00028
    00029 // Constructor
    00030 SGEphemeris::SGEphemeris( const string &path ) {
    00031     our_sun = new Star;
    00032     moon = new MoonPos;
    00033     mercury = new Mercury;
    00034     venus = new Venus;
    00035     mars = new Mars;
    00036     jupiter = new Jupiter;
    00037     saturn = new Saturn;
    00038     uranus = new Uranus;
    00039     neptune = new Neptune;
    00040     stars = new SGStarData( SGPath(path) );
    00041 }
    00042
    00043
    00044 // Destructor
    00045 SGEphemeris::~SGEphemeris( void ) {
    00046     delete our_sun;
    00047     delete moon;
    00048     delete mercury;
    00049     delete venus;
    00050     delete mars;
    00051     delete jupiter;
    00052     delete saturn;
    00053     delete uranus;
    00054     delete neptune;
    00055     delete stars;
    00056 }
    00057
    00058
    00059 // Update (recalculate) the positions of all objects for the specified
    00060 // time
    00061 void SGEphemeris::update( double mjd, double lst, double lat ) {
    00062     // update object positions
    00063     our_sun->updatePosition( mjd );
    00064     moon->updatePosition( mjd, lst, lat, our_sun );
    00065     mercury->updatePosition( mjd, our_sun );
    00066     venus->updatePosition( mjd, our_sun );
    00067     mars->updatePosition( mjd, our_sun );
    00068     jupiter->updatePosition( mjd, our_sun );
    00069     saturn->updatePosition( mjd, our_sun );
    00070     uranus->updatePosition( mjd, our_sun );
    00071     neptune->updatePosition( mjd, our_sun );
    00072
    00073     // update planets list
    00074     nplanets = 7;
    00075     mercury->getPos( &planets[0][0], &planets[0][1], &planets[0][2] );
    00076     venus  ->getPos( &planets[1][0], &planets[1][1], &planets[1][2] );
    00077     mars   ->getPos( &planets[2][0], &planets[2][1], &planets[2][2] );
    00078     jupiter->getPos( &planets[3][0], &planets[3][1], &planets[3][2] );
    00079     saturn ->getPos( &planets[4][0], &planets[4][1], &planets[4][2] );
    00080     uranus ->getPos( &planets[5][0], &planets[5][1], &planets[5][2] );
    00081     neptune->getPos( &planets[6][0], &planets[6][1], &planets[6][2] );
    00082 }
    00083

@ 1.3 log @Oops, try again. @ text @d92 1 a92 1