Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

Body Class Reference

#include <body.h>

Collaboration diagram for Body:

Collaboration graph
List of all members.

Public Types

enum  {
  Planet = 0x01, Moon = 0x02, Asteroid = 0x04, Comet = 0x08,
  Spacecraft = 0x10, Invisible = 0x20, Unknown = 0x10000
}

Public Member Functions

void addAlternateSurface (const std::string &, Surface *)
void addLocation (Location *)
 Body (PlanetarySystem *)
Vec3f cartesianToPlanetocentric (const Vec3f &v) const
void computeLocations ()
bool extant (double) const
LocationfindLocation (const std::string &, bool i18n=false) const
float getAlbedo () const
SurfacegetAlternateSurface (const std::string &) const
std::vector< std::string > * getAlternateSurfaceNames () const
float getApparentMagnitude (float sunLuminosity, const Vec3d &sunPosition, const Vec3d &viewerPosition) const
float getApparentMagnitude (const Star &sun, const Vec3d &sunPosition, const Vec3d &viewerPosition) const
float getApparentMagnitude (const Star &sun, float distanceFromSun, float distanceFromViewer) const
AtmospheregetAtmosphere ()
const AtmospheregetAtmosphere () const
float getBoundingRadius () const
int getClassification () const
Quatd getEclipticalToEquatorial (double) const
Quatd getEclipticalToGeographic (double) const
Quatd getEquatorialToGeographic (double) const
Mat4d getGeographicToHeliocentric (double) const
Point3d getHeliocentricPosition (double) const
std::string getInfoURL () const
void getLifespan (double &, double &) const
Mat4d getLocalToHeliocentric (double) const
std::vector< Location * > * getLocations () const
float getLuminosity (float sunLuminosity, float distanceFromSun) const
float getLuminosity (const Star &sun, float distanceFromSun) const
float getMass () const
ResourceHandle getModel () const
std::string getName (bool i18n=false) const
float getOblateness () const
OrbitgetOrbit () const
astro::ReferencePlane getOrbitReferencePlane () const
Quatf getOrientation () const
float getRadius () const
RingSystemgetRings () const
RotationElements getRotationElements () const
PlanetarySystemgetSatellites () const
SurfacegetSurface ()
const SurfacegetSurface () const
PlanetarySystemgetSystem () const
Vec3f planetocentricToCartesian (const Vec3f &lonLatAlt) const
Vec3f planetocentricToCartesian (float lon, float lat, float alt) const
void setAlbedo (float)
void setAtmosphere (const Atmosphere &)
void setClassification (int)
void setInfoURL (const std::string &)
void setLifespan (double, double)
void setMass (float)
void setModel (ResourceHandle)
void setName (const std::string)
void setOblateness (float)
void setOrbit (Orbit *)
void setOrbitReferencePlane (astro::ReferencePlane)
void setOrientation (const Quatf &)
void setRadius (float)
void setRings (const RingSystem &)
void setRotationElements (const RotationElements &)
void setSatellites (PlanetarySystem *)
void setSurface (const Surface &)
 ~Body ()

Private Types

typedef std::map< std::string,
Surface * > 
AltSurfaceTable

Private Attributes

float albedo
AltSurfaceTablealtSurfaces
Atmosphereatmosphere
int classification
double eschatos
std::string i18nName
std::string infoURL
std::vector< Location * > * locations
bool locationsComputed
float mass
ResourceHandle model
std::string name
float oblateness
Orbitorbit
astro::ReferencePlane orbitRefPlane
Quatf orientation
double protos
float radius
RingSystemrings
RotationElements rotationElements
PlanetarySystemsatellites
Surface surface
PlanetarySystemsystem

Member Typedef Documentation

typedef std::map<std::string, Surface*> Body::AltSurfaceTable [private]
 

Definition at line 206 of file body.h.


Member Enumeration Documentation

anonymous enum
 

Enumeration values:
Planet 
Moon 
Asteroid 
Comet 
Spacecraft 
Invisible 
Unknown 

Definition at line 86 of file body.h.

00087     {
00088         Planet     = 0x01,
00089         Moon       = 0x02,
00090         Asteroid   = 0x04,
00091         Comet      = 0x08,
00092         Spacecraft = 0x10,
00093         Invisible  = 0x20,
00094         Unknown    = 0x10000,
00095     };


