#include <body.h>
Collaboration diagram for Body:

|
|
|
|
|
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 };
|
|
|
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 }
|
|
|
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 }
|
|
||||||||||||
|
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 }
|
|
|
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 }
|
|
|
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 }
|
|
|
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 }
|
|
|
Definition at line 387 of file body.cpp. References eschatos, and protos. Referenced by Renderer::renderPlanetarySystem().
|
|
||||||||||||
|
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 }
|
|
|
Definition at line 154 of file body.cpp. References albedo. Referenced by object_getinfo(). 00155 {
00156 return albedo;
00157 }
|
|
|
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 }
|
|
|
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 }
|
|
||||||||||||||||
|
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 }
|
|
||||||||||||||||
|
Definition at line 449 of file body.cpp. References getApparentMagnitude(). 00452 {
00453 return getApparentMagnitude(sun.getLuminosity(),
00454 sunPosition,
00455 viewerPosition);
00456 }
|
|
||||||||||||||||
|
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 }
|
|
|
Definition at line 249 of file body.cpp. References atmosphere. 00250 {
00251 return atmosphere;
00252 }
|
|
|
Definition at line 244 of file body.cpp. References atmosphere. Referenced by CreatePlanet(), and object_getinfo(). 00245 {
00246 return atmosphere;
00247 }
|
|
|
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 }
|
|
|
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 }
|
|
|
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 }
|
|
|
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 }
|
|
|
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 }
|
|
|
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 }
|
|
|
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 }
|
|
|
Definition at line 483 of file body.cpp. References infoURL. Referenced by object_getinfo(), and SelectionPopup::process(). 00484 {
00485 return infoURL;
00486 }
|
|
||||||||||||
|
Definition at line 400 of file body.cpp. References eschatos, and protos. Referenced by CreatePlanet(), and object_getinfo().
|
|
|
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 }
|
|
|
Definition at line 546 of file body.cpp. References locations. Referenced by Universe::getCompletion(), and Universe::getCompletionPath(). 00547 {
00548 return locations;
00549 }
|
|
||||||||||||
|
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 }
|
|
||||||||||||
|
Definition at line 410 of file body.cpp. Referenced by getApparentMagnitude(). 00412 {
00413 return getLuminosity(sun.getLuminosity(), distanceFromSun);
00414 }
|
|
|
Definition at line 130 of file body.cpp. References mass. Referenced by object_getinfo(). 00131 {
00132 return mass;
00133 }
|
|
|
Definition at line 208 of file body.cpp. References model. 00209 {
00210 return model;
00211 }
|
|
|
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 }
|
|
|
Definition at line 142 of file body.cpp. References oblateness. Referenced by object_getinfo(). 00143 {
00144 return oblateness;
00145 }
|
|
|
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 }
|
|
|
Definition at line 94 of file body.cpp. References orbitRefPlane. 00095 {
00096 return orbitRefPlane;
00097 }
|
|
|
Definition at line 166 of file body.cpp. References orientation. Referenced by CelestiaCore::mouseMove(). 00167 {
00168 return orientation;
00169 }
|
|
|
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 }
|
|
|
Definition at line 230 of file body.cpp. References rings. Referenced by CreatePlanet(), and object_getinfo(). 00231 {
00232 return rings;
00233 }
|
|
|
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 }
|
|
|
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 }
|
|
|
Definition at line 196 of file body.cpp. References surface. 00197 {
00198 return surface;
00199 }
|
|
|
Definition at line 190 of file body.cpp. References surface. Referenced by CreatePlanet(). 00191 {
00192 return surface;
00193 }
|
|
|
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 }
|
|
|
Definition at line 369 of file body.cpp. References planetocentricToCartesian(). 00370 {
00371 return planetocentricToCartesian(lonLatAlt.x, lonLatAlt.y, lonLatAlt.z);
00372 }
|
|
||||||||||||||||
|
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 }
|
|
|
Definition at line 160 of file body.cpp. References albedo. Referenced by CreatePlanet(). 00161 {
00162 albedo = _albedo;
00163 }
|
|
|
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 }
|
|
|
Definition at line 477 of file body.cpp. References classification. Referenced by CreatePlanet(). 00478 {
00479 classification = _classification;
00480 }
|
|
|
Definition at line 488 of file body.cpp. References infoURL. Referenced by CreatePlanet(). 00489 {
00490 infoURL = _infoURL;
00491 }
|
|
||||||||||||
|
Definition at line 393 of file body.cpp. References eschatos, and protos. Referenced by CreatePlanet().
|
|
|
Definition at line 136 of file body.cpp. References mass. Referenced by CreatePlanet(). 00137 {
00138 mass = _mass;
00139 }
|
|
|
Definition at line 213 of file body.cpp. References model. Referenced by CreatePlanet(). 00214 {
00215 model = _model;
00216 }
|
|
|
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 }
|
|
|
Definition at line 148 of file body.cpp. References oblateness. Referenced by CreatePlanet(). 00149 {
00150 oblateness = _oblateness;
00151 }
|
|
|
Definition at line 87 of file body.cpp. References orbit. Referenced by CreatePlanet().
|
|
|
Definition at line 100 of file body.cpp. References orbitRefPlane. 00101 {
00102 orbitRefPlane = refPlane;
00103 }
|
|
|
Definition at line 172 of file body.cpp. References orientation. Referenced by CreatePlanet(), and CelestiaCore::mouseMove(). 00173 {
00174 orientation = q;
00175 }
|
|
|
Definition at line 112 of file body.cpp. References radius. Referenced by CreatePlanet(). 00113 {
00114 radius = _radius;
00115 }
|
|
|
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 }
|
|
|
Definition at line 184 of file body.cpp. References rotationElements. Referenced by CreatePlanet(). 00185 {
00186 rotationElements = re;
00187 }
|
|
|
Definition at line 224 of file body.cpp. References satellites. Referenced by createBody(), and LoadSolarSystemObjects(). 00225 {
00226 satellites = ssys;
00227 }
|
|
|
Definition at line 202 of file body.cpp. References surface. Referenced by CreatePlanet(). 00203 {
00204 surface = surf;
00205 }
|
|
|
Definition at line 188 of file body.h. Referenced by getAlbedo(), getLuminosity(), and setAlbedo(). |
|
|
Definition at line 207 of file body.h. Referenced by addAlternateSurface(), getAlternateSurface(), and getAlternateSurfaceNames(). |
|
|
Definition at line 197 of file body.h. Referenced by getAtmosphere(), and setAtmosphere(). |
|
|
Definition at line 202 of file body.h. Referenced by getClassification(), and setClassification(). |
|
|
Definition at line 192 of file body.h. Referenced by extant(), getLifespan(), and setLifespan(). |
|
|
|
|
|
Definition at line 204 of file body.h. Referenced by getInfoURL(), and setInfoURL(). |
|
|
Definition at line 209 of file body.h. Referenced by addLocation(), computeLocations(), findLocation(), and getLocations(). |
|
|
Definition at line 210 of file body.h. Referenced by computeLocations(). |
|
|
|
|
|
Definition at line 194 of file body.h. Referenced by computeLocations(), getBoundingRadius(), getModel(), and setModel(). |
|
|
Definition at line 177 of file body.h. Referenced by addAlternateSurface(), findLocation(), getAlternateSurface(), getName(), and setName(). |
|
|
Definition at line 187 of file body.h. Referenced by getOblateness(), and setOblateness(). |
|
|
Definition at line 181 of file body.h. Referenced by getLocalToHeliocentric(), getOrbit(), and setOrbit(). |
|
|
Definition at line 182 of file body.h. Referenced by getLocalToHeliocentric(), getOrbitReferencePlane(), and setOrbitReferencePlane(). |
|
|
Definition at line 189 of file body.h. Referenced by getOrientation(), and setOrientation(). |
|
|
Definition at line 191 of file body.h. Referenced by extant(), getLifespan(), and setLifespan(). |
|
|
Definition at line 185 of file body.h. Referenced by computeLocations(), getBoundingRadius(), getLuminosity(), getRadius(), and setRadius(). |
|
|
Definition at line 198 of file body.h. Referenced by getRings(), and setRings(). |
|
|
Definition at line 183 of file body.h. Referenced by getEclipticalToEquatorial(), getEquatorialToGeographic(), getLocalToHeliocentric(), getRotationElements(), and setRotationElements(). |
|
|
Definition at line 200 of file body.h. Referenced by getSatellites(), and setSatellites(). |
|
|
Definition at line 195 of file body.h. Referenced by addAlternateSurface(), getSurface(), and setSurface(). |
|
|
Definition at line 180 of file body.h. Referenced by Body(), getEclipticalToEquatorial(), getLocalToHeliocentric(), getSystem(), and ~Body(). |
1.4.1