]> git.mxchange.org Git - flightgear.git/commitdiff
New textured moon and rewritten/restructured Astro code contributed by Durk
authorcurt <curt>
Tue, 15 Sep 1998 04:26:07 +0000 (04:26 +0000)
committercurt <curt>
Tue, 15 Sep 1998 04:26:07 +0000 (04:26 +0000)
Talsma.

33 files changed:
Astro/Makefile.am
Astro/celestialBody.cxx [new file with mode: 0644]
Astro/celestialBody.hxx [new file with mode: 0644]
Astro/jupiter.cxx [new file with mode: 0644]
Astro/jupiter.hxx [new file with mode: 0644]
Astro/mars.cxx [new file with mode: 0644]
Astro/mars.hxx [new file with mode: 0644]
Astro/mercury.cxx [new file with mode: 0644]
Astro/mercury.hxx [new file with mode: 0644]
Astro/moon.cxx
Astro/moon.hxx
Astro/neptune.cxx [new file with mode: 0644]
Astro/neptune.hxx [new file with mode: 0644]
Astro/orbits.cxx [deleted file]
Astro/orbits.hxx [deleted file]
Astro/planets.cxx [deleted file]
Astro/planets.hxx [deleted file]
Astro/pluto.hxx [new file with mode: 0644]
Astro/saturn.cxx [new file with mode: 0644]
Astro/saturn.hxx [new file with mode: 0644]
Astro/solarsystem.cxx [new file with mode: 0644]
Astro/solarsystem.cxx~ [new file with mode: 0644]
Astro/solarsystem.hxx [new file with mode: 0644]
Astro/star.cxx [new file with mode: 0644]
Astro/star.hxx [new file with mode: 0644]
Astro/stars.cxx
Astro/stars.hxx
Astro/sun.cxx [deleted file]
Astro/sun.hxx [deleted file]
Astro/uranus.cxx [new file with mode: 0644]
Astro/uranus.hxx [new file with mode: 0644]
Astro/venus.cxx [new file with mode: 0644]
Astro/venus.hxx [new file with mode: 0644]

index 0c835ceeb0624367bf3898bd05b5d385808b9323..505e24b543da359f708ffcc304513774f76f5c58 100644 (file)
@@ -1,11 +1,18 @@
 noinst_LIBRARIES = libAstro.a
 
 libAstro_a_SOURCES = \
+       celestialBody.cxx celestialBody.hxx \
+       jupiter.cxx jupiter.hxx \
+       mars.cxx mars.hxx \
+       mercury.cxx mercury.hxx \
        moon.cxx moon.hxx \
-       orbits.cxx orbits.hxx \
-       planets.cxx planets.hxx \
+       neptune.cxx neptune.hxx \
+       saturn.cxx saturn.hxx \
        sky.cxx sky.hxx \
+       solarsystem.cxx solarsystem.hxx \
+       star.cxx star.hxx \
        stars.cxx stars.hxx \
-       sun.cxx sun.hxx
+       uranus.cxx uranus.hxx \
+       venus.cxx venus.hxx
 
 INCLUDES += -I$(top_builddir) -I$(top_builddir)/Lib -I$(top_builddir)/Simulator