Constructor & Destructor Documentation

Body::Body PlanetarySystem  ) 
 

Definition at line 24 of file body.cpp.

References InvalidResource, and system.

00024                                    :
00025     orbit(NULL),
00026     orbitRefPlane(astro::BodyEquator),
00027     radius(10000.0f),
00028     mass(0.0f),
00029     oblateness(0),
00030     albedo(0.5),
00031     orientation(1.0f),
00032     // Ugh.  Numeric_limits class is missing from g++
00033     // protos(-numeric_limits<double>::infinity()),
00034     // eschatos(numeric_limits<double>::infinity()),
00035     // Do it the ugly way instead:
00036     protos(-1.0e+50),
00037     eschatos(1.0e+50),
00038     model(InvalidResource),
00039     surface(Color(1.0f, 1.0f, 1.0f)),
00040     atmosphere(NULL),
00041     rings(NULL),
00042     satellites(NULL),
00043     classification(Unknown),
00044     altSurfaces(NULL),
00045     locations(NULL),
00046     locationsComputed(false)
00047 {
00048     system = _system;
00049 }

Body::~Body  ) 
 

Definition at line 52 of file body.cpp.

References PlanetarySystem::removeBody(), and system.

00053 {
00054     // clean up orbit, atmosphere, etc.
00055     if (system != NULL)
00056         system->removeBody(this);
00057 }


Member Function Documentation

void Body::addAlternateSurface const std::string ,
Surface
 

Definition at line 507 of file body.cpp.

References altSurfaces, name, and surface.

Referenced by LoadSolarSystemObjects().

00508 {
00509     if (altSurfaces == NULL)
00510         altSurfaces = new AltSurfaceTable();
00511 
00512     //altSurfaces->insert(AltSurfaceTable::value_type(name, surface));
00513     (*altSurfaces)[name] = surface;
00514 }

void Body::addLocation Location  ) 
 

Definition at line 533 of file body.cpp.

References locations.

Referenced by LoadSolarSystemObjects().

00534 {
00535     assert(loc != NULL);
00536     if (loc == NULL)
00537         return;
00538 
00539     if (locations == NULL)
00540         locations = new vector<Location*>();
00541     locations->insert(locations->end(), loc);
00542     loc->setParentBody(this);
00543 }

Vec3f Body::cartesianToPlanetocentric const Vec3f v  )  const
 

Definition at line 375 of file body.cpp.

References getRadius(), Vector3< T >::normalize(), PI, Vector3< T >::x, Vector3< T >::y, and Vector3< T >::z.

Referenced by displayLocationInfo().

00376 {
00377     Vec3f w = v;
00378     w.normalize();
00379 
00380     double lat = (float) PI / 2.0f - acos(w.y);
00381     double lon = atan2(w.z, -w.x);
00382 
00383     return Vec3f((float) lon, (float) lat, v.length() - getRadius());
00384 }

void Body::computeLocations  ) 
 

Definition at line 573 of file body.cpp.

References ResourceManager< T >::find(), GetModelManager(), InvalidResource, Vector3< T >::length(), locations, locationsComputed, model, Vector3< T >::normalize(), Model::pick(), radius, Vector3< T >::x, Vector3< T >::y, and Vector3< T >::z.

00574 {
00575     if (locationsComputed)
00576         return;
00577 
00578     locationsComputed = true;
00579 
00580     // No work to do if there's no mesh, or if the mesh cannot be loaded
00581     if (model == InvalidResource)
00582         return;
00583     Model* m = GetModelManager()->find(model);
00584     if (m == NULL)
00585         return;
00586 
00587     // TODO: Implement separate radius and bounding radius so that this hack is
00588     // not necessary.
00589     double boundingRadius = 2.0;
00590 
00591     for (vector<Location*>::const_iterator iter = locations->begin();
00592          iter != locations->end(); iter++)
00593     {
00594         Vec3f v = (*iter)->getPosition();
00595         float alt = v.length() - radius;
00596         if (alt != -radius)
00597             v.normalize();
00598         v *= (float) boundingRadius;
00599 
00600         Ray3d ray(Point3d(v.x, v.y, v.z), Vec3d(-v.x, -v.y, -v.z));
00601         double t = 0.0;
00602         if (m->pick(ray, t))
00603         {
00604             v *= (float) ((1.0 - t) * radius + alt);
00605             (*iter)->setPosition(v);
00606         }
00607     }
00608 }

