- Main Page
- Classes
- Files

- File List

# C:/Users/Andreas Schiffler/Desktop/SVN/NewGamePhysics/NewGamePhysics/Physics/CelestialBody.cs

    00001 ﻿// --------------------------------------------------------
    00002 // CelestialBody.cs
    00003 // (A. Schiffler, 2009)
    00004 // --------------------------------------------------------
    00005
    00006 namespace NewGamePhysics.Physics
    00007 {
    00008     using System;
    00009     using System.Text;
    00010
    00014     public enum CelestialObject
    00015     {
    00016         Sun,
    00017         Mercury,
    00018         Venus,
    00019         Earth,
    00020         Moon,
    00021         Mars,
    00022         Jupiter,
    00023         Io,
    00024         Europa,
    00025         Ganymede,
    00026         Callisto,
    00027         Saturn,
    00028         Uranus,
    00029         Neptune,
    00030         Pluto
    00031     }
    00032
    00036     public class CelestialBody
    00037     {
    00041         private CelestialObject celestialObject;
    00042
    00047         public CelestialBody(CelestialObject type)
    00048         {
    00049             this.celestialObject = type;
    00050         }
    00051
    00055         public CelestialObject CelestialObject
    00056         {
    00057             get { return this.celestialObject; }
    00058             set { this.celestialObject = value; }
    00059         }
    00060
    00061         public string GetBodyInfo()
    00062         {
    00063             StringBuilder sb = new StringBuilder();
    00064
    00065             switch (this.celestialObject)
    00066             {
    00067                 case CelestialObject.Sun:
    00068                     sb.AppendLine("The Sun is the star at the center of the Solar System.");
    00069                     sb.AppendLine("Distance from Earth: 1.496E11 m (8.31 min at light speed)");
    00070                     sb.AppendLine("Mean Diameter: 1.392E9 m (109 Earths)");
    00071                     sb.AppendLine("Mass: 1.9891E30 kg (332946 Earths)");
    00072                     sb.AppendLine("Temperature: 5778 K (on surface)");
    00073                     sb.AppendLine("Source: http://www.wikipedia.com");
    00074                     break;
    00075                 case CelestialObject.Mercury:
    00076                     sb.AppendLine("The innermost and smallest planet of the Solar System.");
    00077                     sb.AppendLine("Mean Radius: 2.4397E6 m (0.383 Earths)");
    00078                     sb.AppendLine("Mass: 3.3022E23 kg (0.055 Earths)");
    00079                     sb.AppendLine("Temperature: 80-700 K");
    00080                     sb.AppendLine("Composition: 70% metallic, 30% silicate material");
    00081                     sb.AppendLine("Source: http://www.wikipedia.com");
    00082                     break;
    00083                 case CelestialObject.Venus:
    00084                     sb.AppendLine("The second-closest planet to the Sun in the Solar System.");
    00085                     sb.AppendLine("Mean Radius: 6.0518E6 m (0.95 Earths)");
    00086                     sb.AppendLine("Mass: 4.8685E24 kg (0.815 Earths)");
    00087                     sb.AppendLine("Temperature: 735 K");
    00088                     sb.AppendLine("Atmospheric Pressure: 92x Earth's Pressure");
    00089                     sb.AppendLine("Source: http://www.wikipedia.com");
    00090                     break;
    00091                 case CelestialObject.Earth:
    00092                     sb.AppendLine("The third planet from the Sun in the Solar System.");
    00093                     sb.AppendLine("Mean Radius: 6.371E6 m");
    00094                     sb.AppendLine("Mass: 5.9736E24 kg");
    00095                     sb.AppendLine("Temperature: 184-331 K");
    00096                     sb.AppendLine("Age: 4.54E9 years");
    00097                     sb.AppendLine("Source: http://www.wikipedia.com");
    00098                     break;
    00099                 case CelestialObject.Moon:
    00100                     sb.AppendLine("Earth's only natural satellite and the fifth larges in the Solar System.");
    00101                     sb.AppendLine("Mean Radius: 1.7371E6 m (0.273 Earths)");
    00102                     sb.AppendLine("Mass: 7.3477E22 kg (0.0123 Earths)");
    00103                     sb.AppendLine("Temperature: 70-390 K");
    00104                     sb.AppendLine("Distance Earth-Moon: 3.84403E8 m (30 Earths)");
    00105                     sb.AppendLine("Source: http://www.wikipedia.com");
    00106                     break;
    00107                 case CelestialObject.Mars:
    00108                     sb.AppendLine("The fourth planet from the Sun in the Solar System.");
    00109                     sb.AppendLine("Equatorial Radius: 3.3962E6 m (0.533 Earths)");
    00110                     sb.AppendLine("Mass: 6.418E23 (0.107 Earths)");
    00111                     sb.AppendLine("Temperature: 186-268 K");
    00112                     sb.AppendLine("Moons: two (Phobos and Deimos)");
    00113                     sb.AppendLine("Source: http://www.wikipedia.com");
    00114                     break;
    00115                 case CelestialObject.Jupiter:
    00116                     sb.AppendLine("The fifth planet from the sun and largest planet in the Solar System.");
    00117                     sb.AppendLine("Mean Radius: 7.1492E7 m (11.21 Earths)");
    00118                     sb.AppendLine("Mass: 1.8986E27 kg (317.8 Earths)");
    00119                     sb.AppendLine("Temperature: 112-165 K");
    00120                     sb.AppendLine("Composition: 89.8% Hydrogen 10.2% Helium");
    00121                     sb.AppendLine("Source: http://www.wikipedia.com");
    00122                     break;
    00123                 case CelestialObject.Io:
    00124                     sb.AppendLine("Is the innermost of the Galilean moon of Jupiter.");
    00125                     sb.AppendLine("Mean Radius: 1.8213E6 m (0.286 Earths)");
    00126                     sb.AppendLine("Mass: 8.9319E22 kg (0.015 Earths)");
    00127                     sb.AppendLine("Temperature: 130-200 K");
    00128                     sb.AppendLine("Volcanism: 400 active volcanoes (sulfur, sulfur dioxide)");
    00129                     sb.AppendLine("Source: http://www.wikipedia.com");
    00130                     break;
    00131                 case CelestialObject.Europa:
    00132                     sb.AppendLine("The sixth and smallest Galilean moon of the planet Jupiter.");
    00133                     sb.AppendLine("Mean Radius: 1.569E6 m (0.245 Earths)");
    00134                     sb.AppendLine("Mass: 4.80E22 kg (0.008 Earths)");
    00135                     sb.AppendLine("Temperature: 50-125 K");
    00136                     sb.AppendLine("Surface: 0.64 high albedo icy crust");
    00137                     sb.AppendLine("Source: http://www.wikipedia.com");
    00138                     break;
    00139                 case CelestialObject.Ganymede:
    00140                     sb.AppendLine("The seventh moon of the planet Jupiter and largest one in the Solar System.");
    00141                     sb.AppendLine("Mean Radius: 2.6341E6 m (0.413 Earths)");
    00142                     sb.AppendLine("Mass: 1.4819E23kg (0.025 Earths)");
    00143                     sb.AppendLine("Temperature: 70-152 K");
    00144                     sb.AppendLine("Participates in a 1:2:4 orbital resonance with the satellites Europa and Io.");
    00145                     sb.AppendLine("Source: http://www.wikipedia.com");
    00146                     break;
    00147                 case CelestialObject.Callisto:
    00148                     sb.AppendLine("The fourth moon of the planet Jupiter and third larges one in the Solar System.");
    00149                     sb.AppendLine("Mean Radius: 2.4103E6 m (0.378 Earths)");
    00150                     sb.AppendLine("Mass: 1.0759E23 kg (0.018 Earths)");
    00151                     sb.AppendLine("Temperature: 80-165 K");
    00152                     sb.AppendLine("Surface: the oldest and most cratered in the Solar System");
    00153                     sb.AppendLine("Source: http://www.wikipedia.com");
    00154                     break;
    00155                 case CelestialObject.Saturn:
    00156                     sb.AppendLine("The sixth planet from the Sun and second largest in the Solar System.");
    00157                     sb.AppendLine("Equatorial Radius: 6.0268E7 m (9.45 Earths)");
    00158                     sb.AppendLine("Mass: 5.6846E26 kg (763 Earths)");
    00159                     sb.AppendLine("Temperature: 84-134 K");
    00160                     sb.AppendLine("Cloud Features: hexagonal wave pattern around north pole");
    00161                     sb.AppendLine("Source: http://www.wikipedia.com");
    00162                     break;
    00163                 case CelestialObject.Uranus:
    00164                     sb.AppendLine("The seventh planet from the Sun in the Solar System.");
    00165                     sb.AppendLine("Mean Radius: 2.559E7 m (4.00 Earths)");
    00166                     sb.AppendLine("Mass: 8.6810E25kg (14.54 Earths)");
    00167                     sb.AppendLine("Temperature: 49-76 K");
    00168                     sb.AppendLine("Orbit: period 84 years");
    00169                     sb.AppendLine("Source: http://www.wikipedia.com");
    00170                     break;
    00171                 case CelestialObject.Neptune:
    00172                     sb.AppendLine("The eighth planet from the Sun in the Solar System.");
    00173                     sb.AppendLine("Equatorial Radius: 2.4764E7 m (3.88 Earths)");
    00174                     sb.AppendLine("Mass: 1.0243E26 kg (17.15 Earths)");
    00175                     sb.AppendLine("Temperature: 55-72 K");
    00176                     sb.AppendLine("Weather: strongest sustained wind speed of 2100 km/h");
    00177                     sb.AppendLine("Source: http://www.wikipedia.com");
    00178                     break;
    00179                 case CelestialObject.Pluto:
    00180                     sb.AppendLine("Second larges known body in the Kuiper belt. ");
    00181                     sb.AppendLine("Mean Radius: 1.195E6 m (0.19 Earths)");
    00182                     sb.AppendLine("Mass: 1.305E22 kg (0.0021 Earths)");
    00183                     sb.AppendLine("Temperature: 33-55 K");
    00184                     sb.AppendLine("Orbit: highly inclined (17 deg) to the ecliptic");
    00185                     sb.AppendLine("Source: http://www.wikipedia.com");
    00186                     break;
    00187             }
    00188
    00189             return sb.ToString();
    00190         }
    00191
    00196         public string GetTextureInfo()
    00197         {
    00198             StringBuilder sb = new StringBuilder();
    00199
    00200             switch (this.celestialObject)
    00201             {
    00202                 case CelestialObject.Sun:
    00203                     sb.AppendLine("Artistic map based on images from SOHO.");
    00204                     sb.AppendLine("(c) Calvin J. Hamilton, 2001. (educational use)");
    00205                     sb.AppendLine("Source: http://solarviews.com");
    00206                     break;
    00207                 case CelestialObject.Mercury:
    00208                     sb.AppendLine("Map created from several sources including the Messenger spacecraft.");
    00209                     sb.AppendLine("Contains fictional or cloned data.");
    00210                     sb.AppendLine("Source: http://www.solarviews.com/eng/homepage.htm and http://home.arcor.de/jimpage");
    00211                     break;
    00212                 case CelestialObject.Venus:
    00213                     sb.AppendLine("Map created from 21 images taken by the Galileo spacecraft during its 1990 flyby.");
    00214                     sb.AppendLine("The coloring is artificially enhanced to show features of the cloud cover.");
    00215                     sb.AppendLine("Created by Bjorn Jonsson");
    00216                     sb.AppendLine("Source: http://www.mmedia.is/~bjj/planetary_maps.html");
    00217                     break;
    00218                 case CelestialObject.Earth:
    00219                     sb.AppendLine("Map created from one years worth of monthly composites of images taken by the MODIS spacecraft in 2004.");
    00220                     sb.AppendLine("The map set is also known as Blue Marble: Next Generation.");
    00221                     sb.AppendLine("Cloud cover was removed via extensive automatic image processing.");
    00222                     sb.AppendLine("Credits: NASA's Earth Observatory");
    00223                     sb.AppendLine("Source: http://earthobservatory.nasa.gov/Features/BlueMarble");
    00224                     break;
    00225                 case CelestialObject.Moon:
    00226                     sb.AppendLine("Map created from USGS/Hubble and ESA Info Centre images.");
    00227                     sb.AppendLine("Source: http://www.oera.net/How2/TextureMaps2.htm");
    00228                     break;
    00229                 case CelestialObject.Mars:
    00230                     sb.AppendLine("Map created from images taken by the Viking spacecraft and processes by the USGS.");
    00231                     sb.AppendLine("Details added by incorporating topology data from the Mars Global Surveyor.");
    00232                     sb.AppendLine("Manually corrected and color enhanced.");
    00233                     sb.AppendLine("Source: http://planetpixelemporium.com/mars.html");
    00234                     break;
    00235                 case CelestialObject.Jupiter:
    00236                     sb.AppendLine("Map created from 100 images taken by the Cassini spacecraft during its Dec 2000 flyby.");
    00237                     sb.AppendLine("Longitudinal position on left edge is arbitrary, as object has no fixed visible features.");
    00238                     sb.AppendLine("Created by Bjorn Jonsson.");
    00239                     sb.AppendLine("Source: http://www.mmedia.is/~bjj/planetary_maps.html");
    00240                     break;
    00241                 case CelestialObject.Io:
    00242                     sb.AppendLine("Map created from 1 high resolution greyscale image taken by the Voyager 1 spacecraft.");
    00243                     sb.AppendLine("Color information comes from 3 low resolution images taken by the Voyager 2 spacecraft");
    00244                     sb.AppendLine("Contains fictional or cloned data.");
    00245                     sb.AppendLine("Created by Bjorn Jonsson.");
    00246                     sb.AppendLine("Source: http://www.mmedia.is/~bjj/planetary_maps.html");
    00247                     break;
    00248                 case CelestialObject.Europa:
    00249                     sb.AppendLine("Map created from 14 images taken by the Galileo spacecraft.");
    00250                     sb.AppendLine("Color information comes from several images taken by the Voyager 1 and 2 spacecraft");
    00251                     sb.AppendLine("Created by Bjorn Jonsson.");
    00252                     sb.AppendLine("Source: http://www.mmedia.is/~bjj/planetary_maps.html");
    00253                     break;
    00254                 case CelestialObject.Ganymede:
    00255                     sb.AppendLine("Map created from over 100 images taken by the Voyager and Galileo spacecraft.");
    00256                     sb.AppendLine("Contains fictional or cloned data.");
    00257                     sb.AppendLine("Created by Bjorn Jonsson.");
    00258                     sb.AppendLine("Source: http://www.mmedia.is/~bjj/planetary_maps.html");
    00259                     break;
    00260                 case CelestialObject.Callisto:
    00261                     sb.AppendLine("Map created from several images taken by the Voyager and Galileo spacecraft.");
    00262                     sb.AppendLine("Contains fictional or cloned data.");
    00263                     sb.AppendLine("Created by Bjorn Jonsson.");
    00264                     sb.AppendLine("Source: http://www.mmedia.is/~bjj/planetary_maps.html");
    00265                     break;
    00266                 case CelestialObject.Saturn:
    00267                     sb.AppendLine("Map created from 56 images taken by the Cassini spacecraft in Sept 2004.");
    00268                     sb.AppendLine("Created by Bjorn Jonsson");
    00269                     sb.AppendLine("Source: http://www.mmedia.is/~bjj/planetary_maps.html");
    00270                     break;
    00271                 case CelestialObject.Neptune:
    00272                     sb.AppendLine("Map created from 27 images taken by the Voyager 2 spacecraft in Aug 1989.");
    00273                     sb.AppendLine("Contains fictional or cloned data.");
    00274                     sb.AppendLine("Created by Bjorn Jonsson");
    00275                     sb.AppendLine("Source: http://www.mmedia.is/~bjj/planetary_maps.html");
    00276                     break;
    00277                 case CelestialObject.Uranus:
    00278                     sb.AppendLine("Painted map based on various image sources including the Hubble space telescope.");
    00279                     sb.AppendLine("Source: http://planetpixelemporium.com/uranus.html");
    00280                     break;
    00281                 case CelestialObject.Pluto:
    00282                     sb.AppendLine("Fictional rendering of object.");
    00283                     break;
    00284             }
    00285
    00286             return sb.ToString();
    00287         }
    00288
    00293         public double GetAtmosphericDensity()
    00294         {
    00295             switch (this.celestialObject)
    00296             {
    00297
    00298                 case CelestialObject.Sun:
    00299                     // Average coronal density
    00300                     // Source: http://en.wikipedia.org/wiki/Sun
    00301                     return 1.0E-12;
    00302
    00303                 case CelestialObject.Mercury:
    00304                     // Essentially a vaccuum
    00305                     // Source: http://nssdc.gsfc.nasa.gov/planetary/factsheet/mercuryfact.html
    00306                     return 1.0E-18;
    00307
    00308                 case CelestialObject.Venus:
    00309                     // Density at source 6.5% that of water
    00310                     // Source: http://en.wikipedia.org/wiki/Venus#Atmosphere_and_climate
    00311                     return 65.0;
    00312
    00313                 case CelestialObject.Earth:
    00314                     return AirDensity.NominalAirDensity;
    00315
    00316                 case CelestialObject.Moon:
    00317                     // Essentially a vaccuum
    00318                     // Source: http://en.wikipedia.org/wiki/Moon#Atmosphere
    00319                     return 1.0E-18;
    00320
    00321                 case CelestialObject.Mars:
    00322                     // Nominal density
    00323                     // Source: http://nssdc.gsfc.nasa.gov/planetary/factsheet/marsfact.html
    00324                     return 0.02;
    00325
    00326                 case CelestialObject.Jupiter:
    00327                     // Density at 1 bar
    00328                     // Source: http://nssdc.gsfc.nasa.gov/planetary/factsheet/jupiterfact.html
    00329                     return 0.16;
    00330
    00331                 case CelestialObject.Io:
    00332                     // About 10 million times less than Earth
    00333                     // Source: http://vega.lpl.arizona.edu/iotorus/io.html
    00334                     return AirDensity.NominalAirDensity / 10000000;
    00335
    00336                 case CelestialObject.Europa:
    00337                     // Assume a vaccuum
    00338                     return 1.0E-18;
    00339
    00340                 case CelestialObject.Ganymede:
    00341                     // Assume a vaccuum
    00342                     return 1.0E-18;
    00343
    00344                 case CelestialObject.Callisto:
    00345                     // Assume a vaccuum
    00346                     return 1.0E-18;
    00347
    00348                 case CelestialObject.Saturn:
    00349                     // Density at 1 bar
    00350                     // Source: http://nssdc.gsfc.nasa.gov/planetary/factsheet/saturnfact.html
    00351                     return 0.19;
    00352
    00353                 case CelestialObject.Uranus:
    00354                     // Density at 1 bar
    00355                     // Source: http://nssdc.gsfc.nasa.gov/planetary/factsheet/uranusfact.html
    00356                     return 0.42;
    00357
    00358                 case CelestialObject.Neptune:
    00359                     // Density at 1 bar
    00360                     // Source: http://nssdc.gsfc.nasa.gov/planetary/factsheet/neptunefact.html
    00361                     return 0.45;
    00362
    00363                 case CelestialObject.Pluto:
    00364                     // Assume a vaccuum
    00365                     return 1.0E-18;
    00366
    00367                 default:
    00368                     // Default to vacuum
    00369                     return 1.0E-18;
    00370             }
    00371         }
    00372
    00383         public string GetTextureName(int variation)
    00384         {
    00385             string textureName = String.Empty;
    00386
    00387             // Filenames of the earth textures by month.
    00388             string[] earthTexturesByMonth = {
    00389                                         "earth_jan",
    00390                                         "earth_feb",
    00391                                         "earth_mar",
    00392                                         "earth_apr",
    00393                                         "earth_may",
    00394                                         "earth_jun",
    00395                                         "earth_jul",
    00396                                         "earth_aug",
    00397                                         "earth_sep",
    00398                                         "earth_oct",
    00399                                         "earth_nov",
    00400                                         "earth_dec"};
    00401
    00402             switch (this.celestialObject)
    00403             {
    00404                 case CelestialObject.Sun:
    00405                     textureName = "sun";
    00406                     break;
    00407                 case CelestialObject.Mercury:
    00408                     textureName = "mercury";
    00409                     break;
    00410                 case CelestialObject.Venus:
    00411                     if (variation == 1)
    00412                     {
    00413                         textureName = "venus_surface";
    00414                         break;
    00415                     }
    00416                     textureName = "venus_cloud";
    00417                     break;
    00418                 case CelestialObject.Earth:
    00419                     if (variation == 1)
    00420                     {
    00421                         textureName = "earth_map";
    00422                         break;
    00423                     }
    00424                     textureName = earthTexturesByMonth[DateTime.Now.Month - 1];
    00425                     break;
    00426                 case CelestialObject.Moon:
    00427                     textureName = "moon";
    00428                     break;
    00429                 case CelestialObject.Mars:
    00430                     textureName = "mars";
    00431                     break;
    00432                 case CelestialObject.Jupiter:
    00433                     textureName = "jupiter";
    00434                     break;
    00435                 case CelestialObject.Io:
    00436                     textureName = "io";
    00437                     break;
    00438                 case CelestialObject.Europa:
    00439                     textureName = "europa";
    00440                     break;
    00441                 case CelestialObject.Ganymede:
    00442                     textureName = "ganymede";
    00443                     break;
    00444                 case CelestialObject.Callisto:
    00445                     textureName = "callisto";
    00446                     break;
    00447                 case CelestialObject.Saturn:
    00448                     textureName = "saturn";
    00449                     break;
    00450                 case CelestialObject.Neptune:
    00451                     textureName = "neptune";
    00452                     break;
    00453                 case CelestialObject.Uranus:
    00454                     textureName = "uranus";
    00455                     break;
    00456                 default:
    00457                     textureName = "planet";
    00458                     break;
    00459             }
    00460
    00461             return "Textures/" + textureName;
    00462         }
    00463     }
    00464 }