diff --git a/Astro/celestialBody.cxx b/Astro/celestialBody.cxx
new file mode 100644 (file)
index 0000000..ede620f
--- /dev/null
@@ -0,0 +1,152 @@
+/**************************************************************************
+ * celestialBody.cxx
+ * Written by Durk Talsma. Originally started October 1997, for distribution  
+ * with the FlightGear project. Version 2 was written in August and 
+ * September 1998. This code is based upon algorithms and data kindly 
+ * provided by Mr. Paul Schlyter. (pausch@saaf.se). 
+ *
+ * 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 program 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.
+ *
+ * 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.
+ *
+ * $Id$
+ * (Log is kept at end of this file)
+ **************************************************************************/
+
+#include "celestialBody.hxx"
+#include "star.hxx"
+#include <Debug/fg_debug.h>
+
+/**************************************************************************
+ * void CelestialBody::updatePosition(fgTIME *t, Star *ourSun)
+ *
+ * Basically, this member function provides a general interface for 
+ * calculating the right ascension and declinaion. This function is 
+ * used for calculating the planetary positions. For the planets, an 
+ * overloaded member function is provided to additionally calculate the
+ * planet's magnitude. 
+ * The sun and moon have their own overloaded updatePosition member, as their
+ * position is calculated an a slightly different manner.  
+ *
+ * arguments:
+ * fgTIME t: provides the current time.
+ * Star *ourSun: the sun's position is needed to convert heliocentric 
+ *               coordinates into geocentric coordinates.
+ *
+ * return value: none
+ *
+ *************************************************************************/
+void CelestialBody::updatePosition(fgTIME *t, Star *ourSun)
+{
+  double eccAnom, v, ecl, actTime, 
+    xv, yv, xh, yh, zh, xg, yg, zg, xe, ye, ze;
+
+  updateOrbElements(t);
+  actTime = fgCalcActTime(t);
+
+  // calcualate the angle bewteen ecliptic and equatorial coordinate system
+  ecl = DEG_TO_RAD * (23.4393 - 3.563E-7 *actTime);
+  
+  eccAnom = fgCalcEccAnom(M, e);  //calculate the eccentric anomaly
+  xv = a * (cos(eccAnom) - e);
+  yv = a * (sqrt (1.0 - e*e) * sin(eccAnom));
+  v = atan2(yv, xv);           // the planet's true anomaly
+  r = sqrt (xv*xv + yv*yv);    // the planet's distance
+  
+  // calculate the planet's position in 3D space
+  xh = r * (cos(N) * cos(v+w) - sin(N) * sin(v+w) * cos(i));
+  yh = r * (sin(N) * cos(v+w) + cos(N) * sin(v+w) * cos(i));
+  zh = r * (sin(v+w) * sin(i));
+
+  // calculate the ecliptic longitude and latitude
+  xg = xh + ourSun->getxs();
+  yg = yh + ourSun->getys();
+  zg = zh;
+  
+  xe = xg;
+  ye = yg * cos(ecl) - zg * sin(ecl);
+  ze = yg * sin(ecl) + zg * cos(ecl);
+  rightAscension = atan2(ye, xe);
+  declination = atan2(ze, sqrt(xe*xe + ye*ye));
+  fgPrintf(FG_GENERAL, FG_INFO, "Planet found at : %f (ra), %f (dec)\n", 
+          rightAscension, declination);
+
+  //calculate some variables specific to calculating the magnitude 
+  //of the planet
+  R = sqrt (xg*xg + yg*yg + zg*zg);
+  s = ourSun->getDistance();
+  FV = RAD_TO_DEG * acos( (r*r + R*R - s*s) / (2*r*R));
+};
+
+/****************************************************************************
+ * double CelestialBody::fgCalcEccAnom(double M, double e)
+ * this private member calculates the eccentric anomaly of a celestial body, 
+ * given its mean anomaly and eccentricity.
+ * 
+ * -Mean anomaly: the approximate angle between the perihelion and the current
+ *  position. this angle increases uniformly with time.
+ *
+ * True anomaly: the actual angle between perihelion and current position.
+ *
+ * Eccentric anomaly: this is an auxilary angle, used in calculating the true
+ * anomaly from the mean anomaly.
+ * 
+ * -eccentricity. Indicates the amount in which the orbit deviates from a 
+ *  circle (0 = circle, 0-1, is ellipse, 1 = parabola, > 1 = hyperbola).
+ *
+ * This function is also known as solveKeplersEquation()
+ *
+ * arguments: 
+ * M: the mean anomaly
+ * e: the eccentricity
+ *
+ * return value:
+ * the eccentric anomaly
+ *
+ ****************************************************************************/
+double CelestialBody::fgCalcEccAnom(double M, double e)
+{
+  double 
+    eccAnom, E0, E1, diff;
+  
+  eccAnom = M + e * sin(M) * (1.0 + e * cos (M));
+  // iterate to achieve a greater precision for larger eccentricities 
+  if (e > 0.05)
+    {
+      E0 = eccAnom;
+      do
+       {
+         E1 = E0 - (E0 - e * sin(E0) - M) / (1 - e *cos(E0));
+         diff = fabs(E0 - E1);
+         E0 = E1;
+       }
+      while (diff > (DEG_TO_RAD * 0.001));
+      return E0;
+    }
+  return eccAnom;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Astro/celestialBody.hxx b/Astro/celestialBody.hxx
new file mode 100644 (file)
index 0000000..9b78b7f
--- /dev/null
@@ -0,0 +1,185 @@
+/**************************************************************************
+ * celestialBody.hxx
+ * Written by Durk Talsma. Originally started October 1997, for distribution  
+ * with the FlightGear project. Version 2 was written in August and 
+ * September 1998. This code is based upon algorithms and data kindly 
+ * provided by Mr. Paul Schlyter. (pausch@saaf.se). 
+ *
+ * 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 program 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.
+ *
+ * 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.
+ *
+ * $Id$
+ * (Log is kept at end of this file)
+ **************************************************************************/
+#ifndef _CELESTIALBODY_H_
+#define _CELESTIALBODY_H_
+
+#ifndef __cplusplus                                                          
+# error This library requires C++
+#endif                                   
+
+
+#include <stdio.h>
+#include <math.h>
+
+#include <Time/fg_time.hxx>
+#include <Include/fg_constants.h>
+
+class Star;
+
+class CelestialBody
+{
+protected:              // make the data protected, in order to give the inherited
+                        // classes direct access to the data
+  double NFirst;               /* longitude of the ascending node first part */
+  double NSec;         /* longitude of the ascending node second part */
+  double iFirst;               /* inclination to the ecliptic first part */
+  double iSec;         /* inclination to the ecliptic second part */
+  double wFirst;               /* first part of argument of perihelion */
+  double wSec;         /* second part of argument of perihelion */
+  double aFirst;               /* semimayor axis first part*/
+  double aSec;         /* semimayor axis second part */
+  double eFirst;               /* eccentricity first part */
+  double eSec;         /* eccentricity second part */
+  double MFirst;               /* Mean anomaly first part */
+  double MSec;         /* Mean anomaly second part */
+
+  double N, i, w, a, e, M; /* the resulting orbital elements, obtained from the former */
+
+  double rightAscension, declination;
+  double r, R, s, FV;
+  double magnitude;
+
+  double fgCalcEccAnom(double M, double e);
+  double fgCalcActTime(fgTIME *t);
+  void updateOrbElements(fgTIME *t);
+
+public:
+  CelestialBody(double Nf, double Ns,
+               double If, double Is,
+               double wf, double ws,
+               double af, double as,
+               double ef, double es,
+               double Mf, double Ms, fgTIME *t);
+  void getPos(double *ra, double *dec);
+  void getPos(double *ra, double *dec, double *magnitude);
+  void updatePosition(fgTIME *t, Star *ourSun);
+};
+
+/*****************************************************************************
+ * inline CelestialBody::CelestialBody
+ * public constructor for a generic celestialBody object.
+ * initializes the 6 primary orbital elements. The elements are:
+ * N: longitude of the ascending node
+ * i: inclination to the ecliptic
+ * w: argument of perihelion
+ * a: semi-major axis, or mean distance from the sun
+ * e: eccenticity
+ * M: mean anomaly
+ * Each orbital element consists of a constant part and a variable part that 
+ * gradually changes over time. 
+ *
+ * Argumetns:
+ * the 13 arguments to the constructor constitute the first, constant 
+ * ([NiwaeM]f) and the second variable ([NiwaeM]s) part of the orbital 
+ * elements. The 13th argument is the current time. Note that the inclination
+ * is written with a capital (If, Is), because 'if' is a reserved word in the 
+ * C/C++ programming language.
+ ***************************************************************************/ 
+inline CelestialBody::CelestialBody(double Nf, double Ns,
+                                   double If, double Is,
+                                   double wf, double ws,
+                                   double af, double as,
+                                   double ef, double es,
+                                   double Mf, double Ms, fgTIME *t)
+{
+  NFirst = Nf;     NSec = Ns;
+  iFirst = If;     iSec = Is;
+  wFirst = wf;     wSec = ws;
+  aFirst = af;     aSec = as;
+  eFirst = ef;     eSec = es;
+  MFirst = Mf;     MSec = Ms;
+  updateOrbElements(t);
+};
+
+/****************************************************************************
+ * inline void CelestialBody::updateOrbElements(fgTIME *t)
+ * given the current time, this private member calculates the actual 
+ * orbital elements
+ *
+ * Arguments: fgTIME *t: the current time:
+ *
+ * return value: none
+ ***************************************************************************/
+inline void CelestialBody::updateOrbElements(fgTIME *t)
+{
+  double actTime = fgCalcActTime(t);
+   M = DEG_TO_RAD * (MFirst + (MSec * actTime));
+   w = DEG_TO_RAD * (wFirst + (wSec * actTime));
+   N = DEG_TO_RAD * (NFirst + (NSec * actTime));
+   i = DEG_TO_RAD * (iFirst + (iSec * actTime));
+   e = eFirst + (eSec * actTime);
+   a = aFirst + (aSec * actTime);
+}
+/*****************************************************************************
+ * inline double CelestialBody::fgCalcActTime(fgTIME *t)
+ * this private member function returns the offset in days from the epoch for
+ * wich the orbital elements are calculated (Jan, 1st, 2000).
+ * 
+ * Argument: the current time
+ *
+ * return value: the (fractional) number of days until Jan 1, 2000.
+ ****************************************************************************/
+inline double CelestialBody::fgCalcActTime(fgTIME *t)
+{
+  return (t->mjd - 36523.5);
+}
+
+/*****************************************************************************
+ * inline void CelestialBody::getPos(double* ra, double* dec)
+ * gives public access to Right Ascension and declination
+ *
+ ****************************************************************************/
+inline void CelestialBody::getPos(double* ra, double* dec)
+{
+  *ra  = rightAscension;
+  *dec = declination;
+}
+
+/*****************************************************************************
+ * inline void CelestialBody::getPos(double* ra, double* dec, double* magnitude
+ * gives public acces to the current Right ascension, declination, and 
+ * magnitude
+ ****************************************************************************/
+inline void CelestialBody::getPos(double* ra, double* dec, double* magn)
+{
+  *ra = rightAscension;
+  *dec = declination;
+  *magn = magnitude;
+}
+
+
+#endif // _CELESTIALBODY_H_
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Astro/jupiter.cxx b/Astro/jupiter.cxx
new file mode 100644 (file)
index 0000000..cde5521
--- /dev/null
@@ -0,0 +1,60 @@
+/**************************************************************************
+ * jupiter.cxx
+ * Written by Durk Talsma. Originally started October 1997, for distribution  
+ * with the FlightGear project. Version 2 was written in August and 
+ * September 1998. This code is based upon algorithms and data kindly 
+ * provided by Mr. Paul Schlyter. (pausch@saaf.se). 
+ *
+ * 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 program 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.
+ *
+ * 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.
+ *
+ * $Id$
+ * (Log is kept at end of this file)
+ **************************************************************************/
+
+#include "jupiter.hxx"
+
+/*************************************************************************
+ * Jupiter::Jupiter(fgTIME *t)
+ * Public constructor for class Jupiter
+ * Argument: The current time.
+ * the hard coded orbital elements for Jupiter are passed to 
+ * CelestialBody::CelestialBody();
+ ************************************************************************/
+Jupiter::Jupiter(fgTIME *t) :
+  CelestialBody(100.4542,  2.7685400E-5,       
+               1.3030,   -1.557E-7,
+               273.8777,  1.6450500E-5,
+               5.2025600, 0.000000,
+               0.048498,  4.469E-9,
+               19.89500,  0.08308530010, t)
+{
+}
+
+/*************************************************************************
+ * void Jupiter::updatePosition(fgTIME *t, Star *ourSun)
+ * 
+ * calculates the current position of Jupiter, by calling the base class,
+ * CelestialBody::updatePosition(); The current magnitude is calculated using 
+ * a Jupiter specific equation
+ *************************************************************************/
+void Jupiter::updatePosition(fgTIME *t, Star *ourSun)
+{
+  CelestialBody::updatePosition(t, ourSun);
+  magnitude = -9.25 + 5*log10( r*R ) + 0.014 * FV;
+}
+
+
+
+
diff --git a/Astro/jupiter.hxx b/Astro/jupiter.hxx
new file mode 100644 (file)
index 0000000..13cdd76
--- /dev/null
@@ -0,0 +1,39 @@
+/**************************************************************************
+ * jupiter.hxx
+ * Written by Durk Talsma. Originally started October 1997, for distribution  
+ * with the FlightGear project. Version 2 was written in August and 
+ * September 1998. This code is based upon algorithms and data kindly 
+ * provided by Mr. Paul Schlyter. (pausch@saaf.se). 
+ *
+ * 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 program 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.
+ *
+ * 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.
+ *
+ * $Id$
+ * (Log is kept at end of this file)
+ **************************************************************************/
+#ifndef _JUPITER_HXX_
+#define _JUPITER_HXX_
+
+#include <Time/fg_time.hxx>
+#include "celestialBody.hxx"
+#include "star.hxx"
+
+class Jupiter : public CelestialBody
+{
+public:
+  Jupiter (fgTIME *t);
+  void updatePosition(fgTIME *t, Star *ourSun);
+};
+
+#endif // _JUPITER_HXX_
diff --git a/Astro/mars.cxx b/Astro/mars.cxx
new file mode 100644 (file)
index 0000000..ccfc599
--- /dev/null
@@ -0,0 +1,54 @@
+/**************************************************************************
+ * mars.cxx
+ * Written by Durk Talsma. Originally started October 1997, for distribution  
+ * with the FlightGear project. Version 2 was written in August and 
+ * September 1998. This code is based upon algorithms and data kindly 
+ * provided by Mr. Paul Schlyter. (pausch@saaf.se). 
+ *
+ * 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 program 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.
+ *
+ * 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.
+ *
+ * $Id$
+ * (Log is kept at end of this file)
+ **************************************************************************/
+#include "mars.hxx"
+
+/*************************************************************************
+ * Mars::Mars(fgTIME *t)
+ * Public constructor for class Mars
+ * Argument: The current time.
+ * the hard coded orbital elements for Mars are passed to 
+ * CelestialBody::CelestialBody();
+ ************************************************************************/
+Mars::Mars(fgTIME *t) :
+  CelestialBody(49.55740,  2.1108100E-5,
+               1.8497,   -1.78E-8,
+               286.5016,  2.9296100E-5,
+               1.5236880, 0.000000,
+               0.093405,  2.516E-9,
+               18.60210,  0.52402077660, t)
+{
+}
+/*************************************************************************
+ * void Mars::updatePosition(fgTIME *t, Star *ourSun)
+ * 
+ * calculates the current position of Mars, by calling the base class,
+ * CelestialBody::updatePosition(); The current magnitude is calculated using 
+ * a Mars specific equation
+ *************************************************************************/
+void Mars::updatePosition(fgTIME *t, Star *ourSun)
+{
+  CelestialBody::updatePosition(t, ourSun);
+  magnitude = -1.51 + 5*log10( r*R ) + 0.016 * FV;
+}
diff --git a/Astro/mars.hxx b/Astro/mars.hxx
new file mode 100644 (file)
index 0000000..8b7c326
--- /dev/null
@@ -0,0 +1,39 @@
+/**************************************************************************
+ * mars.hxx
+ * Written by Durk Talsma. Originally started October 1997, for distribution  
+ * with the FlightGear project. Version 2 was written in August and 
+ * September 1998. This code is based upon algorithms and data kindly 
+ * provided by Mr. Paul Schlyter. (pausch@saaf.se). 
+ *
+ * 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 program 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.
+ *
+ * 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.
+ *
+ * $Id$
+ * (Log is kept at end of this file)
+ **************************************************************************/
+#ifndef _MARS_HXX_
+#define _MARS_HXX_
+
+#include <Time/fg_time.hxx>
+#include "celestialBody.hxx"
+#include "star.hxx"
+
+class Mars : public CelestialBody
+{
+public:
+  Mars ( fgTIME *t);
+  void updatePosition(fgTIME *t, Star *ourSun);
+};
+
+#endif // _MARS_HXX_
diff --git a/Astro/mercury.cxx b/Astro/mercury.cxx
new file mode 100644 (file)
index 0000000..104a9da
--- /dev/null
@@ -0,0 +1,56 @@
+/**************************************************************************
+ * mercury.cxx
+ * Written by Durk Talsma. Originally started October 1997, for distribution  
+ * with the FlightGear project. Version 2 was written in August and 
+ * September 1998. This code is based upon algorithms and data kindly 
+ * provided by Mr. Paul Schlyter. (pausch@saaf.se). 
+ *
+ * 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 program 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.
+ *
+ * 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.
+ *
+ * $Id$
+ * (Log is kept at end of this file)
+ **************************************************************************/
+#include "mercury.hxx"
+
+/*************************************************************************
+ * Mercury::Mercury(fgTIME *t)
+ * Public constructor for class Mercury
+ * Argument: The current time.
+ * the hard coded orbital elements for Mercury are passed to 
+ * CelestialBody::CelestialBody();
+ ************************************************************************/
+Mercury::Mercury(fgTIME *t) :
+  CelestialBody (48.33130,   3.2458700E-5,
+                  7.0047,    5.00E-8,
+                  29.12410,  1.0144400E-5,
+                  0.3870980, 0.000000,
+                  0.205635,  5.59E-10,
+                  168.6562,  4.09233443680, t)
+{
+}
+/*************************************************************************
+ * void Mercury::updatePosition(fgTIME *t, Star *ourSun)
+ * 
+ * calculates the current position of Mercury, by calling the base class,
+ * CelestialBody::updatePosition(); The current magnitude is calculated using 
+ * a Mercury specific equation
+ *************************************************************************/
+void Mercury::updatePosition(fgTIME *t, Star *ourSun)
+{
+  CelestialBody::updatePosition(t, ourSun);
+  magnitude = -0.36 + 5*log10( r*R ) + 0.027 * FV + 2.2E-13 * pow(FV, 6); 
+}
+
+
diff --git a/Astro/mercury.hxx b/Astro/mercury.hxx
new file mode 100644 (file)
index 0000000..c7fea4b
--- /dev/null
@@ -0,0 +1,39 @@
+/**************************************************************************
+ * mercury.hxx
+ * Written by Durk Talsma. Originally started October 1997, for distribution  
+ * with the FlightGear project. Version 2 was written in August and 
+ * September 1998. This code is based upon algorithms and data kindly 
+ * provided by Mr. Paul Schlyter. (pausch@saaf.se). 
+ *
+ * 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 program 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.
+ *
+ * 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.
+ *
+ * $Id$
+ * (Log is kept at end of this file)
+ **************************************************************************/
+#ifndef _MERCURY_HXX_
+#define _MERCURY_HXX_
+
+#include <Time/fg_time.hxx>
+#include "celestialBody.hxx"
+#include "star.hxx"
+
+class Mercury : public CelestialBody
+{
+public:
+  Mercury ( fgTIME *t);
+  void updatePosition(fgTIME *t, Star* ourSun);
+};
+
+#endif // _MERURY_HXX_
index 4027d63a217294e7918e0c64f8bcc885f89d075a..70e7eeb03731d2954a459de11344a3059a49fe75 100644 (file)
@@ -1,6 +1,9 @@
 /**************************************************************************
- * moon.c
- * Written by Durk Talsma. Started October 1997, for the flight gear project.
+ * moon.cxx
+ * Written by Durk Talsma. Originally started October 1997, for distribution  
+ * with the FlightGear project. Version 2 was written in August and 
+ * September 1998. This code is based upon algorithms and data kindly 
+ * provided by Mr. Paul Schlyter. (pausch@saaf.se). 
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
  * $Id$
  * (Log is kept at end of this file)
  **************************************************************************/
+#include <Flight/flight.h>
 
-
-#ifdef HAVE_CONFIG_H
-#  include <config.h>
-#endif
-
-#ifdef HAVE_WINDOWS_H
-#  include <windows.h>
-#endif
-
-#include <math.h>
-#include <GL/glut.h>
-#include <XGL/xgl.h>
-
-#include <Aircraft/aircraft.h>
-#include <Debug/fg_debug.h>
-#include <Include/fg_constants.h>
-#include <Include/general.h>
-#include <Main/views.hxx>
-#include <Time/fg_time.hxx>
-
-#include "orbits.hxx"
+#include <string.h>
 #include "moon.hxx"
+#include <Debug/fg_debug.h>
+#include <Objects/texload.h>
+
+static GLuint moon_texid;
+static GLubyte *moon_texbuf;
+
+/*************************************************************************
+ * Moon::Moon(fgTIME *t)
+ * Public constructor for class Moon. Initializes the orbital elements and 
+ * sets up the moon texture.
+ * Argument: The current time.
+ * the hard coded orbital elements for Moon are passed to 
+ * CelestialBody::CelestialBody();
+ ************************************************************************/
+Moon::Moon(fgTIME *t) :
+  CelestialBody(125.1228, -0.0529538083,
+               5.1454,    0.00000,
+               318.0634,  0.1643573223,
+               60.266600, 0.000000,
+               0.054900,  0.000000,
+               115.3654,  13.0649929509, t)
+{
+  string tpath, fg_tpath;
+  int width, height;
+  
+  fgPrintf( FG_GENERAL, FG_INFO, "Initializing Moon Texture\n");
+#ifdef GL_VERSION_1_1
+  xglGenTextures(1, &moon_texid);
+  xglBindTexture(GL_TEXTURE_2D, moon_texid);
+#elif GL_EXT_texture_object
+  xglGenTexturesEXT(1, &moon_texid);
+  xglBindTextureEXT(GL_TEXTURE_2D, moon_texid);
+#else
+#  error port me
+#endif
 
+  glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
 
-struct CelestialCoord moonPos;
-
-static float xMoon, yMoon, zMoon;
-static GLint moon = 0;
-
-
-
-/* --------------------------------------------------------------
-      This section contains the code that calculates the actual
-      position of the moon in the night sky.
-----------------------------------------------------------------*/
-struct CelestialCoord fgCalculateMoon(struct OrbElements params,
-                                      struct OrbElements sunParams,
-                                      fgTIME t)
-{
-  struct CelestialCoord
-    geocCoord, topocCoord; 
+  // load in the texture data
+  tpath = current_options.get_fg_root() + "/Textures/" + "moon.rgb";
   
-  double
+  if ( (moon_texbuf = read_rgb_texture(tpath.c_str(), &width, &height)) 
+       == NULL )
+  {
+    // Try compressed
+    fg_tpath = tpath + ".gz";
+    if ( (moon_texbuf = read_rgb_texture(fg_tpath.c_str(), &width, &height)) 
+        == NULL )
+    {
+      fgPrintf( FG_GENERAL, FG_EXIT, 
+               "Error in loading moon texture %s\n", tpath );
+      exit(1);
+    } 
+  } 
+
+  glTexImage2D( GL_TEXTURE_2D,
+               0,
+               GL_RGB,
+               256, 256,
+               0,
+               GL_RGB, GL_UNSIGNED_BYTE,
+               moon_texbuf);
+}
+/*****************************************************************************
+ * void Moon::updatePosition(fgTIME *t, Star *ourSun)
+ * this member function calculates the actual topocentric position (i.e.) 
+ * the position of the moon as seen from the current position on the surface
+ * of the moon. 
+ ****************************************************************************/
+void Moon::updatePosition(fgTIME *t, Star *ourSun)
+{
+  double 
     eccAnom, ecl, lonecl, latecl, actTime,
     xv, yv, v, r, xh, yh, zh, xg, yg, zg, xe, ye, ze,
-    Ls, Lm, D, F, mpar, gclat, rho, HA, g;
+    Ls, Lm, D, F, mpar, gclat, rho, HA, g,
+    geoRa, geoDec;
   
-  fgAIRCRAFT *a;
+  fgAIRCRAFT *air;
   fgFLIGHT *f;
 
-  a = &current_aircraft;
-  f = a->flight;
-  
-  /* calculate the angle between ecliptic and equatorial coordinate
-   * system, in Radians */
+  air = &current_aircraft;
+  f = air->flight;
+  updateOrbElements(t);
   actTime = fgCalcActTime(t);
-  ecl = ((DEG_TO_RAD * 23.4393) - (DEG_TO_RAD * 3.563E-7) * actTime);
-  /*ecl = 0.409093 - 6.2186E-9 * actTime; */
-                                                       
-  /* calculate the eccentric anomaly */
-  eccAnom = fgCalcEccAnom(params.M, params.e);
 
-  /* calculate the moon's distance (r) and  true anomaly (v) */
-  xv = params.a * ( cos(eccAnom) - params.e);
-  yv = params.a * ( sqrt(1.0 - params.e*params.e) * sin(eccAnom));
-  v =atan2(yv, xv);
-  r = sqrt(xv*xv + yv*yv);
+  // calculate the angle between ecliptic and equatorial coordinate system
+  // in Radians
+  ecl = ((DEG_TO_RAD * 23.4393) - (DEG_TO_RAD * 3.563E-7) * actTime);  
+  eccAnom = fgCalcEccAnom(M, e);  // Calculate the eccentric anomaly
+  xv = a * (cos(eccAnom) - e);
+  yv = a * (sqrt(1.0 - e*e) * sin(eccAnom));
+  v = atan2(yv, xv);               // the moon's true anomaly
+  r = sqrt (xv*xv + yv*yv);       // and its distance
   
-  /* estimate the geocentric rectangular coordinates here */
-  xh = r * (cos (params.N) * cos (v + params.w) -
-           sin (params.N) * sin (v + params.w) * cos (params.i));
-  yh = r * (sin (params.N) * cos (v + params.w) +
-           cos (params.N) * sin (v + params.w) * cos (params.i));
-  zh = r * (sin(v + params.w) * sin(params.i));
-  
-  /* calculate the ecliptic latitude and longitude here */
-  lonecl = atan2( yh, xh);
-  latecl = atan2( zh, sqrt( xh*xh + yh*yh));
-
-  /* calculate a number of perturbations, i.e. disturbances caused by
-   * the gravitational influence of the sun and the other mayor
-   * planets. The largest of these even have their own names */
-  Ls = sunParams.M + sunParams.w;
-  Lm =    params.M +    params.w + params.N;
+  // estimate the geocentric rectangular coordinates here
+  xh = r * (cos(N) * cos (v+w) - sin (N) * sin(v+w) * cos(i));
+  yh = r * (sin(N) * cos (v+w) + cos (N) * sin(v+w) * cos(i));
+  zh = r * (sin(v+w) * sin(i));
+
+  // calculate the ecliptic latitude and longitude here
+  lonecl = atan2 (yh, xh);
+  latecl = atan2(zh, sqrt(xh*xh + yh*yh));
+
+  /* Calculate a number of perturbatioin, i.e. disturbances caused by the 
+   * gravitational infuence of the sun and the other major planets.
+   * The largest of these even have a name */
+  Ls = ourSun->getM() + ourSun->getw();
+  Lm = M + w + N;
   D = Lm - Ls;
-  F = Lm - params.N;
+  F = Lm - N;
   
-  lonecl += DEG_TO_RAD * (
-                         - 1.274 * sin (params.M - 2*D)                        /* the Evection         */
-                         + 0.658 * sin (2 * D)                                 /* the Variation        */
-                         - 0.186 * sin (sunParams.M)                           /* the yearly variation */
-                         - 0.059 * sin (2*params.M - 2*D)
-                         - 0.057 * sin (params.M - 2*D + sunParams.M)
-                         + 0.053 * sin (params.M + 2*D)
-                         + 0.046 * sin (2*D - sunParams.M)
-                         + 0.041 * sin (params.M - sunParams.M)
-                         - 0.035 * sin (D)                                      /* the Parallactic Equation */
-                         - 0.031 * sin (params.M + sunParams.M)
-                         - 0.015 * sin (2*F - 2*D)
-                         + 0.011 * sin (params.M - 4*D)
+  lonecl += DEG_TO_RAD * (-1.274 * sin (M - 2*D)
+                         +0.658 * sin (2*D)
+                         -0.186 * sin(ourSun->getM())
+                         -0.059 * sin(2*M - 2*D)
+                         -0.057 * sin(M - 2*D + ourSun->getM())
+                         +0.053 * sin(M + 2*D)
+                         +0.046 * sin(2*D - ourSun->getM())
+                         +0.041 * sin(M - ourSun->getM())
+                         -0.035 * sin(D)
+                         -0.031 * sin(M + ourSun->getM())
+                         -0.015 * sin(2*F - 2*D)
+                         +0.011 * sin(M - 4*D)
                          );
-  latecl += DEG_TO_RAD * (
-                         - 0.173 * sin (F - 2*D)
-                         - 0.055 * sin (params.M - F - 2*D)
-                         - 0.046 * sin (params.M + F - 2*D)
-                         + 0.033 * sin (F + 2*D)
-                         + 0.017 * sin (2 * params.M + F)
+  latecl += DEG_TO_RAD * (-0.173 * sin(F-2*D)
+                         -0.055 * sin(M - F - 2*D)
+                         -0.046 * sin(M + F - 2*D)
+                         +0.033 * sin(F + 2*D)
+                         +0.017 * sin(2*M + F)
                          );
-  
-  r += (
-       - 0.58 * cos(params.M - 2*D)
-       - 0.46 * cos(2*D)
+  r += (-0.58 * cos(M - 2*D)
+       -0.46 * cos(2*D)
        );
-  
+  fgPrintf(FG_GENERAL, FG_INFO, "Running moon update\n");
   xg = r * cos(lonecl) * cos(latecl);
   yg = r * sin(lonecl) * cos(latecl);
   zg = r *               sin(latecl);
-
-  xe  = xg;
-  ye = yg * cos(ecl) - zg * sin(ecl);
-  ze = yg * sin(ecl) + zg * cos(ecl);
   
+  xe = xg;
+  ye = yg * cos(ecl) -zg * sin(ecl);
+  ze = yg * sin(ecl) +zg * cos(ecl);
 
-  
+  geoRa  = atan2(ye, xe);
+  geoDec = atan2(ze, sqrt(xe*xe + ye*ye));
 
-  geocCoord.RightAscension = atan2(ye, xe);
-  geocCoord.Declination = atan2(ze, sqrt(xe*xe + ye*ye));
-  
-  /* New since 25 december 1997 */
-  /* Calculate the moon's topocentric position instead of it's geocentric! */
+  // Given the moon's geocentric ra and dec, calculate its 
+  // topocentric ra and dec. i.e. the position as seen from the
+  // surface of the earth, instead of the center of the earth
 
-  /* calculate the moon's parrallax, i.e. the apparent size of the
-   * (equatorial) radius of the Earth, as seen from the moon */
-  mpar = asin( 1 / r); 
-  gclat = FG_Latitude - 0.083358 * sin (2 * DEG_TO_RAD *  FG_Latitude);
+  // First calculates the moon's parrallax, that is, the apparent size of the 
+  // (equatorial) radius of the earth, as seen from the moon 
+  mpar = asin ( 1 / r);
+  gclat = FG_Latitude - 0.003358 * sin (2 * DEG_TO_RAD * FG_Latitude);
   rho = 0.99883 + 0.00167 * cos(2 * DEG_TO_RAD * FG_Latitude);
-
-  if (geocCoord.RightAscension < 0)
-    geocCoord.RightAscension += (2*FG_PI);
-
-  HA = t.lst - (3.8197186 * geocCoord.RightAscension);
-
-  g = atan (tan(gclat) / cos( (HA / 3.8197186))); 
-
-     
-
-  topocCoord.RightAscension = geocCoord.RightAscension -
-      mpar * rho * cos (gclat) * sin (HA) / cos (geocCoord.Declination);
-  topocCoord.Declination = geocCoord.Declination -
-      mpar * rho * sin (gclat) * sin (g - geocCoord.Declination) / sin (g);
-  return topocCoord;
+  if (geoRa < 0)
+    geoRa += (2*FG_PI);
+  
+  HA = t->lst - (3.8197186 * geoRa);
+  g = atan (tan(gclat) / cos ((HA / 3.8197186)));
+  rightAscension = geoRa - mpar * rho * cos(gclat) * sin(HA) / cos (geoDec);
+  declination = geoDec - mpar * rho * sin (gclat) * sin (g - geoDec) / sin(g);
 }
 
 
-void fgMoonInit( void ) {
-    fgPrintf( FG_ASTRO, FG_INFO, "Initializing the Moon\n");
-    fgSolarSystemUpdate(&(pltOrbElements[1]), cur_time_params);
-    moonPos = fgCalculateMoon(pltOrbElements[1], pltOrbElements[0], 
-                             cur_time_params);
-    fgPrintf( FG_ASTRO, FG_DEBUG, 
-             "Moon found at %f (ra), %f (dec)\n", moonPos.RightAscension, 
-             moonPos.Declination);
-
-    xMoon = 60000.0 * cos(moonPos.RightAscension) * cos(moonPos.Declination);
-    yMoon = 60000.0 * sin(moonPos.RightAscension) * cos(moonPos.Declination);
-    zMoon = 60000.0 * sin(moonPos.Declination);
-
-    if (moon) {
-       xglDeleteLists (moon, 1);
-    }
-
-    moon = xglGenLists (1);
-    xglNewList (moon, GL_COMPILE);
-  
-    xglPushMatrix ();
-    xglTranslatef (xMoon, yMoon, zMoon);
-    // xglScalef (1400, 1400, 1400);
-  
-    // glutSolidSphere (1.0, 10, 10);
-    glutSolidSphere (1200.0, 10, 10);
-    xglPopMatrix ();
-    xglEndList ();
+/************************************************************************
+ * void Moon::newImage(float ra, float dec)
+ *
+ * This function regenerates a new visual image of the moon, which is added to
+ * solarSystem display list.
+ *
+ * Arguments: Right Ascension and declination
+ *
+ * return value: none
+ **************************************************************************/
+void Moon::newImage(float ra, float dec)
+{
+  glEnable(GL_TEXTURE_2D);
+  glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); 
+  glBindTexture(GL_TEXTURE_2D, moon_texid);
+
+  //xglRotatef(-90, 0.0, 0.0, 1.0);
+  xglRotatef(((RAD_TO_DEG * ra)- 90.0), 0.0, 0.0, 1.0);
+  xglRotatef((RAD_TO_DEG * dec), 1.0, 0.0, 0.0);
+
+  fgPrintf( FG_GENERAL, FG_INFO, 
+          "Ra = (%f), Dec= (%f)", (RAD_TO_DEG *ra), (RAD_TO_DEG *dec) );
+  xglTranslatef(0.0, 58600.0, 0.0);
+  Object = gluNewQuadric();
+  gluQuadricTexture( Object, GL_TRUE );   
+  gluSphere( Object,  1367, 12, 12 );
+  glDisable(GL_TEXTURE_2D);
 }
 
 
-/* Draw the moon */
-void fgMoonRender( void ) {
-    GLfloat moonColor[4] = {0.85, 0.75, 0.35, 1.0};
-    GLfloat black[4] = { 0.0, 0.0, 0.0, 1.0 };
 
-    xglMaterialfv (GL_FRONT, GL_AMBIENT, black);
-    xglMaterialfv (GL_FRONT, GL_DIFFUSE, moonColor);
 
-    xglCallList(moon);
-}
 
 
-/* $Log$
-/* Revision 1.6  1998/09/03 21:25:39  curt
-/* log file tweak.
-/*
- * Revision 1.5  1998/07/30 23:43:30  curt
- * Eliminated glScale call so that glutSolidSphere normals are preserved
- * correctly.  Also made the sun & moon a bit smaller.
- *
- * Revision 1.4  1998/04/28 01:18:59  curt
- * Type-ified fgTIME and fgVIEW
- *
- * Revision 1.3  1998/04/25 22:06:24  curt
- * Edited cvs log messages in source files ... bad bad bad!
- *
- * Revision 1.2  1998/04/24 00:45:00  curt
- * Wrapped "#include <config.h>" in "#ifdef HAVE_CONFIG_H"
- * Fixed a bug when generating sky colors.
- *
- * Revision 1.1  1998/04/22 13:21:28  curt
- * C++ - ifing the code a bit.
- *
- * Revision 1.9  1998/04/18 04:13:56  curt
- * Moved fg_debug.c to it's own library.
- *
- * Revision 1.8  1998/04/03 21:52:49  curt
- * Converting to Gnu autoconf system.
- *
- * Revision 1.7  1998/02/23 19:07:54  curt
- * Incorporated Durk's Astro/ tweaks.  Includes unifying the sun position
- * calculation code between sun display, and other FG sections that use this
- * for things like lighting.
- *
- * Revision 1.6  1998/02/07 15:29:32  curt
- * Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss
- * <chotchkiss@namg.us.anritsu.com>
- *
- * Revision 1.5  1998/02/02 20:53:21  curt
- * To version 0.29
- *
- * Revision 1.4  1998/01/27 00:47:46  curt
- * Incorporated Paul Bleisch's <pbleisch@acm.org> new debug message
- * system and commandline/config file processing code.
- *
- * Revision 1.3  1998/01/19 19:26:57  curt
- * Merged in make system changes from Bob Kuehne <rpk@sgi.com>
- * This should simplify things tremendously.
- *
- * Revision 1.2  1998/01/19 18:40:16  curt
- * Tons of little changes to clean up the code and to remove fatal errors
- * when building with the c++ compiler.
- *
- * Revision 1.1  1998/01/07 03:16:16  curt
- * Moved from .../Src/Scenery/ to .../Src/Astro/
- *
- * Revision 1.16  1998/01/06 01:20:24  curt
- * Tweaks to help building with MSVC++
- *
- * Revision 1.15  1998/01/05 18:44:35  curt
- * Add an option to advance/decrease time from keyboard.
- *
- * Revision 1.14  1997/12/30 20:47:50  curt
- * Integrated new event manager with subsystem initializations.
- *
- * Revision 1.13  1997/12/30 16:41:00  curt
- * Added log at end of file.
- *
- */
+
index af635ce98bd7c1b74f57f2477aa418e0b1a77f64..9b70738b3227d0af2fc999b96ff1cfa9bbf60a53 100644 (file)
@@ -1,7 +1,9 @@
 /**************************************************************************
- * moon.h
- *
- * Written 1997 by Durk Talsma, started October, 1997.
+ * moon.hxx
+ * Written by Durk Talsma. Originally started October 1997, for distribution  
+ * with the FlightGear project. Version 2 was written in August and 
+ * September 1998. This code is based upon algorithms and data kindly 
+ * provided by Mr. Paul Schlyter. (pausch@saaf.se). 
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
  * $Id$
  * (Log is kept at end of this file)
  **************************************************************************/
-
-
-#ifndef _MOON_HXX
-#define _MOON_HXX
-
-
-#ifndef __cplusplus                                                          
-# error This library requires C++
-#endif                                   
-
-
-#include <math.h>
-
+#ifndef _MOON_HXX_
+#define _MOON_HXX_
+
+#include <Aircraft/aircraft.h>
+#include <Debug/fg_debug.h>
+#include <Include/fg_constants.h>
+#include <Include/general.h>
+#include <Main/views.hxx>
 #include <Time/fg_time.hxx>
 
-#include "orbits.hxx"
-
-
-/* Initialize the Moon Display management Subsystem */
-void fgMoonInit( void );
-
-/* Draw the Moon */
-void fgMoonRender( void );
-
-struct CelestialCoord fgCalculateMoon(struct OrbElements Params,
-                                      struct OrbElements sunParams,
-                                      fgTIME t);
-
-extern struct OrbElements pltOrbElements[9];
+#include "celestialBody.hxx"
+#include "star.hxx"
 
+class Moon : public CelestialBody
+{
+private:
+  void TexInit();  // This should move to the constructor eventually.
 
-#endif /* _MOON_HXX */
+  GLUquadricObj *Object;
+  GLuint Sphere;
+  
+public:
+  Moon ( fgTIME *t);
+  void updatePosition(fgTIME *t, Star *ourSun);
+  void newImage(float, float);
+};
 
 
-/* $Log$
-/* Revision 1.3  1998/04/28 01:19:00  curt
-/* Type-ified fgTIME and fgVIEW
-/*
- * Revision 1.2  1998/04/24 00:45:00  curt
- * Wrapped "#include <config.h>" in "#ifdef HAVE_CONFIG_H"
- * Fixed a bug when generating sky colors.
- *
- * Revision 1.1  1998/04/22 13:21:28  curt
- * C++ - ifing the code a bit.
- *
- * Revision 1.7  1998/04/21 17:02:30  curt
- * Prepairing for C++ integration.
- *
- * Revision 1.6  1998/02/23 19:07:54  curt
- * Incorporated Durk's Astro/ tweaks.  Includes unifying the sun position
- * calculation code between sun display, and other FG sections that use this
- * for things like lighting.
- *
- * Revision 1.5  1998/02/02 20:53:21  curt
- * To version 0.29
- *
- * Revision 1.4  1998/01/22 02:59:27  curt
- * Changed #ifdef FILE_H to #ifdef _FILE_H
- *
- * Revision 1.3  1998/01/19 19:26:58  curt
- * Merged in make system changes from Bob Kuehne <rpk@sgi.com>
- * This should simplify things tremendously.
- *
- * Revision 1.2  1998/01/19 18:40:17  curt
- * Tons of little changes to clean up the code and to remove fatal errors
- * when building with the c++ compiler.
- *
- * Revision 1.1  1998/01/07 03:16:16  curt
- * Moved from .../Src/Scenery/ to .../Src/Astro/
- *
- * Revision 1.4  1997/12/11 04:43:56  curt
- * Fixed sun vector and lighting problems.  I thing the moon is now lit
- * correctly.
- *
- * Revision 1.3  1997/11/25 19:25:35  curt
- * Changes to integrate Durk's moon/sun code updates + clean up.
- *
- * Revision 1.2  1997/10/25 03:24:23  curt
- * Incorporated sun, moon, and star positioning code contributed by Durk Talsma.
- *
- * Revision 1.1  1997/10/25 03:16:09  curt
- * Initial revision of code contributed by Durk Talsma.
- *
- */
+#endif // _MOON_HXX_
diff --git a/Astro/neptune.cxx b/Astro/neptune.cxx
new file mode 100644 (file)
index 0000000..cbcbcae
--- /dev/null
@@ -0,0 +1,55 @@
+/**************************************************************************
+ * neptune.cxx
+ * Written by Durk Talsma. Originally started October 1997, for distribution  
+ * with the FlightGear project. Version 2 was written in August and 
+ * September 1998. This code is based upon algorithms and data kindly 
+ * provided by Mr. Paul Schlyter. (pausch@saaf.se). 
+ *
+ * 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 program 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.
+ *
+ * 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.
+ *
+ * $Id$
+ * (Log is kept at end of this file)
+ **************************************************************************/
+
+#include "neptune.hxx"
+
+/*************************************************************************
+ * Neptune::Neptune(fgTIME *t)
+ * Public constructor for class Neptune
+ * Argument: The current time.
+ * the hard coded orbital elements for Neptune are passed to 
+ * CelestialBody::CelestialBody();
+ ************************************************************************/
+Neptune::Neptune(fgTIME *t) :
+  CelestialBody(131.7806,   3.0173000E-5,
+               1.7700,    -2.550E-7,
+               272.8461,  -6.027000E-6,        
+               30.058260,  3.313E-8,
+               0.008606,   2.150E-9,
+               260.2471,   0.00599514700, t)
+{
+}
+/*************************************************************************
+ * void Neptune::updatePosition(fgTIME *t, Star *ourSun)
+ * 
+ * calculates the current position of Neptune, by calling the base class,
+ * CelestialBody::updatePosition(); The current magnitude is calculated using 
+ * a Neptune specific equation
+ *************************************************************************/
+void Neptune::updatePosition(fgTIME *t, Star *ourSun)
+{
+  CelestialBody::updatePosition(t, ourSun);
+  magnitude = -6.90 + 5*log10 (r*R) + 0.001 *FV;
+}
diff --git a/Astro/neptune.hxx b/Astro/neptune.hxx
new file mode 100644 (file)
index 0000000..6d23b95
--- /dev/null
@@ -0,0 +1,39 @@
+/**************************************************************************
+ * neptune.hxx
+ * Written by Durk Talsma. Originally started October 1997, for distribution  
+ * with the FlightGear project. Version 2 was written in August and 
+ * September 1998. This code is based upon algorithms and data kindly 
+ * provided by Mr. Paul Schlyter. (pausch@saaf.se). 
+ *
+ * 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 program 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.
+ *
+ * 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.
+ *
+ * $Id$
+ * (Log is kept at end of this file)
+ **************************************************************************/
+#ifndef _NEPTUNE_HXX_
+#define _NEPTUNE_HXX_
+
+#include <Time/fg_time.hxx>
+#include "celestialBody.hxx"
+#include "star.hxx"
+
+class Neptune : public CelestialBody
+{
+public:
+  Neptune ( fgTIME *t);
+  void updatePosition(fgTIME *t, Star *ourSun);
+};
+
+#endif // _NEPTUNE_HXX_
diff --git a/Astro/orbits.cxx b/Astro/orbits.cxx
deleted file mode 100644 (file)
index eeca3ce..0000000
+++ /dev/null
@@ -1,266 +0,0 @@
-/**************************************************************************
- * orbits.c - calculates the orbital elements of the sun, moon and planets.
- *            For inclusion in flight gear
- *
- * Written 1997 by Durk Talsma, started October 19, 1997.
- *
- * 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 program 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.
- *
- * 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.
- *
- * $Id$
- * (Log is kept at end of this file)
- **************************************************************************/
-
-
-#ifdef HAVE_CONFIG_H
-#  include <config.h>
-#endif
-
-#include <math.h>
-#include <string.h>
-#include <string>
-
-#include <Debug/fg_debug.h>
-#include <Include/fg_constants.h>
-#include <Include/fg_zlib.h>
-#include <Main/options.hxx>
-#include <Time/fg_time.hxx>
-
-#include "orbits.hxx"
-
-
-struct OrbElements pltOrbElements[9];
-
-static fgFile data;
-
-
-double fgCalcActTime(fgTIME t)
-{
-  return (t.mjd - 36523.5);
-}
-
-
-double fgCalcEccAnom(double M, double e)
-{
-    double
-       eccAnom, E0, E1, diff;
-
-    eccAnom = M + e * sin(M) * (1.0 + e * cos(M));
-    /* iterate to achieve a greater precision for larger eccentricities */
-    if (e > 0.05)
-    {
-       E0 = eccAnom;
-        do
-        {
-               E1 = E0 - (E0 - e * sin(E0) - M) / (1 - e * cos(E0));
-            diff = fabs(E0 - E1);
-            E0 = E1;
-               }
-        while (diff > (DEG_TO_RAD * 0.001));
-        return E0;
-       }
-    return eccAnom;
-}
-
-
-/* This function assumes that if the FILE ptr is valid that the
-   contents will be valid. Should we check the file for validity? */
-  
-/* Sounds like a good idea to me. What type of checks are you thinking
-   of, other than feof(FILE*)? That's currently the only check I can
-   think of (Durk) */
-
-int fgReadOrbElements(struct OrbElements *dest, gzFile src) {
-    char line[256];
-    int i, j, len;
-
-    j = 0;
-    do {
-       if ( fggets(src, line, 256) == NULL ) {
-           fgPrintf (FG_ASTRO, FG_ALERT,
-                     "End of file found while reading planetary positions:\n");
-           return 0;
-       }
-       len = strlen(line);
-
-        for (i = 0; i < len; i++) {
-           if (line[i] == '#')
-               line[i] = 0;
-               }
-               // printf("Reading line %d = %s\n", j++, line);
-    } while (!(strlen(line)));
-
-    sscanf(line, "%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf\n",
-           &dest->NFirst, &dest->NSec,
-           &dest->iFirst, &dest->iSec,
-           &dest->wFirst, &dest->wSec,
-           &dest->aFirst, &dest->aSec,
-           &dest->eFirst, &dest->eSec,
-           &dest->MFirst, &dest->MSec);
-
-    return(1);
-}
-
-
-int fgSolarSystemInit(fgTIME t)
-{
-    string path, gzpath;
-    int i, ret_val;
-
-    fgPrintf( FG_ASTRO, FG_INFO, "Initializing solar system\n");
-
-    /* build the full path name to the orbital elements database file */
-    path = current_options.get_fg_root() + "/Astro/planets";
-    gzpath = path + ".gz";
-
-    if ( (data = fgopen(path.c_str(), "rb")) == NULL ) {
-       if ( (data = fgopen(gzpath.c_str(), "rb")) == NULL ) {
-           fgPrintf( FG_ASTRO, FG_EXIT,
-                     "Cannot open data file: '%s'\n", path.c_str());
-       }
-    }
-
-    /* printf("  reading datafile %s\n", path); */
-    fgPrintf( FG_ASTRO, FG_INFO, "  reading datafile %s\n", path.c_str());
-
-    /* for all the objects... */
-    for (i = 0; i < 9; i ++) {
-       /* ...read from the data file ... */
-       if (!(fgReadOrbElements (&pltOrbElements[i], data))) {
-           ret_val = 0;
-       }
-       /* ...and calculate the actual values */
-       fgSolarSystemUpdate(&pltOrbElements[i], t);
-    }
-
-    fgclose(data);
-
-    return ( 1 );
-}
-
-
-void fgSolarSystemUpdate(struct OrbElements *planet, fgTIME t)
-{
-   double
-         actTime;
-
-   actTime = fgCalcActTime(t);
-
-   /* calculate the actual orbital elements */
-   planet->M = DEG_TO_RAD * (planet->MFirst + (planet->MSec * actTime));
-   planet->w = DEG_TO_RAD * (planet->wFirst + (planet->wSec * actTime));
-   planet->N = DEG_TO_RAD * (planet->NFirst + (planet->NSec * actTime));
-   planet->i = DEG_TO_RAD * (planet->iFirst + (planet->iSec * actTime));
-   planet->e = planet->eFirst + (planet->eSec * actTime);
-   planet->a = planet->aFirst + (planet->aSec * actTime);
-}
-
-
-/* $Log$
-/* Revision 1.10  1998/08/27 17:02:00  curt
-/* Contributions from Bernie Bright <bbright@c031.aone.net.au>
-/* - use strings for fg_root and airport_id and added methods to return
-/*   them as strings,
-/* - inlined all access methods,
-/* - made the parsing functions private methods,
-/* - deleted some unused functions.
-/* - propogated some of these changes out a bit further.
-/*
- * Revision 1.9  1998/08/25 20:53:28  curt
- * Shuffled $FG_ROOT file layout.
- *
- * Revision 1.8  1998/08/22 01:18:59  curt
- * Minor tweaks to avoid using unitialized memory.
- *
- * Revision 1.7  1998/07/13 21:00:09  curt
- * Wrote access functions for current fgOPTIONS.
- *
- * Revision 1.6  1998/05/29 20:35:41  curt
- * Added zlib support for reading in compressed data files.
- *
- * Revision 1.5  1998/05/13 18:25:34  curt
- * Root path info moved to fgOPTIONS.
- *
- * Revision 1.4  1998/04/28 01:19:00  curt
- * Type-ified fgTIME and fgVIEW
- *
- * Revision 1.3  1998/04/25 22:06:25  curt
- * Edited cvs log messages in source files ... bad bad bad!
- *
- * Revision 1.2  1998/04/24 00:45:01  curt
- * Wrapped "#include <config.h>" in "#ifdef HAVE_CONFIG_H"
- * Fixed a bug when generating sky colors.
- *
- * Revision 1.1  1998/04/22 13:21:29  curt
- * C++ - ifing the code a bit.
- *
- * Revision 1.10  1998/04/18 04:13:57  curt
- * Moved fg_debug.c to it's own library.
- *
- * Revision 1.9  1998/03/14 00:27:12  curt
- * Updated fgGENERAL to a "type" of struct.
- *
- * Revision 1.8  1998/02/23 19:07:55  curt
- * Incorporated Durk's Astro/ tweaks.  Includes unifying the sun position
- * calculation code between sun display, and other FG sections that use this
- * for things like lighting.
- *
- * Revision 1.7  1998/02/12 21:59:33  curt
- * Incorporated code changes contributed by Charlie Hotchkiss
- * <chotchkiss@namg.us.anritsu.com>
- *
- * Revision 1.6  1998/02/03 23:20:11  curt
- * Lots of little tweaks to fix various consistency problems discovered by
- * Solaris' CC.  Fixed a bug in fg_debug.c with how the fgPrintf() wrapper
- * passed arguments along to the real printf().  Also incorporated HUD changes
- * by Michele America.
- *
- * Revision 1.5  1998/02/02 20:53:22  curt
- * To version 0.29
- *
- * Revision 1.4  1998/01/27 00:47:47  curt
- * Incorporated Paul Bleisch's <pbleisch@acm.org> new debug message
- * system and commandline/config file processing code.
- *
- * Revision 1.3  1998/01/22 02:59:27  curt
- * Changed #ifdef FILE_H to #ifdef _FILE_H
- *
- * Revision 1.2  1998/01/19 19:26:58  curt
- * Merged in make system changes from Bob Kuehne <rpk@sgi.com>
- * This should simplify things tremendously.
- *
- * Revision 1.1  1998/01/07 03:16:17  curt
- * Moved from .../Src/Scenery/ to .../Src/Astro/
- *
- * Revision 1.6  1997/12/30 20:47:52  curt
- * Integrated new event manager with subsystem initializations.
- *
- * Revision 1.5  1997/12/15 23:55:02  curt
- * Add xgl wrappers for debugging.
- * Generate terrain normals on the fly.
- *
- * Revision 1.4  1997/12/10 22:37:51  curt
- * Prepended "fg" on the name of all global structures that didn't have it yet.
- * i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
- *
- * Revision 1.3  1997/11/25 23:20:44  curt
- * Changed planets.dat Planets.dat
- *
- * Revision 1.2  1997/11/25 19:25:36  curt
- * Changes to integrate Durk's moon/sun code updates + clean up.
- *
- * Revision 1.1  1997/10/25 03:16:10  curt
- * Initial revision of code contributed by Durk Talsma.
- *
- */
diff --git a/Astro/orbits.hxx b/Astro/orbits.hxx
deleted file mode 100644 (file)
index 1d8e870..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-/**************************************************************************
- * orbits.h - calculates the orbital elements of the sun, moon and planets.
- *            For inclusion in flight gear
- *
- * Written 1997 by Durk Talsma, started October 19, 1997.
- *
- * 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 program 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.
- *
- * 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.
- *
- * $Id$
- * (Log is kept at end of this file)
- **************************************************************************/
-
-
-#ifndef _ORBITS_HXX
-#define _ORBITS_HXX
-
-
-#ifndef __cplusplus                                                          
-# error This library requires C++
-#endif                                   
-
-
-#include <stdio.h>
-#include <math.h>
-
-#include <Time/fg_time.hxx>
-
-
-
-//#define STANDARDEPOCH 2000
-
-typedef struct {
-    double xs;
-    double ys;
-    double dist;
-    double lonSun;
-} fgSUNPOS;
-
-extern fgSUNPOS solarPosition;
-
-
-struct OrbElements {
-    double NFirst;             /* longitude of the ascending node first part */
-    double NSec;               /* longitude of the ascending node second part */
-    double iFirst;             /* inclination to the ecliptic first part */
-    double iSec;               /* inclination to the ecliptic second part */
-    double wFirst;             /* first part of argument of perihelion */
-    double wSec;               /* second part of argument of perihelion */
-    double aFirst;             /* semimayor axis first part*/
-    double aSec;               /* semimayor axis second part */
-    double eFirst;             /* eccentricity first part */
-    double eSec;               /* eccentricity second part */
-    double MFirst;             /* Mean anomaly first part */
-    double MSec;               /* Mean anomaly second part */
-
-    double N, i, w, a, e, M;   /* the resultant orbital elements, obtained from the former */
-};
-
-struct CelestialCoord {
-    double RightAscension;
-    double Declination;
-    double distance;
-    double magnitude;
-};
-
-
-double fgCalcEccAnom(double M, double e);
-double fgCalcActTime(fgTIME t);
-
-int fgReadOrbElements (struct OrbElements *dest, FILE * src);
-int  fgSolarSystemInit(fgTIME t);
-void fgSolarSystemUpdate(struct OrbElements *planets, fgTIME t);
-
-
-#endif /* _ORBITS_HXX */
-
-
-/* $Log$
-/* Revision 1.3  1998/04/28 01:19:01  curt
-/* Type-ified fgTIME and fgVIEW
-/*
- * Revision 1.2  1998/04/24 00:45:01  curt
- * Wrapped "#include <config.h>" in "#ifdef HAVE_CONFIG_H"
- * Fixed a bug when generating sky colors.
- *
- * Revision 1.1  1998/04/22 13:21:30  curt
- * C++ - ifing the code a bit.
- *
- * Revision 1.7  1998/04/21 17:02:31  curt
- * Prepairing for C++ integration.
- *
- * Revision 1.6  1998/02/23 19:07:55  curt
- * Incorporated Durk's Astro/ tweaks.  Includes unifying the sun position
- * calculation code between sun display, and other FG sections that use this
- * for things like lighting.
- *
- * Revision 1.5  1998/02/12 21:59:35  curt
- * Incorporated code changes contributed by Charlie Hotchkiss
- * <chotchkiss@namg.us.anritsu.com>
- *
- * Revision 1.4  1998/02/02 20:53:22  curt
- * To version 0.29
- *
- * Revision 1.3  1998/01/22 02:59:27  curt
- * Changed #ifdef FILE_H to #ifdef _FILE_H
- *
- * Revision 1.2  1998/01/19 19:26:58  curt
- * Merged in make system changes from Bob Kuehne <rpk@sgi.com>
- * This should simplify things tremendously.
- *
- * Revision 1.1  1998/01/07 03:16:17  curt
- * Moved from .../Src/Scenery/ to .../Src/Astro/
- *
- * Revision 1.2  1997/12/30 16:36:52  curt
- * Merged in Durk's changes ...
- *
- * Revision 1.1  1997/10/25 03:16:10  curt
- * Initial revision of code contributed by Durk Talsma.
- *
- */
diff --git a/Astro/planets.cxx b/Astro/planets.cxx
deleted file mode 100644 (file)
index 8dec302..0000000
+++ /dev/null
@@ -1,286 +0,0 @@
-/**************************************************************************
- * planets.c
- *
- * Written 1997 by Durk Talsma, started October, 1997.  For the flight gear
- * project.
- *
- * 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 program 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.
- *
- * 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.
- *
- * $Id$
- * (Log is kept at end of this file)
- **************************************************************************/
-
-
-#ifdef HAVE_CONFIG_H
-#  include <config.h>
-#endif
-
-#ifdef HAVE_WINDOWS_H
-#  include <windows.h>
-#endif
-
-#include <GL/glut.h>
-#include <XGL/xgl.h>
-
-#include <Debug/fg_debug.h>
-#include <Include/fg_constants.h>
-#include <Time/fg_time.hxx>
-#include <Time/light.hxx>
-
-#include "orbits.hxx"
-#include "planets.hxx"
-#include "sun.hxx"
-
-GLint planets = 0;
-
-void fgCalculatePlanet(struct OrbElements planet, struct OrbElements theSun,
-                      fgTIME t, int idx, struct CelestialCoord *result)
-{
-    // struct CelestialCoord result;
-
-    // fgSUNPOS SolarPosition;
-
-    double eccAnom, r, v, ecl, actTime, R, s, ir, Nr, B, FV, ring_magn,
-        xv, yv, xh, yh, zh, xg, yg, zg, xe, ye, ze;
-
-    actTime = fgCalcActTime(t);
-    /*calculate the angle between ecliptic and equatorial coordinate system */
-    ecl = DEG_TO_RAD * (23.4393 - 3.563E-7 * actTime);
-
-    /* calculate the eccentric anomaly */
-    eccAnom  = fgCalcEccAnom(planet.M, planet.e);
-
-    /* calculate the planets distance (r) and true anomaly (v) */
-    xv = planet.a * (cos(eccAnom) - planet.e);
-    yv = planet.a * (sqrt(1.0 - planet.e*planet.e) * sin(eccAnom));
-    v = atan2(yv, xv);
-    r = sqrt ( xv*xv + yv*yv);
-    
-    /* calculate the planets position in 3-dimensional space */
-    xh = r * (cos (planet.N) * cos (v + planet.w) -
-             sin (planet.N) * sin (v + planet.w) * cos (planet.i));
-    yh = r * (sin (planet.N) * cos (v + planet.w) +
-             cos (planet.N) * sin (v + planet.w) * cos (planet.i));
-    zh = r * ( sin(v+planet.w) * sin(planet.i));
-
-    /* calculate the ecliptic longitude and latitude */
-
-    xg = xh + solarPosition.xs;
-    yg = yh + solarPosition.ys;
-    zg = zh;
-
-    xe = xg;
-    ye = yg * cos(ecl) - zg * sin(ecl);
-    ze = yg * sin(ecl) + zg * cos(ecl);
-
-    result->RightAscension = atan2(ye,xe);
-    result->Declination = atan2(ze, sqrt(xe*xe + ye*ye));
-        
-    /* Let's calculate the brightness of the planet */
-    R = sqrt ( xg*xg + yg*yg + zg*zg);
-    s = solarPosition.dist;
-    FV = acos(  (r*r + R*R - s*s) / (2*r*R));
-    FV  *= 57.29578;  /* convert radians to degrees */ 
-    switch(idx)
-      {
-      case 2: /* mercury */
-       result->magnitude = -0.36 + 5*log10( r*R ) + 0.027 * FV + 2.2E-13 * pow(FV, 6);
-       break;
-      case 3: /*venus */
-       result->magnitude = -4.34 + 5*log10( r*R ) + 0.013 * FV + 4.2E-07 * pow(FV,3);
-       break;
-      case 4: /* mars */
-       result->magnitude = -1.51 + 5*log10( r*R ) + 0.016 * FV;
-       break;
-      case 5: /* Jupiter */
-       result->magnitude = -9.25 + 5*log10( r*R ) + 0.014 * FV;
-       break;
-      case 6: /* Saturn */
-       
-       ir = 0.4897394;
-       Nr = 2.9585076 + 6.6672E-7*actTime;
-       
-       B = asin (sin (result->Declination) * cos (ir) -
-                 cos (result->Declination) * sin (ir) *
-                 sin (result->RightAscension - Nr));
-       ring_magn = -2.6 * sin (fabs(B)) + 1.2 * pow(sin(B),2);
-       result->magnitude = -9.0 + 5*log10( r*R ) + 0.044 * FV + ring_magn;
-       break;
-      case 7: /* Uranus */
-       result->magnitude = -7.15 + 5*log10( r*R) + 0.001 * FV;
-       break;
-      case 8:  /* Neptune */
-       result->magnitude = -6.90 + 5*log10 (r*R) + 0.001 *FV;
-       break;
-      default:
-       fgPrintf( FG_ASTRO, FG_ALERT, "index %d out of range !!!!\n", idx);
-      }
-    fgPrintf( FG_ASTRO, FG_DEBUG,
-             "    Planet found at %f (ra), %f (dec)\n",
-             result->RightAscension, result->Declination);
-    fgPrintf( FG_ASTRO, FG_DEBUG,
-             "      Geocentric dist     %f\n"
-             "      Heliocentric dist   %f\n"
-             "      Distance to the sun %f\n"
-             "      Phase angle         %f\n"
-             "      Brightness          %f\n", R, r, s, FV, result->magnitude);
-
-    // return result;
-}
-
-
-void fgPlanetsInit( void )
-{
-  fgLIGHT *l;
-  int i;
-  struct CelestialCoord pltPos;
-  double magnitude;
-
-  l = &cur_light_params;
-  /* if the display list was already built during a previous init,
-     then recycle it */
-
-  if (planets) {
-      xglDeleteLists(planets, 1);
-  }
-
-  planets = xglGenLists(1);
-  xglNewList( planets, GL_COMPILE );
-  xglBegin( GL_POINTS );
-
-
-  /* Add the planets to all four display lists */
-  for ( i = 2; i < 9; i++ ) {
-    fgSolarSystemUpdate(&(pltOrbElements[i]), cur_time_params);
-    fgCalculatePlanet(pltOrbElements[i], pltOrbElements[0], 
-                     cur_time_params, i, &pltPos);
-    
-    magnitude = (0.0 - pltPos.magnitude) / 5.0 + 1.0;
-    
-    /* scale magnitudes again so they look ok */
-    /* magnitude = 
-       magnitude * 0.7 + (((FG_STAR_LEVELS - 1) - i) * 0.1); */
-
-    /* the following statement could be made a little more sopisticated
-       for the moment: Stick to this one */
-    magnitude = magnitude * 0.7 + (3 * 0.1);
-    if ( magnitude > 1.0 ) { magnitude = 1.0; }
-    if ( magnitude < 0.0 ) { magnitude = 0.0; }
-    
-    /* Add planets to the display list, based on sun_angle and current
-       magnitude It's pretty experimental... */
-
-    if ((double) (l->sun_angle - FG_PI_2) > 
-       ((magnitude - 1.0) * -20 * DEG_TO_RAD))
-       {
-           xglColor3f (magnitude, magnitude, magnitude);
-           printf ("Sun Angle to Horizon (in Rads) = %f\n", 
-                   (double) (l->sun_angle - FG_PI_2));
-           printf ("Transformed Magnitude is :%f  %f\n", 
-                   magnitude, (magnitude - 1.0) * -20 * DEG_TO_RAD);
-           xglVertex3f (50000.0 * cos (pltPos.RightAscension) *
-                        cos (pltPos.Declination),
-                        50000.0 * sin (pltPos.RightAscension) *
-                        cos (pltPos.Declination),
-                        50000.0 * sin (pltPos.Declination));
-       }
-  }
-  xglEnd();
-  xglEndList();
-
-}
-
-
-void fgPlanetsRender( void ) {
-       xglCallList(planets);
-}
-
-
-/* $Log$
-/* Revision 1.7  1998/08/22 02:01:11  curt
-/* Nailed a uninitialized variable usage bug that was killing us on some
-/* platforms with some compiler options.
-/*
- * Revision 1.6  1998/06/27 16:51:54  curt
- * In fgCalculatePlanet() pass a pointer to a structure to be modified, rather
- * than returning the entire structure.
- *
- * Revision 1.5  1998/04/28 01:19:01  curt
- * Type-ified fgTIME and fgVIEW
- *
- * Revision 1.4  1998/04/26 05:10:01  curt
- * "struct fgLIGHT" -> "fgLIGHT" because fgLIGHT is typedef'd.
- *
- * Revision 1.3  1998/04/25 22:06:25  curt
- * Edited cvs log messages in source files ... bad bad bad!
- *
- * Revision 1.2  1998/04/24 00:45:02  curt
- * Wrapped "#include <config.h>" in "#ifdef HAVE_CONFIG_H"
- * Fixed a bug when generating sky colors.
- *
- * Revision 1.1  1998/04/22 13:21:31  curt
- * C++ - ifing the code a bit.
- *
- * Revision 1.9  1998/04/18 04:13:57  curt
- * Moved fg_debug.c to it's own library.
- *
- * Revision 1.8  1998/04/03 21:52:50  curt
- * Converting to Gnu autoconf system.
- *
- * Revision 1.7  1998/02/23 19:07:55  curt
- * Incorporated Durk's Astro/ tweaks.  Includes unifying the sun position
- * calculation code between sun display, and other FG sections that use this
- * for things like lighting.
- *
- * Revision 1.6  1998/02/12 21:59:36  curt
- * Incorporated code changes contributed by Charlie Hotchkiss
- * <chotchkiss@namg.us.anritsu.com>
- *
- * Revision 1.5  1998/02/03 23:20:12  curt
- * Lots of little tweaks to fix various consistency problems discovered by
- * Solaris' CC.  Fixed a bug in fg_debug.c with how the fgPrintf() wrapper
- * passed arguments along to the real printf().  Also incorporated HUD changes
- * by Michele America.
- *
- * Revision 1.4  1998/02/02 20:53:23  curt
- * To version 0.29
- *
- * Revision 1.3  1998/01/27 00:47:47  curt
- * Incorporated Paul Bleisch's <pbleisch@acm.org> new debug message
- * system and commandline/config file processing code.
- *
- * Revision 1.2  1998/01/19 19:26:59  curt
- * Merged in make system changes from Bob Kuehne <rpk@sgi.com>
- * This should simplify things tremendously.
- *
- * Revision 1.1  1998/01/07 03:16:18  curt
- * Moved from .../Src/Scenery/ to .../Src/Astro/
- *
- * Revision 1.4  1997/12/30 20:47:52  curt
- * Integrated new event manager with subsystem initializations.
- *
- * Revision 1.3  1997/12/30 16:36:52  curt
- * Merged in Durk's changes ...
- *
- * Revision 1.2  1997/12/12 21:41:29  curt
- * More light/material property tweaking ... still a ways off.
- *
- * Revision 1.1  1997/10/25 03:16:10  curt
- * Initial revision of code contributed by Durk Talsma.
- *
- */
-
-
diff --git a/Astro/planets.hxx b/Astro/planets.hxx
deleted file mode 100644 (file)
index 752dcf6..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/**************************************************************************
- * planets.hxx
- *
- * Written 1997 by Durk Talsma, started October, 1997.  For the flight gear
- * project.
- *
- * 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 program 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.
- *
- * 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.
- *
- * $Id$
- * (Log is kept at end of this file)
- **************************************************************************/
-
-
-#ifndef _PLANETS_HXX
-#define _PLANETS_HXX
-
-
-#ifndef __cplusplus                                                          
-# error This library requires C++
-#endif                                   
-
-
-void fgCalculatePlanet(struct OrbElements planet, struct OrbElements theSun,
-                      fgTIME t, int idx, struct CelestialCoord *result);
-
-void fgPlanetsInit( void );
-void fgPlanetsRender( void );
-
-
-#endif /* PLANETS_HXX */
-
-
-/* $Log$
-/* Revision 1.3  1998/06/27 16:51:54  curt
-/* In fgCalculatePlanet() pass a pointer to a structure to be modified, rather
-/* than returning the entire structure.
-/*
- * Revision 1.2  1998/04/28 01:19:02  curt
- * Type-ified fgTIME and fgVIEW
- *
- * Revision 1.1  1998/04/22 13:21:32  curt
- * C++ - ifing the code a bit.
- *
- * Revision 1.5  1998/04/21 17:02:31  curt
- * Prepairing for C++ integration.
- *
- * Revision 1.4  1998/02/12 21:59:38  curt
- * Incorporated code changes contributed by Charlie Hotchkiss
- * <chotchkiss@namg.us.anritsu.com>
- *
- * Revision 1.3  1998/02/02 20:53:23  curt
- * To version 0.29
- *
- * Revision 1.2  1998/01/22 02:59:28  curt
- * Changed #ifdef FILE_H to #ifdef _FILE_H
- *
- * Revision 1.1  1998/01/07 03:16:18  curt
- * Moved from .../Src/Scenery/ to .../Src/Astro/
- *
- * Revision 1.3  1997/12/30 16:36:53  curt
- * Merged in Durk's changes ...
- *
- * Revision 1.2  1997/12/12 21:41:30  curt
- * More light/material property tweaking ... still a ways off.
- *
- * Revision 1.1  1997/10/25 03:16:11  curt
- * Initial revision of code contributed by Durk Talsma.
- *
- */
diff --git a/Astro/pluto.hxx b/Astro/pluto.hxx
new file mode 100644 (file)
index 0000000..03a37e9
--- /dev/null
@@ -0,0 +1,37 @@
+/**************************************************************************
+ * pluto.hxx
+ * Written by Durk Talsma. Originally started October 1997, for distribution  
+ * with the FlightGear project. Version 2 was written in August and 
+ * September 1998. This code is based upon algorithms and data kindly 
+ * provided by Mr. Paul Schlyter. (pausch@saaf.se). 
+ *
+ * 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 program 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.
+ *
+ * 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.
+ *
+ * $Id$
+ * (Log is kept at end of this file)
+ **************************************************************************/
+#ifndef _PLUTO_HXX_
+#define _PLUTO_HXX_
+
+#include <Time/fg_time.hxx>
+#include "celestialBody.hxx"
+
+class Pluto : public CelestialBody
+{
+public:
+  Pluto ( fgTIME t);
+};
+
+#endif // _PLUTO_HXX_
diff --git a/Astro/saturn.cxx b/Astro/saturn.cxx
new file mode 100644 (file)
index 0000000..c58f383
--- /dev/null
@@ -0,0 +1,64 @@
+/**************************************************************************
+ * saturn.cxx
+ * Written by Durk Talsma. Originally started October 1997, for distribution  
+ * with the FlightGear project. Version 2 was written in August and 
+ * September 1998. This code is based upon algorithms and data kindly 
+ * provided by Mr. Paul Schlyter. (pausch@saaf.se). 
+ *
+ * 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 program 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.
+ *
+ * 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.
+ *
+ * $Id$
+ * (Log is kept at end of this file)
+ **************************************************************************/
+#include "saturn.hxx"
+
+/*************************************************************************
+ * Saturn::Saturn(fgTIME *t)
+ * Public constructor for class Saturn
+ * Argument: The current time.
+ * the hard coded orbital elements for Saturn are passed to 
+ * CelestialBody::CelestialBody();
+ ************************************************************************/
+Saturn::Saturn(fgTIME *t) :
+  CelestialBody(113.6634,   2.3898000E-5,
+               2.4886,    -1.081E-7,
+               339.3939,   2.9766100E-5,
+               9.5547500,  0.000000,
+               0.055546,  -9.499E-9,
+               316.9670,   0.03344422820, t)
+{
+}
+
+/*************************************************************************
+ * void Saturn::updatePosition(fgTIME *t, Star *ourSun)
+ * 
+ * calculates the current position of Saturn, by calling the base class,
+ * CelestialBody::updatePosition(); The current magnitude is calculated using 
+ * a Saturn specific equation
+ *************************************************************************/
+void Saturn::updatePosition(fgTIME *t, Star *ourSun)
+{
+  CelestialBody::updatePosition(t, ourSun);
+  
+  double actTime = fgCalcActTime(t);
+  double ir = 0.4897394;
+  double Nr = 2.9585076 + 6.6672E-7*actTime;
+  double B = asin (sin(declination) * cos(ir) - 
+                  cos(declination) * sin(ir) *
+                  sin(rightAscension - Nr));
+  double ring_magn = -2.6 * sin(fabs(B)) + 1.2 * pow(sin(B), 2);
+  magnitude = -9.0 + 5*log10(r*R) + 0.044 * FV + ring_magn;
+}
+
diff --git a/Astro/saturn.hxx b/Astro/saturn.hxx
new file mode 100644 (file)
index 0000000..621ddf8
--- /dev/null
@@ -0,0 +1,46 @@
+/**************************************************************************
+ * saturn.hxx
+ * Written by Durk Talsma. Originally started October 1997, for distribution  
+ * with the FlightGear project. Version 2 was written in August and 
+ * September 1998. This code is based upon algorithms and data kindly 
+ * provided by Mr. Paul Schlyter. (pausch@saaf.se). 
+ *
+ * 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 program 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.
+ *
+ * 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.
+ *
+ * $Id$
+ * (Log is kept at end of this file)
+ **************************************************************************/
+#ifndef _SATURN_HXX_
+#define _SATURN_HXX_
+
+#include <Time/fg_time.hxx>
+#include "celestialBody.hxx"
+#include "star.hxx"
+
+class Saturn : public CelestialBody
+{
+public:
+  Saturn ( fgTIME *t);
+  void updatePosition(fgTIME *t, Star *ourSun);
+};
+
+#endif // _SATURN_HXX_
+
+
+
+
+
+
+
diff --git a/Astro/solarsystem.cxx b/Astro/solarsystem.cxx
new file mode 100644 (file)
index 0000000..e59dfeb
--- /dev/null
@@ -0,0 +1,256 @@
+/**************************************************************************
+ * solarsystem.cxx
+ * Written by Durk Talsma. Originally started October 1997, for distribution  
+ * with the FlightGear project. Version 2 was written in August and 
+ * September 1998. This code is based upon algorithms and data kindly 
+ * provided by Mr. Paul Schlyter. (pausch@saaf.se). 
+ *
+ * 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 program 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.
+ *
+ * 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.
+ *
+ * $Id$
+ * (Log is kept at end of this file)
+ **************************************************************************/
+#include <GL/glut.h>
+#include <XGL/xgl.h>
+#include <Debug/fg_debug.h>
+#include <Time/sunpos.hxx>
+#include "solarsystem.hxx"
+
+/***************************************************************************
+ * default constructor for class  SolarSystem:   
+ * or course there can only be one way to create an entire solar system -:) )
+ * the fgTIME argument is needed to properly initialize the the current orbital
+ * elements
+ *************************************************************************/
+SolarSystem::SolarSystem(fgTIME *t)
+{
+  if (theSolarSystem)
+    {
+      fgPrintf(FG_GENERAL, FG_EXIT, "Error: only one solarsystem allowed\n");
+    }
+  theSolarSystem = this;
+  ourSun     = new Star(t);   
+  earthsMoon = new Moon(t);
+  mercury    = new Mercury(t);
+  venus      = new Venus(t);
+  mars       = new Mars(t);
+  jupiter    = new Jupiter(t);
+  saturn     = new Saturn(t);
+  uranus     = new Uranus(t);
+  neptune    = new Neptune(t);
+
+  displayList = 0;
+};
+
+/* --------------------------------------------------------------------------
+   the destructor for class SolarSystem;
+   danger: Huge Explosions ahead! (-:))
+   ------------------------------------------------------------------------*/
+SolarSystem::~SolarSystem()
+{
+  delete ourSun;
+  delete earthsMoon;
+  delete mercury;
+  delete venus;
+  delete mars;
+  delete jupiter;
+  delete saturn;
+  delete uranus;
+  delete neptune;
+  //delete pluto;
+}
+/****************************************************************************
+ * void SolarSystem::rebuild()
+ *
+ * this member function updates the positions for the sun, moon, and planets,
+ * and then rebuilds the display list. 
+ *
+ * arguments: none
+ * return value: none
+ ***************************************************************************/
+void SolarSystem::rebuild()
+{
+  fgLIGHT *l = &cur_light_params;
+  fgTIME  *t = &cur_time_params;  
+  float x, y, z,
+    xx, yy,zz;
+  double ra, dec;
+  double x_2, x_4, x_8, x_10;
+  double magnitude;
+  GLfloat ambient;
+  GLfloat amb[4];
+  GLfloat moonColor[4] = {0.85, 0.75, 0.35, 1.0};
+  GLfloat black[4] = {0.0, 0.0,0.0,1.0};
+  GLfloat white[4] = {1.0, 1.0,1.0,1.0};
+
+  // Step 1: update all the positions
+  ourSun->updatePosition(t);
+  earthsMoon->updatePosition(t, ourSun);
+  mercury->updatePosition(t, ourSun);
+  venus->updatePosition(t, ourSun);
+  mars->updatePosition(t, ourSun);
+  jupiter->updatePosition(t, ourSun);
+  saturn->updatePosition(t, ourSun);
+  uranus->updatePosition(t, ourSun);
+  neptune->updatePosition(t, ourSun);
+  
+  fgUpdateSunPos();   // get the right sun angle (especially important when 
+                      // running for the first time.
+  if (displayList)
+    xglDeleteLists(displayList, 1);
+
+  displayList = xglGenLists(1);
+  // Step 2: rebuild the display list
+  xglNewList( displayList, GL_COMPILE);
+  {
+    // Step 2a: Add the moon...
+    xglEnable( GL_LIGHTING );
+    xglEnable( GL_LIGHT0 );
+    // set lighting parameters
+    xglLightfv(GL_LIGHT0, GL_AMBIENT, white );
+    xglLightfv(GL_LIGHT0, GL_DIFFUSE, white );
+    xglEnable( GL_CULL_FACE );
+    
+    // Enable blending, in order to effectively eliminate the dark side of the
+    // moon
+    glEnable(GL_BLEND);
+    glBlendFunc(GL_ONE, GL_ONE);
+    earthsMoon->getPos(&ra, &dec);
+    x = 60000.0 * cos(ra) * cos (dec);
+    y = 60000.0 * sin(ra) * cos (dec);
+    z = 60000.0 * sin(dec);
+    xx = cos(ra) * cos(dec);
+    yy = sin(ra) * cos(dec);
+    zz = sin(dec);
+    xglMaterialfv(GL_FRONT, GL_AMBIENT, black);
+    xglMaterialfv(GL_FRONT, GL_DIFFUSE, moonColor); 
+    xglPushMatrix();
+    {
+       earthsMoon->newImage(ra,dec);
+    }
+    xglPopMatrix();
+    glDisable(GL_BLEND);
+    xglDisable(GL_LIGHTING);
+    // Step 2b:  Add the sun
+    x_2 = l -> sun_angle * l->sun_angle;
+    x_4 = x_2 * x_2;
+    x_8 = x_4 * x_4;
+    x_10 = x_8 * x_2;
+    ambient = (0.4 * pow (1.1, - x_10 / 30.0));
+    if (ambient < 0.3) ambient = 0.3;
+    if (ambient > 1.0) ambient = 1.0;
+
+    amb[0] = 0.00 + ((ambient * 6.0)  - 1.0); // minimum value = 0.8
+    amb[1] = 0.00 + ((ambient * 11.0) - 3.0); // minimum value = 0.3
+    amb[2] = 0.00 + ((ambient * 12.0) - 3.6); // minimum value = 0.0
+    amb[3] = 1.00;
+
+    if (amb[0] > 1.0) amb[0] = 1.0;
+    if (amb[1] > 1.0) amb[1] = 1.0;
+    if (amb[2] > 1.0) amb[2] = 1.0;
+
+    ourSun->getPos(&ra, &dec);
+    x = 60000.0 * cos(ra) * cos(dec);
+    y = 60000.0 * sin(ra) * cos(dec);
+    z = 60000.0 * sin(dec);
+    xglPushMatrix();
+    {
+      // xglPushMatrix();
+      xglTranslatef(x,y,z);
+      xglColor3f(amb[0], amb[1], amb[2]);
+      glutSolidSphere(1400.0, 10, 10);
+    }
+    glPopMatrix();
+    // Step 2c: Add the planets
+    xglBegin(GL_POINTS);
+    mercury->getPos(&ra, &dec, &magnitude);addPlanetToList(ra, dec, magnitude);
+    venus  ->getPos(&ra, &dec, &magnitude);addPlanetToList(ra, dec, magnitude);
+    mars   ->getPos(&ra, &dec, &magnitude);addPlanetToList(ra, dec, magnitude);
+    jupiter->getPos(&ra, &dec, &magnitude);addPlanetToList(ra, dec, magnitude);
+    saturn ->getPos(&ra, &dec, &magnitude);addPlanetToList(ra, dec, magnitude);
+    uranus ->getPos(&ra, &dec, &magnitude);addPlanetToList(ra, dec, magnitude);
+    neptune->getPos(&ra, &dec, &magnitude);addPlanetToList(ra, dec, magnitude);
+    xglEnd();
+    xglEnable(GL_LIGHTING);
+  }
+  xglEndList();
+}
+
+/*****************************************************************************
+ * double SolarSystem::scaleMagnitude(double magn)
+ * This private member function rescales the original magnitude, as used in the
+ * astronomical sense of the word, into a value used by OpenGL to draw a 
+ * convincing Star or planet
+ * 
+ * Argument: the astronomical magnitude
+ *
+ * return value: the rescaled magnitude
+ ****************************************************************************/
+double SolarSystem::scaleMagnitude(double magn)
+{
+  double magnitude = (0.0 - magn) / 5.0 + 1.0;
+  magnitude = magnitude * 0.7 + (3 * 0.1);
+  if (magnitude > 1.0) magnitude = 1.0;
+  if (magnitude < 0.0) magnitude = 0.0;
+  return magnitude;
+}
+
+/***************************************************************************
+ * void SolarSytem::addPlanetToList(double ra, double dec, double magn);
+ *
+ * This private member function first causes the magnitude to be properly
+ * rescaled, and then adds the planet to the display list.
+ * 
+ * arguments: Right Ascension, declination, and magnitude
+ *
+ * return value: none
+ **************************************************************************/
+void SolarSystem::addPlanetToList(double ra, double dec, double magn)
+{
+  double
+    magnitude = scaleMagnitude ( magn );
+
+  fgLIGHT *l = &cur_light_params;
+
+  if ((double) (l->sun_angle - FG_PI_2) > 
+      ((magnitude - 1.0) * - 20 * DEG_TO_RAD)) 
+    {
+      xglColor3f (magnitude, magnitude, magnitude);
+      xglVertex3f( 50000.0 * cos (ra) * cos (dec),
+                  50000.0 * sin (ra) * cos (dec),
+                  50000.0 * sin (dec));
+    }
+}
+
+
+SolarSystem* SolarSystem::theSolarSystem = 0;
+
+/******************************************************************************
+ * void solarSystemRebuild()
+ * this a just a wrapper function, provided for use as an interface to the 
+ * event manager
+ *****************************************************************************/
+void solarSystemRebuild()
+{
+  SolarSystem::theSolarSystem->rebuild();
+}
+
+
+
+
+
+
+
diff --git a/Astro/solarsystem.cxx~ b/Astro/solarsystem.cxx~
new file mode 100644 (file)
index 0000000..3114908
--- /dev/null
@@ -0,0 +1,256 @@
+/**************************************************************************
+ * solarsystem.cxx
+ * Written by Durk Talsma. Originally started October 1997, for distribution  
+ * with the FlightGear project. Version 2 was written in August and 
+ * September 1998. This code is based upon algorithms and data kindly 
+ * provided by Mr. Paul Schlyter. (pausch@saaf.se). 
+ *
+ * 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 program 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.
+ *
+ * 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.
+ *
+ * $Id$
+ * (Log is kept at end of this file)
+ **************************************************************************/
+#include <GL/glut.h>
+#include <XGL/xgl.h>
+#include <Debug/fg_debug.h>
+#include <Time/sunpos.hxx>
+#include "solarsystem.hxx"
+
+/***************************************************************************
+ * default constructor for class  SolarSystem:   
+ * or course there can only be one way to create an entire solar system -:) )
+ * the fgTIME argument is needed to properly initialize the the current orbital
+ * elements
+ *************************************************************************/
+SolarSystem::SolarSystem(fgTIME *t)
+{
+  if (theSolarSystem)
+    {
+      fgPrintf(FG_GENERAL, FG_EXIT, "Error: only one solarsystem allowed\n");
+    }
+  theSolarSystem = this;
+  ourSun     = new Star(t);   
+  earthsMoon = new Moon(t);
+  mercury    = new Mercury(t);
+  venus      = new Venus(t);
+  mars       = new Mars(t);
+  jupiter    = new Jupiter(t);
+  saturn     = new Saturn(t);
+  uranus     = new Uranus(t);
+  neptune    = new Neptune(t);
+
+  displayList = 0;
+};
+
+/* --------------------------------------------------------------------------
+   the destructor for class SolarSystem;
+   danger: Huge Explosions ahead! (-:))
+   ------------------------------------------------------------------------*/
+SolarSystem::~SolarSystem()
+{
+  delete ourSun;
+  delete earthsMoon;
+  delete mercury;
+  delete venus;
+  delete mars;
+  delete jupiter;
+  delete saturn;
+  delete uranus;
+  delete neptune;
+  //delete pluto;
+}
+/****************************************************************************
+ * void SolarSystem::rebuild()
+ *
+ * this member function updates the positions for the sun, moon, and planets,
+ * and then rebuilds the display list. 
+ *
+ * arguments: none
+ * return value: none
+ ***************************************************************************/
+void SolarSystem::rebuild()
+{
+  fgLIGHT *l = &cur_light_params;
+  fgTIME  *t = &cur_time_params;  
+  float x, y, z,
+    xx, yy,zz;
+  double ra, dec;
+  double x_2, x_4, x_8, x_10;
+  double magnitude;
+  GLfloat ambient;
+  GLfloat amb[4];
+  GLfloat moonColor[4] = {0.85, 0.75, 0.35, 1.0};
+  GLfloat black[4] = {0.0, 0.0,0.0,1.0};
+  GLfloat white[4] = {1.0, 1.0,1.0,1.0};
+
+  // Step 1: update all the positions
+  ourSun->updatePosition(t);
+  earthsMoon->updatePosition(t, ourSun);
+  mercury->updatePosition(t, ourSun);
+  venus->updatePosition(t, ourSun);
+  mars->updatePosition(t, ourSun);
+  jupiter->updatePosition(t, ourSun);
+  saturn->updatePosition(t, ourSun);
+  uranus->updatePosition(t, ourSun);
+  neptune->updatePosition(t, ourSun);
+  
+  fgUpdateSunPos();   // get the right sun angle (especially important when 
+                      // running for the first time.
+  if (displayList)
+    xglDeleteLists(displayList, 1);
+
+  displayList = xglGenLists(1);
+  // Step 2: rebuild the display list
+  xglNewList( displayList, GL_COMPILE);
+  {
+    // Step 2a: Add the moon...
+    xglEnable( GL_LIGHTING );
+    xglEnable( GL_LIGHT0 );
+    // set lighting parameters
+    xglLightfv(GL_LIGHT0, GL_AMBIENT, white );
+    xglLightfv(GL_LIGHT0, GL_DIFFUSE, white );
+    xglEnable( GL_CULL_FACE );
+    
+    // Enable blending, in order to effectively eliminate the dark side of the
+    // moon
+    glEnable(GL_BLEND);
+    glBlendFunc(GL_ONE, GL_ONE);
+    earthsMoon->getPos(&ra, &dec);
+    x = 60000.0 * cos(ra) * cos (dec);
+    y = 60000.0 * sin(ra) * cos (dec);
+    z = 60000.0 * sin(dec);
+    xx = cos(ra) * cos(dec);
+    yy = sin(ra) * cos(dec);
+    zz = sin(dec);
+    xglMaterialfv(GL_FRONT, GL_AMBIENT, black);
+    xglMaterialfv(GL_FRONT, GL_DIFFUSE, moonColor); 
+    xglPushMatrix();
+    {
+      earthsMoon->newImage(ra,dec);
+    }
+    xglPopMatrix();
+    glDisable(GL_BLEND);
+    xglDisable(GL_LIGHTING);
+    // Step 2b:  Add the sun
+    x_2 = l -> sun_angle * l->sun_angle;
+    x_4 = x_2 * x_2;
+    x_8 = x_4 * x_4;
+    x_10 = x_8 * x_2;
+    ambient = (0.4 * pow (1.1, - x_10 / 30.0));
+    if (ambient < 0.3) ambient = 0.3;
+    if (ambient > 1.0) ambient = 1.0;
+
+    amb[0] = 0.00 + ((ambient * 6.0)  - 1.0); // minimum value = 0.8
+    amb[1] = 0.00 + ((ambient * 11.0) - 3.0); // minimum value = 0.3
+    amb[2] = 0.00 + ((ambient * 12.0) - 3.6); // minimum value = 0.0
+    amb[3] = 1.00;
+
+    if (amb[0] > 1.0) amb[0] = 1.0;
+    if (amb[1] > 1.0) amb[1] = 1.0;
+    if (amb[2] > 1.0) amb[2] = 1.0;
+
+    ourSun->getPos(&ra, &dec);
+    x = 60000.0 * cos(ra) * cos(dec);
+    y = 60000.0 * sin(ra) * cos(dec);
+    z = 60000.0 * sin(dec);
+    xglPushMatrix();
+    {
+      xglPushMatrix();
+      xglTranslatef(x,y,z);
+      xglColor3f(amb[0], amb[1], amb[2]);
+      glutSolidSphere(1400.0, 10, 10);
+    }
+    glPopMatrix();
+    // Step 2c: Add the planets
+    xglBegin(GL_POINTS);
+    mercury->getPos(&ra, &dec, &magnitude);addPlanetToList(ra, dec, magnitude);
+    venus  ->getPos(&ra, &dec, &magnitude);addPlanetToList(ra, dec, magnitude);
+    mars   ->getPos(&ra, &dec, &magnitude);addPlanetToList(ra, dec, magnitude);
+    jupiter->getPos(&ra, &dec, &magnitude);addPlanetToList(ra, dec, magnitude);
+    saturn ->getPos(&ra, &dec, &magnitude);addPlanetToList(ra, dec, magnitude);
+    uranus ->getPos(&ra, &dec, &magnitude);addPlanetToList(ra, dec, magnitude);
+    neptune->getPos(&ra, &dec, &magnitude);addPlanetToList(ra, dec, magnitude);
+    xglEnd();
+    xglEnable(GL_LIGHTING);
+  }
+  xglEndList();
+}
+
+/*****************************************************************************
+ * double SolarSystem::scaleMagnitude(double magn)
+ * This private member function rescales the original magnitude, as used in the
+ * astronomical sense of the word, into a value used by OpenGL to draw a 
+ * convincing Star or planet
+ * 
+ * Argument: the astronomical magnitude
+ *
+ * return value: the rescaled magnitude
+ ****************************************************************************/
+double SolarSystem::scaleMagnitude(double magn)
+{
+  double magnitude = (0.0 - magn) / 5.0 + 1.0;
+  magnitude = magnitude * 0.7 + (3 * 0.1);
+  if (magnitude > 1.0) magnitude = 1.0;
+  if (magnitude < 0.0) magnitude = 0.0;
+  return magnitude;
+}
+
+/***************************************************************************
+ * void SolarSytem::addPlanetToList(double ra, double dec, double magn);
+ *
+ * This private member function first causes the magnitude to be properly
+ * rescaled, and then adds the planet to the display list.
+ * 
+ * arguments: Right Ascension, declination, and magnitude
+ *
+ * return value: none
+ **************************************************************************/
+void SolarSystem::addPlanetToList(double ra, double dec, double magn)
+{
+  double
+    magnitude = scaleMagnitude ( magn );
+
+  fgLIGHT *l = &cur_light_params;
+
+  if ((double) (l->sun_angle - FG_PI_2) > 
+      ((magnitude - 1.0) * - 20 * DEG_TO_RAD)) 
+    {
+      xglColor3f (magnitude, magnitude, magnitude);
+      xglVertex3f( 50000.0 * cos (ra) * cos (dec),
+                  50000.0 * sin (ra) * cos (dec),
+                  50000.0 * sin (dec));
+    }
+}
+
+
+SolarSystem* SolarSystem::theSolarSystem = 0;
+
+/******************************************************************************
+ * void solarSystemRebuild()
+ * this a just a wrapper function, provided for use as an interface to the 
+ * event manager
+ *****************************************************************************/
+void solarSystemRebuild()
+{
+  SolarSystem::theSolarSystem->rebuild();
+}
+
+
+
+
+
+
+
diff --git a/Astro/solarsystem.hxx b/Astro/solarsystem.hxx
new file mode 100644 (file)
index 0000000..235c011
--- /dev/null
@@ -0,0 +1,106 @@
+/**************************************************************************
+ * solarsystem.hxx
+ * Written by Durk Talsma. Originally started October 1997, for distribution  
+ * with the FlightGear project. Version 2 was written in August and 
+ * September 1998. This code is based upon algorithms and data kindly 
+ * provided by Mr. Paul Schlyter. (pausch@saaf.se). 
+ *
+ * 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 program 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.
+ *
+ * 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.
+ *
+ * $Id$
+ * (Log is kept at end of this file)
+ **************************************************************************/
+#ifndef _SOLARSYSTEM_H_
+#define _SOLARSYSTEM_H_
+
+#include <Time/light.hxx>
+#include <Time/fg_time.hxx>
+#include <Main/views.hxx>
+
+#include "star.hxx"
+#include "moon.hxx"
+#include "mercury.hxx"
+#include "venus.hxx"
+#include "mars.hxx"
+#include "jupiter.hxx"
+#include "saturn.hxx"
+#include "uranus.hxx"
+#include "neptune.hxx"
+#include "pluto.hxx"
+
+
+extern fgLIGHT cur_light_params;
+extern fgTIME  cur_time_params;
+extern fgVIEW  current_view;
+
+
+
+class SolarSystem
+{
+private:
+  Star*    ourSun;
+  Moon*    earthsMoon;
+  Mercury* mercury;
+  Venus*   venus;
+  Mars*    mars;
+  Jupiter* jupiter;
+  Saturn*  saturn;
+  Uranus*  uranus;
+  Neptune* neptune;
+  //Pluto*   pluto;
+  
+  GLint displayList;
+  double scaleMagnitude(double magn);
+  void addPlanetToList(double ra, double dec, double magn);
+
+
+public:
+  SolarSystem(fgTIME *t);
+  Star *getSun();
+  ~SolarSystem();
+
+  static SolarSystem *theSolarSystem;  // thanks to Bernie Bright!
+  void rebuild();
+  friend void solarSystemRebuild();
+  void draw();
+  
+};
+
+inline Star * SolarSystem::getSun()
+{
+  return ourSun;
+}
+
+inline void SolarSystem::draw()
+{
+  xglCallList(displayList);
+}
+  
+extern void solarSystemRebuild();
+
+#endif // _SOLARSYSTEM_H_
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Astro/star.cxx b/Astro/star.cxx
new file mode 100644 (file)
index 0000000..f43eeba
--- /dev/null
@@ -0,0 +1,90 @@
+/**************************************************************************
+ * star.cxx
+ * Written by Durk Talsma. Originally started October 1997, for distribution  
+ * with the FlightGear project. Version 2 was written in August and 
+ * September 1998. This code is based upon algorithms and data kindly 
+ * provided by Mr. Paul Schlyter. (pausch@saaf.se). 
+ *
+ * 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 program 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.
+ *
+ * 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.
+ *
+ * $Id$
+ * (Log is kept at end of this file)
+ **************************************************************************/
+#include "star.hxx"
+
+/*************************************************************************
+ * Star::Star(fgTIME *t)
+ * Public constructor for class Star
+ * Argument: The current time.
+ * the hard coded orbital elements our sun are passed to 
+ * CelestialBody::CelestialBody();
+ * note that the word sun is avoided, in order to prevent some compilation
+ * problems on sun systems 
+ ************************************************************************/
+Star::Star(fgTIME *t) :
+  CelestialBody (0.000000,  0.0000000000,
+                0.0000,    0.00000,
+                282.9404,  4.7093500E-5,       
+                1.0000000, 0.000000,   
+                0.016709,  -1.151E-9,
+                356.0470,  0.98560025850, t)
+{
+}
+/*************************************************************************
+ * void Jupiter::updatePosition(fgTIME *t, Star *ourSun)
+ * 
+ * calculates the current position of our sun.
+ *************************************************************************/
+void Star::updatePosition(fgTIME *t)
+{
+  double 
+    actTime, eccAnom, 
+    xv, yv, v, r,
+    xe, ye, ze, ecl;
+
+  updateOrbElements(t);
+  
+  actTime = fgCalcActTime(t);
+  ecl = DEG_TO_RAD * (23.4393 - 3.563E-7 * actTime); // Angle in Radians
+  eccAnom = fgCalcEccAnom(M, e);  // Calculate the eccentric Anomaly (also known as solving Kepler's equation)
+  
+  xv = cos(eccAnom) - e;
+  yv = sqrt (1.0 - e*e) * sin(eccAnom);
+  v = atan2 (yv, xv);                   // the sun's true anomaly
+  r = sqrt (xv*xv + yv*yv);             // and its distance
+
+  longitude = v + w; // the sun's true longitude
+  
+  // convert the sun's true longitude to ecliptic rectangular 
+  // geocentric coordinates (xs, ys)
+  xs = r * cos (longitude);
+  ys = r * sin (longitude);
+
+  // convert ecliptic coordinates to equatorial rectangular
+  // geocentric coordinates
+
+  xe = xs;
+  ye = ys * cos (ecl);
+  ze = ys * sin (ecl);
+
+  // And finally, calculate right ascension and declination
+  rightAscension = atan2 (ye, xe);
+  declination = atan2 (ze, sqrt (xe*xe + ye*ye));
+}
+  
+
+  
+  
+  
diff --git a/Astro/star.hxx b/Astro/star.hxx
new file mode 100644 (file)
index 0000000..7dc2fe4
--- /dev/null
@@ -0,0 +1,97 @@
+/**************************************************************************
+ * star.hxx
+ * Written by Durk Talsma. Originally started October 1997, for distribution  
+ * with the FlightGear project. Version 2 was written in August and 
+ * September 1998. This code is based upon algorithms and data kindly 
+ * provided by Mr. Paul Schlyter. (pausch@saaf.se). 
+ *
+ * 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 program 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.
+ *
+ * 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.
+ *
+ * $Id$
+ * (Log is kept at end of this file)
+ **************************************************************************/
+#ifndef _STAR_HXX_
+#define _STAR_HXX_
+
+#include <Time/fg_time.hxx>
+#include "celestialBody.hxx"
+
+
+class Star : public CelestialBody
+{
+private:
+  double longitude;  // the sun's true longitude
+  double xs, ys;     // the sun's rectangular geocentric coordinates
+  double distance;   // the sun's distance to the earth
+public:
+  Star (fgTIME *t);
+  void updatePosition(fgTIME *t);
+  double getM();
+  double getw();
+  double getLon();
+  double getxs();
+  double getys();
+  double getDistance();
+};
+
+
+
+inline double Star::getM()
+{
+  return M;
+}
+
+inline double Star::getw()
+{
+  return w;
+}
+
+inline double Star::getLon()
+{
+  return longitude;
+}
+
+inline double Star::getxs()
+{
+  return xs;
+}
+
+inline double Star::getys()
+{
+  return ys;
+}
+
+inline double Star::getDistance()
+{
+  return distance;
+}
+
+
+#endif // _STAR_HXX_
+
+
+
+
+
+
+
+
+
+
+
+
+
+
index 98bc9c5a886874f8191304989fa51a87d00036ac..d9b7cb1aa0511f6f58d4c603512fc9a1beea8471 100644 (file)
@@ -51,8 +51,8 @@
 #include <Misc/stopwatch.hxx>
 #include <Time/fg_time.hxx>
 
-#include "orbits.hxx"
-#include "planets.hxx"
+// #include "orbits.hxx"
+// #include "planets.hxx"
 #include "stars.hxx"
 
 
@@ -261,64 +261,68 @@ void fgStarsRender( void ) {
 
 
 /* $Log$
-/* Revision 1.13  1998/09/01 19:03:04  curt
-/* Changes contributed by Bernie Bright <bbright@c031.aone.net.au>
-/*  - The new classes in libmisc.tgz define a stream interface into zlib.
-/*    I've put these in a new directory, Lib/Misc.  Feel free to rename it
-/*    to something more appropriate.  However you'll have to change the
-/*    include directives in all the other files.  Additionally you'll have
-/*    add the library to Lib/Makefile.am and Simulator/Main/Makefile.am.
-/*
-/*    The StopWatch class in Lib/Misc requires a HAVE_GETRUSAGE autoconf
-/*    test so I've included the required changes in config.tgz.
-/*
-/*    There are a fair few changes to Simulator/Objects as I've moved
-/*    things around.  Loading tiles is quicker but thats not where the delay
-/*    is.  Tile loading takes a few tenths of a second per file on a P200
-/*    but it seems to be the post-processing that leads to a noticeable
-/*    blip in framerate.  I suppose its time to start profiling to see where
-/*    the delays are.
-/*
-/*    I've included a brief description of each archives contents.
-/*
-/* Lib/Misc/
-/*   zfstream.cxx
-/*   zfstream.hxx
-/*     C++ stream interface into zlib.
-/*     Taken from zlib-1.1.3/contrib/iostream/.
-/*     Minor mods for STL compatibility.
-/*     There's no copyright associated with these so I assume they're
-/*     covered by zlib's.
-/*
-/*   fgstream.cxx
-/*   fgstream.hxx
-/*     FlightGear input stream using gz_ifstream.  Tries to open the
-/*     given filename.  If that fails then filename is examined and a
-/*     ".gz" suffix is removed or appended and that file is opened.
-/*
-/*   stopwatch.hxx
-/*     A simple timer for benchmarking.  Not used in production code.
-/*     Taken from the Blitz++ project.  Covered by GPL.
-/*
-/*   strutils.cxx
-/*   strutils.hxx
-/*     Some simple string manipulation routines.
-/*
-/* Simulator/Airports/
-/*   Load airports database using fgstream.
-/*   Changed fgAIRPORTS to use set<> instead of map<>.
-/*   Added bool fgAIRPORTS::search() as a neater way doing the lookup.
-/*   Returns true if found.
-/*
-/* Simulator/Astro/
-/*   Modified fgStarsInit() to load stars database using fgstream.
-/*
-/* Simulator/Objects/
-/*   Modified fgObjLoad() to use fgstream.
-/*   Modified fgMATERIAL_MGR::load_lib() to use fgstream.
-/*   Many changes to fgMATERIAL.
-/*   Some changes to fgFRAGMENT but I forget what!
+/* Revision 1.14  1998/09/15 04:26:22  curt
+/* New textured moon and rewritten/restructured Astro code contributed by Durk
+/* Talsma.
 /*
+ * Revision 1.13  1998/09/01 19:03:04  curt
+ * Changes contributed by Bernie Bright <bbright@c031.aone.net.au>
+ *  - The new classes in libmisc.tgz define a stream interface into zlib.
+ *    I've put these in a new directory, Lib/Misc.  Feel free to rename it
+ *    to something more appropriate.  However you'll have to change the
+ *    include directives in all the other files.  Additionally you'll have
+ *    add the library to Lib/Makefile.am and Simulator/Main/Makefile.am.
+ *
+ *    The StopWatch class in Lib/Misc requires a HAVE_GETRUSAGE autoconf
+ *    test so I've included the required changes in config.tgz.
+ *
+ *    There are a fair few changes to Simulator/Objects as I've moved
+ *    things around.  Loading tiles is quicker but thats not where the delay
+ *    is.  Tile loading takes a few tenths of a second per file on a P200
+ *    but it seems to be the post-processing that leads to a noticeable
+ *    blip in framerate.  I suppose its time to start profiling to see where
+ *    the delays are.
+ *
+ *    I've included a brief description of each archives contents.
+ *
+ * Lib/Misc/
+ *   zfstream.cxx
+ *   zfstream.hxx
+ *     C++ stream interface into zlib.
+ *     Taken from zlib-1.1.3/contrib/iostream/.
+ *     Minor mods for STL compatibility.
+ *     There's no copyright associated with these so I assume they're
+ *     covered by zlib's.
+ *
+ *   fgstream.cxx
+ *   fgstream.hxx
+ *     FlightGear input stream using gz_ifstream.  Tries to open the
+ *     given filename.  If that fails then filename is examined and a
+ *     ".gz" suffix is removed or appended and that file is opened.
+ *
+ *   stopwatch.hxx
+ *     A simple timer for benchmarking.  Not used in production code.
+ *     Taken from the Blitz++ project.  Covered by GPL.
+ *
+ *   strutils.cxx
+ *   strutils.hxx
+ *     Some simple string manipulation routines.
+ *
+ * Simulator/Airports/
+ *   Load airports database using fgstream.
+ *   Changed fgAIRPORTS to use set<> instead of map<>.
+ *   Added bool fgAIRPORTS::search() as a neater way doing the lookup.
+ *   Returns true if found.
+ *
+ * Simulator/Astro/
+ *   Modified fgStarsInit() to load stars database using fgstream.
+ *
+ * Simulator/Objects/
+ *   Modified fgObjLoad() to use fgstream.
+ *   Modified fgMATERIAL_MGR::load_lib() to use fgstream.
+ *   Many changes to fgMATERIAL.
+ *   Some changes to fgFRAGMENT but I forget what!
+ *
  * Revision 1.12  1998/08/27 17:02:01  curt
  * Contributions from Bernie Bright <bbright@c031.aone.net.au>
  * - use strings for fg_root and airport_id and added methods to return
index a5a4ba14fcdd7b272e414ace9348b6e5d12fc662..9e9f18b1960ea6fb32bde4d609dc2c37dc7aab5e 100644 (file)
@@ -32,6 +32,7 @@
 # error This library requires C++
 #endif                                   
 
+#include <Time/fg_time.hxx>
 
 #define FG_STAR_LEVELS 8         /* how many star transitions */
 
@@ -49,10 +50,14 @@ extern fgTIME cur_time_params;
 
 
 /* $Log$
-/* Revision 1.3  1998/08/06 12:45:20  curt
-/* Modified to bring in stars in 8 increments based on magnitude, not number
-/* of stars.
+/* Revision 1.4  1998/09/15 04:26:23  curt
+/* New textured moon and rewritten/restructured Astro code contributed by Durk
+/* Talsma.
 /*
+ * Revision 1.3  1998/08/06 12:45:20  curt
+ * Modified to bring in stars in 8 increments based on magnitude, not number
+ * of stars.
+ *
  * Revision 1.2  1998/04/28 01:19:03  curt
  * Type-ified fgTIME and fgVIEW
  *
diff --git a/Astro/sun.cxx b/Astro/sun.cxx
deleted file mode 100644 (file)
index 3f3a58d..0000000
+++ /dev/null
@@ -1,294 +0,0 @@
-/**************************************************************************
- * sun.c
- *
- * Written 1997 by Durk Talsma, started October, 1997.  For the flight gear
- * project.
- *
- * 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 program 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.
- *
- * 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.
- *
- * $Id$
- * (Log is kept at end of this file)
- **************************************************************************/
-
-
-#ifdef HAVE_CONFIG_H
-#  include <config.h>
-#endif
-#ifdef HAVE_WINDOWS_H                                           
-#  include <windows.h>                                           
-#endif                                                               
-#include <GL/glut.h>
-#include <XGL/xgl.h>
-
-#include <Debug/fg_debug.h>
-#include <Include/fg_constants.h>
-#include <Main/views.hxx>
-#include <Time/fg_time.hxx>
-#include <Time/sunpos.hxx>
-
-#include "orbits.hxx"
-#include "sun.hxx"
-
-
-GLint sun_obj = 0;
-
-static struct CelestialCoord sunPos;
-
-fgSUNPOS solarPosition;
-
-void fgCalcSunPos(struct OrbElements params)
-{
-    double EccAnom, xv, yv, v, r;
-
-    /* calculate the eccentric anomaly */
-    EccAnom = fgCalcEccAnom(params.M, params.e);
-
-    /* calculate the Suns distance (r) and its true anomaly (v) */
-    xv = cos(EccAnom) - params.e;
-    yv = sqrt(1.0 - params.e*params.e) * sin(EccAnom);
-    v = atan2(yv, xv);
-    r = sqrt(xv*xv + yv*yv);
-
-    /* calculate the the Sun's true longitude (lonsun) */
-    solarPosition.lonSun = v + params.w;
-
-    /* convert true longitude and distance to ecliptic rectangular
-      geocentric coordinates (xs, ys) */
-    solarPosition.xs = r * cos (solarPosition.lonSun);
-    solarPosition.ys = r * sin (solarPosition.lonSun);
-    solarPosition.dist = r;
-    /* return solarPosition; */
-}
-
-
-struct CelestialCoord fgCalculateSun (struct OrbElements params, 
-                                     fgTIME t)
-{
-    struct CelestialCoord result;
-    double xe, ye, ze, ecl, actTime;
-
-    /* calculate the angle between ecliptic and equatorial coordinate
-     * system */
-    actTime = fgCalcActTime (t);
-    ecl = DEG_TO_RAD * (23.4393 - 3.563E-7 * actTime); // Angle now in Rads
-
-    /* calculate the sun's ecliptic position */
-    fgCalcSunPos (params);
-
-    /* convert ecliptic coordinates to equatorial rectangular
-     * geocentric coordinates */
-    xe = solarPosition.xs;
-    ye = solarPosition.ys * cos (ecl);
-    ze = solarPosition.ys * sin (ecl);
-
-    /* and finally... Calulate Right Ascention and Declination */
-    result.RightAscension = atan2 (ye, xe);
-    result.Declination = atan2 (ze, sqrt (xe * xe + ye * ye));
-    return result;
-}
-
-
-/* Initialize the Sun */
-void fgSunInit( void ) {
-    fgLIGHT *l;
-    fgTIME *t;
-    fgVIEW *v;  
-    float xSun, ySun, zSun;
-
-    /* GLfloat color[4] = { 1.00, 1.00, 1.00, 1.00 }; */
-    double x_2, x_4, x_8, x_10;
-    GLfloat ambient;
-    GLfloat amb[4];
-
-    l = &cur_light_params;
-    t = &cur_time_params;
-    v = &current_view;
-
-    fgPrintf( FG_ASTRO, FG_INFO, "  Initializing the Sun\n");
-
-    // Calculate basic sun position
-    fgSolarSystemUpdate(&(pltOrbElements[0]), cur_time_params);
-    sunPos = fgCalculateSun(pltOrbElements[0], cur_time_params);
-
-    // Calculate additional sun position parameters based on the above
-    // position that are needed by other parts of FG
-    fgUpdateSunPos();
-
-    fgPrintf( FG_ASTRO, FG_INFO,
-             "Sun found at %f (ra), %f (dec)\n",
-             sunPos.RightAscension, sunPos.Declination);
-
-    xSun = 60000.0 * cos(sunPos.RightAscension) * cos(sunPos.Declination);
-    ySun = 60000.0 * sin(sunPos.RightAscension) * cos(sunPos.Declination);
-    zSun = 60000.0 * sin(sunPos.Declination);
-
-
-    if (sun_obj) {
-       xglDeleteLists(sun_obj, 1);
-    }
-
-    /* printf("First time through, creating sun display list\n"); */
-
-    sun_obj = xglGenLists(1);
-    xglNewList(sun_obj, GL_COMPILE );
-
-
-    t = &cur_time_params;
-    v = &current_view;
-    l = &cur_light_params;
-
-    x_2 = l->sun_angle * l->sun_angle;
-    x_4 = x_2 * x_2;
-    x_8 = x_4 * x_4;
-    x_10 = x_8 * x_2;
-
-    ambient = (0.4 * pow(1.1, -x_10 / 30.0));
-    if ( ambient < 0.3 ) ambient = 0.3;
-    if ( ambient > 1.0 ) ambient = 1.0;
-
-    amb[0] = 0.00 + ((ambient * 6.0) - 1.0);     /* minimum val = 0.8 */
-    amb[1] = 0.00 + ((ambient * 11.0) - 3.0);     /* minimum val = 0.3 */ 
-    amb[2] = 0.00 + ((ambient * 12.0) - 3.6);    /* minimum val = 0.0 */ 
-    amb[3] = 1.00;   
-
-    if (amb[0] > 1.0) amb[0] = 1.0;
-    if (amb[1] > 1.0) amb[1] = 1.0;
-    if (amb[2] > 1.0) amb[2] = 1.0;
-
-    fgPrintf( FG_ASTRO, FG_DEBUG,
-              "Color of the sun: %f, %f, %f\n"
-              "Ambient value   : %f\n"
-              "Sun Angle       : %f\n" ,
-              amb[0], amb[1], amb[2], ambient, l->sun_angle);
-
-    xglPushMatrix();
-    xglTranslatef(xSun, ySun, zSun);
-    xglColor3f(amb[0], amb[1], amb[2]); 
-    glutSolidSphere(1200.0, 10, 10);
-    xglPopMatrix();
-    xglEndList();
-}
-
-
-/* Draw the Sun */
-void fgSunRender( void ) {
-    xglCallList(sun_obj);
-}
-
-
-/* $Log$
-/* Revision 1.6  1998/07/30 23:43:31  curt
-/* Eliminated glScale call so that glutSolidSphere normals are preserved
-/* correctly.  Also made the sun & moon a bit smaller.
-/*
- * Revision 1.5  1998/04/28 01:19:04  curt
- * Type-ified fgTIME and fgVIEW
- *
- * Revision 1.4  1998/04/26 05:10:02  curt
- * "struct fgLIGHT" -> "fgLIGHT" because fgLIGHT is typedef'd.
- *
- * Revision 1.3  1998/04/25 22:06:26  curt
- * Edited cvs log messages in source files ... bad bad bad!
- *
- * Revision 1.2  1998/04/24 00:45:04  curt
- * Wrapped "#include <config.h>" in "#ifdef HAVE_CONFIG_H"
- * Fixed a bug when generating sky colors.
- *
- * Revision 1.1  1998/04/22 13:21:36  curt
- * C++ - ifing the code a bit.
- *
- * Revision 1.10  1998/04/18 04:13:58  curt
- * Moved fg_debug.c to it's own library.
- *
- * Revision 1.9  1998/04/03 21:52:51  curt
- * Converting to Gnu autoconf system.
- *
- * Revision 1.8  1998/03/09 22:47:25  curt
- * Incorporated Durk's updates.
- *
- * Revision 1.7  1998/02/23 19:07:56  curt
- * Incorporated Durk's Astro/ tweaks.  Includes unifying the sun position
- * calculation code between sun display, and other FG sections that use this
- * for things like lighting.
- *
- * Revision 1.6  1998/02/12 21:59:39  curt
- * Incorporated code changes contributed by Charlie Hotchkiss
- * <chotchkiss@namg.us.anritsu.com>
- *
- * Revision 1.5  1998/02/02 20:53:24  curt
- * To version 0.29
- *
- * Revision 1.4  1998/01/27 00:47:50  curt
- * Incorporated Paul Bleisch's <pbleisch@acm.org> new debug message
- * system and commandline/config file processing code.
- *
- * Revision 1.3  1998/01/19 19:27:00  curt
- * Merged in make system changes from Bob Kuehne <rpk@sgi.com>
- * This should simplify things tremendously.
- *
- * Revision 1.2  1998/01/19 18:40:18  curt
- * Tons of little changes to clean up the code and to remove fatal errors
- * when building with the c++ compiler.
- *
- * Revision 1.1  1998/01/07 03:16:20  curt
- * Moved from .../Src/Scenery/ to .../Src/Astro/
- *
- * Revision 1.12  1998/01/05 18:44:36  curt
- * Add an option to advance/decrease time from keyboard.
- *
- * Revision 1.11  1997/12/30 23:09:40  curt
- * Worked on winding problem without luck, so back to calling glFrontFace()
- * 3 times for each scenery area.
- *
- * Revision 1.10  1997/12/30 20:47:54  curt
- * Integrated new event manager with subsystem initializations.
- *
- * Revision 1.9  1997/12/30 16:36:54  curt
- * Merged in Durk's changes ...
- *
- * Revision 1.8  1997/12/19 23:35:00  curt
- * Lot's of tweaking with sky rendering and lighting.
- *
- * Revision 1.7  1997/12/17 23:12:16  curt
- * Fixed so moon and sun display lists aren't recreate periodically.
- *
- * Revision 1.6  1997/12/15 23:55:04  curt
- * Add xgl wrappers for debugging.
- * Generate terrain normals on the fly.
- *
- * Revision 1.5  1997/12/12 21:41:31  curt
- * More light/material property tweaking ... still a ways off.
- *
- * Revision 1.4  1997/12/10 22:37:53  curt
- * Prepended "fg" on the name of all global structures that didn't have it yet.
- * i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
- *
- * Revision 1.3  1997/12/09 05:11:56  curt
- * Working on tweaking lighting.
- *
- * Revision 1.2  1997/11/25 19:25:39  curt
- * Changes to integrate Durk's moon/sun code updates + clean up.
- *
- * Revision 1.1  1997/10/25 03:16:11  curt
- * Initial revision of code contributed by Durk Talsma.
- *
- */
-
-
-
-
-
diff --git a/Astro/sun.hxx b/Astro/sun.hxx
deleted file mode 100644 (file)
index 6a6f3ba..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-/**************************************************************************
- * sun.hxx
- *
- * Written 1997 by Durk Talsma, started October, 1997.  For the flight gear
- * project.
- *
- * 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 program 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.
- *
- * 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.
- *
- * $Id$
- * (Log is kept at end of this file)
- **************************************************************************/
-
-
-#ifndef _SUN_HXX
-#define _SUN_HXX
-
-
-#ifndef __cplusplus                                                          
-# error This library requires C++
-#endif                                   
-
-
-extern fgSUNPOS solarPosition;
-
-
-void fgCalcSunPos (struct OrbElements sunParams);
-extern struct OrbElements pltOrbElements[9];
-
-
-/* Initialize the Sun */
-void fgSunInit( void );
-
-
-/* Draw the Sun */
-void fgSunRender( void );
-
-
-#endif /* _SUN_HXX */
-
-
-/* $Log$
-/* Revision 1.1  1998/04/22 13:21:37  curt
-/* C++ - ifing the code a bit.
-/*
- * Revision 1.6  1998/04/21 17:02:33  curt
- * Prepairing for C++ integration.
- *
- * Revision 1.5  1998/03/09 22:47:26  curt
- * Incorporated Durk's updates.
- *
- * Revision 1.4  1998/02/23 19:07:57  curt
- * Incorporated Durk's Astro/ tweaks.  Includes unifying the sun position
- * calculation code between sun display, and other FG sections that use this
- * for things like lighting.
- *
- * Revision 1.3  1998/01/22 02:59:29  curt
- * Changed #ifdef FILE_H to #ifdef _FILE_H
- *
- * Revision 1.2  1998/01/19 18:40:19  curt
- * Tons of little changes to clean up the code and to remove fatal errors
- * when building with the c++ compiler.
- *
- * Revision 1.1  1998/01/07 03:16:21  curt
- * Moved from .../Src/Scenery/ to .../Src/Astro/
- *
- * Revision 1.3  1997/12/11 04:43:56  curt
- * Fixed sun vector and lighting problems.  I thing the moon is now lit
- * correctly.
- *
- * Revision 1.2  1997/11/25 19:25:39  curt
- * Changes to integrate Durk's moon/sun code updates + clean up.
- *
- * Revision 1.1  1997/10/25 03:16:12  curt
- * Initial revision of code contributed by Durk Talsma.
- *
- */
diff --git a/Astro/uranus.cxx b/Astro/uranus.cxx
new file mode 100644 (file)
index 0000000..e21b06a
--- /dev/null
@@ -0,0 +1,55 @@
+/**************************************************************************
+ * uranus.cxx
+ * Written by Durk Talsma. Originally started October 1997, for distribution  
+ * with the FlightGear project. Version 2 was written in August and 
+ * September 1998. This code is based upon algorithms and data kindly 
+ * provided by Mr. Paul Schlyter. (pausch@saaf.se). 
+ *
+ * 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 program 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.
+ *
+ * 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.
+ *
+ * $Id$
+ * (Log is kept at end of this file)
+ **************************************************************************/
+#include "uranus.hxx"
+
+/*************************************************************************
+ * Uranus::Uranus(fgTIME *t)
+ * Public constructor for class Uranus
+ * Argument: The current time.
+ * the hard coded orbital elements for Uranus are passed to 
+ * CelestialBody::CelestialBody();
+ ************************************************************************/
+Uranus::Uranus(fgTIME *t) :
+  CelestialBody(74.00050,   1.3978000E-5,
+               0.7733,     1.900E-8,
+               96.66120,   3.0565000E-5,
+               19.181710, -1.55E-8,
+               0.047318,   7.450E-9,
+               142.5905,   0.01172580600, t)
+{
+}
+
+/*************************************************************************
+ * void Uranus::updatePosition(fgTIME *t, Star *ourSun)
+ * 
+ * calculates the current position of Uranus, by calling the base class,
+ * CelestialBody::updatePosition(); The current magnitude is calculated using 
+ * a Uranus specific equation
+ *************************************************************************/
+void Uranus::updatePosition(fgTIME *t, Star *ourSun)
+{
+  CelestialBody::updatePosition(t, ourSun);
+  magnitude = -7.15 + 5*log10( r*R) + 0.001 * FV;
+}
diff --git a/Astro/uranus.hxx b/Astro/uranus.hxx
new file mode 100644 (file)
index 0000000..cd623b3
--- /dev/null
@@ -0,0 +1,39 @@
+/**************************************************************************
+ * uranus.hxx
+ * Written by Durk Talsma. Originally started October 1997, for distribution  
+ * with the FlightGear project. Version 2 was written in August and 
+ * September 1998. This code is based upon algorithms and data kindly 
+ * provided by Mr. Paul Schlyter. (pausch@saaf.se). 
+ *
+ * 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 program 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.
+ *
+ * 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.
+ *
+ * $Id$
+ * (Log is kept at end of this file)
+ **************************************************************************/
+#ifndef _URANUS_HXX_
+#define _URANUS_HXX_
+
+#include <Time/fg_time.hxx>
+#include "celestialBody.hxx"
+#include "star.hxx"
+
+class Uranus : public CelestialBody
+{
+public:
+  Uranus ( fgTIME *t);
+  void updatePosition(fgTIME *t, Star *sun);
+};
+
+#endif // _URANUS_HXX_
diff --git a/Astro/venus.cxx b/Astro/venus.cxx
new file mode 100644 (file)
index 0000000..3e07e79
--- /dev/null
@@ -0,0 +1,55 @@
+/**************************************************************************
+ * venus.cxx
+ * Written by Durk Talsma. Originally started October 1997, for distribution  
+ * with the FlightGear project. Version 2 was written in August and 
+ * September 1998. This code is based upon algorithms and data kindly 
+ * provided by Mr. Paul Schlyter. (pausch@saaf.se). 
+ *
+ * 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 program 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.
+ *
+ * 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.
+ *
+ * $Id$
+ * (Log is kept at end of this file)
+ **************************************************************************/
+#include "venus.hxx"
+
+/*************************************************************************
+ * Venus::Venus(fgTIME *t)
+ * Public constructor for class Venus
+ * Argument: The current time.
+ * the hard coded orbital elements for Venus are passed to 
+ * CelestialBody::CelestialBody();
+ ************************************************************************/
+Venus::Venus(fgTIME *t) :
+  CelestialBody(76.67990,  2.4659000E-5, 
+               3.3946,    2.75E-8,
+               54.89100,  1.3837400E-5,
+               0.7233300, 0.000000,
+               0.006773, -1.302E-9,
+               48.00520,  1.60213022440, t)
+{
+}
+
+/*************************************************************************
+ * void Venus::updatePosition(fgTIME *t, Star *ourSun)
+ * 
+ * calculates the current position of Venus, by calling the base class,
+ * CelestialBody::updatePosition(); The current magnitude is calculated using 
+ * a Venus specific equation
+ *************************************************************************/
+void Venus::updatePosition(fgTIME *t, Star *ourSun)
+{
+  CelestialBody::updatePosition(t, ourSun);
+  magnitude = -4.34 + 5*log10( r*R ) + 0.013 * FV + 4.2E-07 * pow(FV,3);
+}
diff --git a/Astro/venus.hxx b/Astro/venus.hxx
new file mode 100644 (file)
index 0000000..fb062de
--- /dev/null
@@ -0,0 +1,39 @@
+/**************************************************************************
+ * venus.hxx
+ * Written by Durk Talsma. Originally started October 1997, for distribution  
+ * with the FlightGear project. Version 2 was written in August and 
+ * September 1998. This code is based upon algorithms and data kindly 
+ * provided by Mr. Paul Schlyter. (pausch@saaf.se). 
+ *
+ * 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 program 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.
+ *
+ * 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.
+ *
+ * $Id$
+ * (Log is kept at end of this file)
+ **************************************************************************/
+#ifndef _VENUS_HXX_
+#define _VENUS_HXX_
+
+#include <Time/fg_time.hxx>
+#include "celestialBody.hxx"
+#include "star.hxx"
+
+class Venus : public CelestialBody
+{
+public:
+  Venus ( fgTIME *t);
+  void updatePosition(fgTIME *t, Star *ourSun);
+};
+
+#endif // _VENUS_HXX_