bool Body::extant double   )  const
 

Definition at line 387 of file body.cpp.

References eschatos, and protos.

Referenced by Renderer::renderPlanetarySystem().

00388 {
00389     return t >= protos && t < eschatos;
00390 }

Location * Body::findLocation const std::string ,
bool  i18n = false
const
 

Definition at line 552 of file body.cpp.

References locations, name, and UTF8StringCompare().

Referenced by Universe::findChildObject(), and Universe::findObjectInContext().

00553 {
00554     if (locations == NULL)
00555         return NULL;
00556 
00557     for (vector<Location*>::const_iterator iter = locations->begin();
00558          iter != locations->end(); iter++)
00559     {
00560         if (!UTF8StringCompare(name, (*iter)->getName(i18n)))
00561             return *iter;
00562     }
00563 
00564     return NULL;
00565 }

float Body::getAlbedo  )  const
 

Definition at line 154 of file body.cpp.

References albedo.

Referenced by object_getinfo().

00155 {
00156     return albedo;
00157 }

Surface * Body::getAlternateSurface const std::string  )  const
 

Definition at line 494 of file body.cpp.

References altSurfaces, and name.

00495 {
00496     if (altSurfaces == NULL)
00497         return NULL;
00498 
00499     AltSurfaceTable::iterator iter = altSurfaces->find(name);
00500     if (iter == altSurfaces->end())
00501         return NULL;
00502     else
00503         return iter->second;
00504 }

vector< string > * Body::getAlternateSurfaceNames  )  const
 

Definition at line 517 of file body.cpp.

References altSurfaces.

Referenced by handleContextSurface(), SelectionPopup::insert(), MainWindowProc(), menuContext(), and SelectionPopup::process().

00518 {
00519     vector<string>* names = new vector<string>();
00520     if (altSurfaces != NULL)
00521     {
00522         for (AltSurfaceTable::const_iterator iter = altSurfaces->begin();
00523              iter != altSurfaces->end(); iter++)
00524         {
00525             names->insert(names->end(), iter->first);
00526         }
00527     }
00528 
00529     return names;
00530 }

float Body::getApparentMagnitude float  sunLuminosity,
const Vec3d sunPosition,
const Vec3d viewerPosition
const
 

Definition at line 459 of file body.cpp.

References getLuminosity(), Vector3< T >::length(), and astro::lumToAppMag().

00462 {
00463     double distanceToViewer = viewerPosition.length();
00464     double distanceToSun = sunPosition.length();
00465     float illuminatedFraction = (float) (1.0 + (viewerPosition / distanceToViewer) *
00466                                          (sunPosition / distanceToSun)) / 2.0f;
00467 
00468     return astro::lumToAppMag(getLuminosity(sunLuminosity, (float) distanceToSun) * illuminatedFraction, (float) astro::kilometersToLightYears(distanceToViewer));
00469 }

float Body::getApparentMagnitude const Star sun,
const Vec3d sunPosition,
const Vec3d viewerPosition
const
 

Definition at line 449 of file body.cpp.

References getApparentMagnitude().

00452 {
00453     return getApparentMagnitude(sun.getLuminosity(),
00454                                 sunPosition,
00455                                 viewerPosition);
00456 }

float Body::getApparentMagnitude const Star sun,
float  distanceFromSun,
float  distanceFromViewer
const
 

Definition at line 439 of file body.cpp.

References getLuminosity(), and astro::lumToAppMag().

Referenced by getApparentMagnitude(), and Renderer::renderPlanetarySystem().

00442 {
00443     return astro::lumToAppMag(getLuminosity(sun, distanceFromSun),
00444                               astro::kilometersToLightYears(distanceFromViewer));
00445 }

Atmosphere * Body::getAtmosphere  ) 
 

Definition at line 249 of file body.cpp.

References atmosphere.

00250 {
00251     return atmosphere;
00252 }

const Atmosphere * Body::getAtmosphere  )  const
 

