]> git.mxchange.org Git - simgear.git/blobdiff - simgear/ephemeris/ephemeris.cxx
math: Move lerp function into SGMisc.
[simgear.git] / simgear / ephemeris / ephemeris.cxx
index 2f96b9bc2698663f7ad1e5068cd4c862545d9bd9..a05481bdfde8d1bf938a5ec30d348c02c8b92b07 100644 (file)
@@ -3,32 +3,37 @@
 //
 // Written by Curtis Olson, started March 2000.
 //
-// Copyright (C) 2000  Curtis L. Olson - curt@flightgear.org
+// Copyright (C) 2000  Curtis L. Olson - http://www.flightgear.org/~curt
 //
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of the
-// License, or (at your option) any later version.
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
 //
-// This program is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// General Public License for more details.
+// Library General Public License for more details.
 //
 // You should have received a copy of the GNU General Public License
 // along with this program; if not, write to the Free Software
-// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 //
 // $Id$
 
+#ifdef HAVE_CONFIG_H
+#  include <simgear_config.h>
+#endif
+
+#include <iostream>
 
 #include "ephemeris.hxx"
 
 
 // Constructor
-FGEphemeris::FGEphemeris( void ) {
+SGEphemeris::SGEphemeris( const std::string &path ) {
     our_sun = new Star;
-    moon = new Moon;
+    moon = new MoonPos;
     mercury = new Mercury;
     venus = new Venus;
     mars = new Mars;
@@ -36,11 +41,15 @@ FGEphemeris::FGEphemeris( void ) {
     saturn = new Saturn;
     uranus = new Uranus;
     neptune = new Neptune;
+    nplanets = 7;
+    for ( int i = 0; i < nplanets; ++i )
+      planets[i] = SGVec3d::zeros();
+    stars = new SGStarData( SGPath(path) );
 }
 
 
 // Destructor
-FGEphemeris::~FGEphemeris( void ) {
+SGEphemeris::~SGEphemeris( void ) {
     delete our_sun;
     delete moon;
     delete mercury;
@@ -50,22 +59,23 @@ FGEphemeris::~FGEphemeris( void ) {
     delete saturn;
     delete uranus;
     delete neptune;
+    delete stars;
 }
 
 
 // Update (recalculate) the positions of all objects for the specified
 // time
-void FGEphemeris::update( FGTime *t, double lat ) {
+void SGEphemeris::update( double mjd, double lst, double lat ) {
     // update object positions
-    our_sun->updatePosition( t );
-    moon->updatePosition( t, lat, our_sun );
-    mercury->updatePosition( t, our_sun );
-    venus->updatePosition( t, our_sun );
-    mars->updatePosition( t, our_sun );
-    jupiter->updatePosition( t, our_sun );
-    saturn->updatePosition( t, our_sun );
-    uranus->updatePosition( t, our_sun );
-    neptune->updatePosition( t, our_sun );
+    our_sun->updatePosition( mjd );
+    moon->updatePosition( mjd, lst, lat, our_sun );
+    mercury->updatePosition( mjd, our_sun );
+    venus->updatePosition( mjd, our_sun );
+    mars->updatePosition( mjd, our_sun );
+    jupiter->updatePosition( mjd, our_sun );
+    saturn->updatePosition( mjd, our_sun );
+    uranus->updatePosition( mjd, our_sun );
+    neptune->updatePosition( mjd, our_sun );
 
     // update planets list
     nplanets = 7;