Definition at line 244 of file body.cpp.

References atmosphere.

Referenced by CreatePlanet(), and object_getinfo().

00245 {
00246     return atmosphere;
00247 }

float Body::getBoundingRadius  )  const
 

Definition at line 121 of file body.cpp.

References InvalidResource, model, and radius.

00122 {
00123     if (model == InvalidResource)
00124         return radius;
00125     else
00126         return radius * 1.7320508f; // sqrt(3)
00127 }

int Body::getClassification  )  const
 

Definition at line 472 of file body.cpp.

References classification.

Referenced by addPlanetarySystemToTree(), EclipseFinder::CalculateEclipses(), CreatePlanet(), CreatePlanetarySystemMenu(), object_getinfo(), object_type(), Renderer::renderForegroundOrbits(), Renderer::renderOrbits(), Renderer::renderPlanetarySystem(), and CelestialBrowser::slotRefresh().

00473 {
00474     return classification;
00475 }

Quatd Body::getEclipticalToEquatorial double   )  const
 

Definition at line 303 of file body.cpp.

References RotationElements::ascendingNode, PlanetarySystem::getPrimaryBody(), RotationElements::obliquity, RotationElements::precessionRate, rotationElements, system, Quaternion< double >::xrotation(), and Quaternion< double >::yrotation().

Referenced by displayLocationInfo(), FrameOfReference::fromUniversal(), getEclipticalToGeographic(), and FrameOfReference::toUniversal().

00304 {
00305     double ascendingNode = (double) rotationElements.ascendingNode +
00306         rotationElements.precessionRate * (when - astro::J2000);
00307 
00308     Quatd q =
00309         Quatd::xrotation(-rotationElements.obliquity) *
00310         Quatd::yrotation(-ascendingNode);
00311 
00312     // Recurse up the hierarchy . . .
00313     if (system != NULL && system->getPrimaryBody() != NULL)
00314         q = q * system->getPrimaryBody()->getEclipticalToEquatorial(when);
00315 
00316     return q;
00317 }

Quatd Body::getEclipticalToGeographic double   )  const
 

Definition at line 320 of file body.cpp.

References getEclipticalToEquatorial(), and getEquatorialToGeographic().

Referenced by FrameOfReference::fromUniversal(), Location::getPlanetocentricPosition(), and FrameOfReference::toUniversal().

00321 {
00322     return getEquatorialToGeographic(when) * getEclipticalToEquatorial(when);
00323 }

Quatd Body::getEquatorialToGeographic double   )  const
 

Definition at line 331 of file body.cpp.

References RotationElements::epoch, RotationElements::offset, RotationElements::period, PI, rotationElements, and Quaternion< T >::yrotate().

Referenced by getEclipticalToGeographic(), getGeographicToHeliocentric(), and SynchronousOrbit::positionAtTime().

00332 {
00333     double t = when - rotationElements.epoch;
00334     double rotations = t / (double) rotationElements.period;
00335     double wholeRotations = floor(rotations);
00336     double remainder = rotations - wholeRotations;
00337 
00338     // Add an extra half rotation because of the convention in all
00339     // planet texture maps where zero deg long. is in the middle of
00340     // the texture.
00341     remainder += 0.5;
00342     
00343     Quatd q(1);
00344     q.yrotate(-remainder * 2 * PI - rotationElements.offset);
00345     return q;
00346 }

Mat4d Body::getGeographicToHeliocentric double   )  const
 

Definition at line 349 of file body.cpp.

References getEquatorialToGeographic(), getLocalToHeliocentric(), and Quaternion< T >::toMatrix4().

00350 {
00351     return getEquatorialToGeographic(when).toMatrix4() *
00352         getLocalToHeliocentric(when);
00353 }

Point3d Body::getHeliocentricPosition double   )  const
 

Definition at line 297 of file body.cpp.

References getLocalToHeliocentric().

Referenced by Location::getHeliocentricPosition(), Selection::getPosition(), Renderer::renderOrbits(), Renderer::renderPlanetarySystem(), and CelestialBrowser::slotRefresh().

00298 {
00299     return Point3d(0.0, 0.0, 0.0) * getLocalToHeliocentric(when);
00300 }

string Body::getInfoURL  )  const
 

Definition at line 483 of file body.cpp.

References infoURL.

Referenced by object_getinfo(), and SelectionPopup::process().

00484 {
00485     return infoURL;
00486 }

void Body::getLifespan double &  ,
double & 
const
 

Definition at line 400 of file body.cpp.

References eschatos, and protos.

Referenced by CreatePlanet(), and object_getinfo().

00401 {
00402     begin = protos;
00403     end = eschatos;
00404 }

Mat4d Body::getLocalToHeliocentric double   )  const
 

Definition at line 263 of file body.cpp.

References RotationElements::ascendingNode, PlanetarySystem::getPrimaryBody(), RotationElements::obliquity, orbit, orbitRefPlane, Orbit::positionAtTime(), RotationElements::precessionRate, rotationElements, system, Matrix4< T >::translation(), Matrix4< T >::xrotation(), and Matrix4< T >::yrotation().

Referenced by getGeographicToHeliocentric(), and getHeliocentricPosition().

00264 {
00265     double ascendingNode = (double) rotationElements.ascendingNode +
00266         rotationElements.precessionRate * (when - astro::J2000);
00267 
00268     Point3d pos = orbit->positionAtTime(when);
00269     Mat4d frame;
00270 
00271     switch (orbitRefPlane)
00272     {
00273     case astro::BodyEquator:
00274         frame = (Mat4d::xrotation(-rotationElements.obliquity) *
00275                  Mat4d::yrotation(-ascendingNode) *
00276                  Mat4d::translation(pos));
00277         break;
00278     case astro::Ecliptic_J2000:
00279         frame = Mat4d::translation(pos);
00280         break;
00281     case astro::Equator_J2000:
00282         frame = Mat4d::translation(pos);
00283         break;
00284     default:
00285         assert(0);
00286     }
00287  
00288     // Recurse up the hierarchy . . .
00289     if (system != NULL && system->getPrimaryBody() != NULL)
00290         frame = frame * system->getPrimaryBody()->getLocalToHeliocentric(when);
00291 
00292     return frame;
00293 }

vector< Location * > * Body::getLocations  )  const
 

Definition at line 546 of file body.cpp.

References locations.

Referenced by Universe::getCompletion(), and Universe::getCompletionPath().

00547 {
00548     return locations;
00549 }

float Body::getLuminosity float  sunLuminosity,
float  distanceFromSun
const
 

Definition at line 417 of file body.cpp.

References albedo, circleArea(), radius, SOLAR_POWER, and sphereArea().

00419 {
00420     // Compute the total power of the star in Watts
00421     double power = SOLAR_POWER * sunLuminosity;
00422 
00423     // Compute the irradiance at a distance of 1au from the star in W/m^2
00424     // double irradiance = power / sphereArea(astro::AUtoKilometers(1.0) * 1000);
00425 
00426     // Compute the irradiance at the body's distance from the star
00427     double satIrradiance = power / sphereArea(distanceFromSun * 1000);
00428 
00429     // Compute the total energy hitting the planet
00430     double incidentEnergy = satIrradiance * circleArea(radius * 1000);
00431 
00432     double reflectedEnergy = incidentEnergy * albedo;
00433     
00434     // Compute the luminosity (i.e. power relative to solar power)
00435     return (float) (reflectedEnergy / SOLAR_POWER);
00436 }

float Body::getLuminosity const Star sun,
float  distanceFromSun
const
 

Definition at line 410 of file body.cpp.

Referenced by getApparentMagnitude().

00412 {
00413     return getLuminosity(sun.getLuminosity(), distanceFromSun);
00414 }

float Body::getMass  )  const
 

Definition at line 130 of file body.cpp.

References mass.

Referenced by object_getinfo().

00131 {
00132     return mass;
00133 }

ResourceHandle Body::getModel  )  const
 

Definition at line 208 of file body.cpp.

References model.

00209 {
00210     return model;
00211 }

string Body::getName bool  i18n = false  )  const
 

Definition at line 66 of file body.cpp.

References i18nName, and name.

Referenced by AddBookmarkProc(), AddPlanetarySystemToTree(), addPlanetarySystemToTree(), EclipseFinder::CalculateEclipses(), CreatePlanet(), CreatePlanetarySystemMenu(), displayLocationInfo(), displaySelectionName(), Selection::getName(), Url::getSelectionName(), SelectionPopup::getSelectionName(), GotoObjectProc(), SelectionPopup::init(), SelectionPopup::insert(), KdePreferencesDialog::KdePreferencesDialog(), KdePreferencesDialog::ltSubstract(), menuContext(), object_getinfo(), object_name(), SelectionPopup::process(), CelestiaCore::renderOverlay(), Renderer::renderPlanetarySystem(), CelestialBrowser::slotRefresh(), and solarSysEndElement().

00067 {
00068     if (!i18n || i18nName == "") return name;
00069     return i18nName;
00070 }

float Body::getOblateness  )  const
 

Definition at line 142 of file body.cpp.

References oblateness.

Referenced by object_getinfo().

00143 {
00144     return oblateness;
00145 }

Orbit * Body::getOrbit  )  const
 

Definition at line 81 of file body.cpp.

References orbit.

Referenced by CreatePlanet(), FrameOfReference::fromUniversal(), object_getinfo(), Renderer::renderOrbits(), Renderer::renderPlanetarySystem(), solarSysEndElement(), and FrameOfReference::toUniversal().

00082 {
00083     return orbit;
00084 }

astro::ReferencePlane Body::getOrbitReferencePlane  )  const
 

Definition at line 94 of file body.cpp.

References orbitRefPlane.

00095 {
00096     return orbitRefPlane;
00097 }

Quatf Body::getOrientation  )  const
 

Definition at line 166 of file body.cpp.

References orientation.

Referenced by CelestiaCore::mouseMove().

00167 {
00168     return orientation;
00169 }

float Body::getRadius  )  const
 

Definition at line 106 of file body.cpp.

References radius.

Referenced by cartesianToPlanetocentric(), CreatePlanet(), GotoObjectProc(), object_getinfo(), planetocentricToCartesian(), Selection::radius(), and Renderer::renderPlanetarySystem().

00107 {
00108     return radius;
00109 }

RingSystem * Body::getRings  )  const
 

Definition at line 230 of file body.cpp.

References rings.

Referenced by CreatePlanet(), and object_getinfo().

00231 {
00232     return rings;
00233 }

RotationElements Body::getRotationElements  )  const
 

Definition at line 178 of file body.cpp.

References rotationElements.

Referenced by CreatePlanet(), SynchronousOrbit::getPeriod(), object_getinfo(), Renderer::renderOrbits(), and transformOrbits().

00179 {
00180     return rotationElements;
00181 }

PlanetarySystem * Body::getSatellites  )  const
 

Definition at line 219 of file body.cpp.

References satellites.

Referenced by AddPlanetarySystemToTree(), addPlanetarySystemToTree(), EclipseFinder::CalculateEclipses(), createBody(), PlanetarySystem::find(), PlanetarySystem::getCompletion(), Universe::getCompletionPath(), SelectionPopup::getSelectionFromId(), handleContextPlanet(), SelectionPopup::insert(), LoadSolarSystemObjects(), MainWindowProc(), menuContext(), object_getchildren(), Renderer::renderOrbits(), Renderer::renderPlanet(), Renderer::renderPlanetarySystem(), CelestialBrowser::slotRefresh(), and PlanetarySystem::traverse().

00220 {
00221     return satellites;
00222 }

Surface & Body::getSurface  ) 
 

Definition at line 196 of file body.cpp.

References surface.

00197 {
00198     return surface;
00199 }

const Surface & Body::getSurface  )  const
 

Definition at line 190 of file body.cpp.

References surface.

Referenced by CreatePlanet().

00191 {
00192     return surface;
00193 }

PlanetarySystem * Body::getSystem  )  const
 

Definition at line 60 of file body.cpp.

References system.

Referenced by EclipseFinderProc(), eclipseGoto(), Selection::getName(), Selection::getPosition(), Url::getSelectionName(), Universe::getSolarSystem(), EclipseFinderDlg::gotoEclipse(), object_getinfo(), PlanetarySystem::PlanetarySystem(), Simulation::selectPlanet(), transformOrbits(), and Observer::update().

00061 {
00062     return system;
00063 }

Vec3f Body::planetocentricToCartesian const Vec3f lonLatAlt  )  const
 

Definition at line 369 of file body.cpp.

References planetocentricToCartesian().

00370 {
00371     return planetocentricToCartesian(lonLatAlt.x, lonLatAlt.y, lonLatAlt.z);
00372 }

Vec3f Body::planetocentricToCartesian float  lon,
float  lat,
float  alt
const
 

Definition at line 356 of file body.cpp.

References cos(), degToRad(), getRadius(), PI, and sin().

Referenced by CreateOrbit(), and planetocentricToCartesian().

00357 {
00358     float phi = -degToRad(lat) + (float) PI / 2;
00359     float theta = degToRad(lon) - (float) PI;
00360 
00361     Vec3f pos((float) (cos(theta) * sin(phi)),
00362               (float) (cos(phi)),
00363               (float) (-sin(theta) * sin(phi)));
00364 
00365     return pos * (getRadius() + alt);
00366 }

void Body::setAlbedo float   ) 
 

Definition at line 160 of file body.cpp.

References albedo.

Referenced by CreatePlanet().

00161 {
00162     albedo = _albedo;
00163 }

void Body::setAtmosphere const Atmosphere  ) 
 

Definition at line 254 of file body.cpp.

References atmosphere.

Referenced by CreatePlanet().

00255 {
00256     if (atmosphere == NULL)
00257         atmosphere = new Atmosphere();
00258     *atmosphere = _atmosphere;
00259 }

void Body::setClassification int   ) 
 

Definition at line 477 of file body.cpp.

References classification.

Referenced by CreatePlanet().

00478 {
00479     classification = _classification;
00480 }

void Body::setInfoURL const std::string  ) 
 

Definition at line 488 of file body.cpp.

References infoURL.

Referenced by CreatePlanet().

00489 {
00490     infoURL = _infoURL;
00491 }

void Body::setLifespan double  ,
double 
 

Definition at line 393 of file body.cpp.

References eschatos, and protos.

Referenced by CreatePlanet().

00394 {
00395     protos = begin;
00396     eschatos = end;
00397 }

void Body::setMass float   ) 
 

Definition at line 136 of file body.cpp.

References mass.

Referenced by CreatePlanet().

00137 {
00138     mass = _mass;
00139 }

void Body::setModel ResourceHandle   ) 
 

Definition at line 213 of file body.cpp.

References model.

Referenced by CreatePlanet().

00214 {
00215     model = _model;
00216 }

void Body::setName const std::string   ) 
 

Definition at line 73 of file body.cpp.

References _, i18nName, and name.

Referenced by createBody(), and LoadSolarSystemObjects().

00074 {
00075     name = _name;
00076     i18nName = _(_name.c_str());
00077     if (name == i18nName) i18nName = "";
00078 }

void Body::setOblateness float   ) 
 

Definition at line 148 of file body.cpp.

References oblateness.

Referenced by CreatePlanet().

00149 {
00150     oblateness = _oblateness;
00151 }

void Body::setOrbit Orbit  ) 
 

Definition at line 87 of file body.cpp.

References orbit.

Referenced by CreatePlanet().

00088 {
00089     delete orbit;
00090     orbit = _orbit;
00091 }

void Body::setOrbitReferencePlane astro::ReferencePlane   ) 
 

Definition at line 100 of file body.cpp.

References orbitRefPlane.

00101 {
00102     orbitRefPlane = refPlane;
00103 }

void Body::setOrientation const Quatf  ) 
 

Definition at line 172 of file body.cpp.

References orientation.

Referenced by CreatePlanet(), and CelestiaCore::mouseMove().

00173 {
00174     orientation = q;
00175 }

void Body::setRadius float   ) 
 

Definition at line 112 of file body.cpp.

References radius.

Referenced by CreatePlanet().

00113 {
00114     radius = _radius;
00115 }

void Body::setRings const RingSystem  ) 
 

Definition at line 235 of file body.cpp.

References rings.

Referenced by CreatePlanet().

00236 {
00237     if (rings == NULL)
00238         rings = new RingSystem(_rings);
00239     else
00240         *rings = _rings;
00241 }

void Body::setRotationElements const RotationElements  ) 
 

Definition at line 184 of file body.cpp.

References rotationElements.

Referenced by CreatePlanet().

00185 {
00186     rotationElements = re;
00187 }

void Body::setSatellites PlanetarySystem  ) 
 

Definition at line 224 of file body.cpp.

References satellites.

Referenced by createBody(), and LoadSolarSystemObjects().

00225 {
00226     satellites = ssys;
00227 }

void Body::setSurface const Surface  ) 
 

Definition at line 202 of file body.cpp.

References surface.

Referenced by CreatePlanet().

00203 {
00204     surface = surf;
00205 }


Member Data Documentation

float Body::albedo [private]
 

Definition at line 188 of file body.h.

Referenced by getAlbedo(), getLuminosity(), and setAlbedo().

AltSurfaceTable* Body::altSurfaces [private]
 

Definition at line 207 of file body.h.

Referenced by addAlternateSurface(), getAlternateSurface(), and getAlternateSurfaceNames().

Atmosphere* Body::atmosphere [private]
 

Definition at line 197 of file body.h.

Referenced by getAtmosphere(), and setAtmosphere().

int Body::classification [private]
 

Definition at line 202 of file body.h.

Referenced by getClassification(), and setClassification().

double Body::eschatos [private]
 

Definition at line 192 of file body.h.

Referenced by extant(), getLifespan(), and setLifespan().

std::string Body::i18nName [private]
 

Definition at line 178 of file body.h.

Referenced by getName(), and setName().

std::string Body::infoURL [private]
 

Definition at line 204 of file body.h.

Referenced by getInfoURL(), and setInfoURL().

std::vector<Location*>* Body::locations [private]
 

Definition at line 209 of file body.h.

Referenced by addLocation(), computeLocations(), findLocation(), and getLocations().

bool Body::locationsComputed [mutable, private]
 

Definition at line 210 of file body.h.

Referenced by computeLocations().

float Body::mass [private]
 

Definition at line 186 of file body.h.

Referenced by getMass(), and setMass().

ResourceHandle Body::model [private]
 

Definition at line 194 of file body.h.

Referenced by computeLocations(), getBoundingRadius(), getModel(), and setModel().

std::string Body::name [private]
 

Definition at line 177 of file body.h.

Referenced by addAlternateSurface(), findLocation(), getAlternateSurface(), getName(), and setName().

float Body::oblateness [private]
 

Definition at line 187 of file body.h.

Referenced by getOblateness(), and setOblateness().

Orbit* Body::orbit [private]
 

Definition at line 181 of file body.h.

Referenced by getLocalToHeliocentric(), getOrbit(), and setOrbit().

astro::ReferencePlane Body::orbitRefPlane [private]
 

Definition at line 182 of file body.h.

Referenced by getLocalToHeliocentric(), getOrbitReferencePlane(), and setOrbitReferencePlane().

Quatf Body::orientation [private]
 

Definition at line 189 of file body.h.

Referenced by getOrientation(), and setOrientation().

double Body::protos [private]
 

Definition at line 191 of file body.h.

Referenced by extant(), getLifespan(), and setLifespan().

float Body::radius [private]
 

Definition at line 185 of file body.h.

Referenced by computeLocations(), getBoundingRadius(), getLuminosity(), getRadius(), and setRadius().

RingSystem* Body::rings [private]
 

Definition at line 198 of file body.h.

Referenced by getRings(), and setRings().

RotationElements Body::rotationElements [private]
 

Definition at line 183 of file body.h.

Referenced by getEclipticalToEquatorial(), getEquatorialToGeographic(), getLocalToHeliocentric(), getRotationElements(), and setRotationElements().

PlanetarySystem* Body::satellites [private]
 

Definition at line 200 of file body.h.

Referenced by getSatellites(), and setSatellites().

Surface Body::surface [private]
 

Definition at line 195 of file body.h.

Referenced by addAlternateSurface(), getSurface(), and setSurface().

PlanetarySystem* Body::system [private]
 

Definition at line 180 of file body.h.

Referenced by Body(), getEclipticalToEquatorial(), getLocalToHeliocentric(), getSystem(), and ~Body().


The documentation for this class was generated from the following files:
Generated on Sat Jan 14 22:33:07 2006 for Celestia by  doxygen 1.4.1