StelObserver.cpp   StelObserver.cpp 
skipping to change at line 80 skipping to change at line 80
} }
void ArtificialPlanet::setDest(const PlanetP& dest) void ArtificialPlanet::setDest(const PlanetP& dest)
{ {
ArtificialPlanet::dest = dest; ArtificialPlanet::dest = dest;
englishName = QString("%1->%2").arg(orig_name).arg(dest->getEnglishN ame()); englishName = QString("%1->%2").arg(orig_name).arg(dest->getEnglishN ame());
nameI18 = QString("%1->%2").arg(orig_name_i18n).arg(dest->getNameI18 n()); nameI18 = QString("%1->%2").arg(orig_name_i18n).arg(dest->getNameI18 n());
// rotation: // rotation:
const RotationElements &r(dest->getRotationElements()); const RotationElements &r(dest->getRotationElements());
lastJD = StelApp::getInstance().getCore()->getJDay(); lastJDE = StelApp::getInstance().getCore()->getJDE();
re.offset = r.offset + fmod(re.offset - r.offset + 360.0*( (lastJD-r e.epoch)/re.period - (lastJD-r.epoch)/r.period), 360.0); re.offset = r.offset + fmod(re.offset - r.offset + 360.0*( (lastJDE- re.epoch)/re.period - (lastJDE-r.epoch)/r.period), 360.0);
re.epoch = r.epoch; re.epoch = r.epoch;
re.period = r.period; re.period = r.period;
if (re.offset - r.offset < -180.f) re.offset += 360.f; else if (re.offset - r.offset < -180.f) re.offset += 360.f; else
if (re.offset - r.offset > 180.f) re.offset -= 360.f; if (re.offset - r.offset > 180.f) re.offset -= 360.f;
} }
void ArtificialPlanet::setRot(const Vec3d &r) void ArtificialPlanet::setRot(const Vec3d &r)
{ {
const double ca = cos(r[0]); const double ca = cos(r[0]);
skipping to change at line 183 skipping to change at line 183
planet=ssystem->getEarth(); planet=ssystem->getEarth();
} }
} }
StelObserver::~StelObserver() StelObserver::~StelObserver()
{ {
} }
const QSharedPointer<Planet> StelObserver::getHomePlanet(void) const const QSharedPointer<Planet> StelObserver::getHomePlanet(void) const
{ {
Q_ASSERT(planet);
return planet; return planet;
} }
Vec3d StelObserver::getCenterVsop87Pos(void) const Vec3d StelObserver::getCenterVsop87Pos(void) const
{ {
return getHomePlanet()->getHeliocentricEclipticPos(); return getHomePlanet()->getHeliocentricEclipticPos();
} }
// Used to approximate solution with assuming a spherical planet.
// Since V0.14, following Meeus, Astr. Alg. 2nd ed, Ch.11.
double StelObserver::getDistanceFromCenter(void) const double StelObserver::getDistanceFromCenter(void) const
{ {
return getHomePlanet()->getRadius() + (currentLocation.altitude/(100 if (getHomePlanet()->getRadius()==0.0) // the transitional Artificia
0*AU)); lPlanet od SpaceShipObserver has this
return currentLocation.altitude/(1000*AU);
double a=getHomePlanet()->getRadius();
double bByA = getHomePlanet()->getOneMinusOblateness(); // b/a;
if (fabs(currentLocation.latitude)>=89.9) // avoid tan(90) issues.
return a * bByA;
double latRad=currentLocation.latitude*(M_PI/180.0);
double u = atan( bByA * tan(latRad));
// qDebug() << "getDistanceFromCenter: a=" << a*AU << "b/a=" << bByA
<< "b=" << bByA*a *AU << "latRad=" << latRad << "u=" << u;
Q_ASSERT(fabs(u)<= fabs(latRad));
double altFix=(currentLocation.altitude/(1000.0*AU)) / a;
double rhoSinPhiPrime= bByA * sin(u) + altFix*sin(latRad);
double rhoCosPhiPrime= cos(u) + altFix*cos(latRad);
double rho = sqrt(rhoSinPhiPrime*rhoSinPhiPrime+rhoCosPhiPrime*rhoCo
sPhiPrime);
return rho*a;
} }
Mat4d StelObserver::getRotAltAzToEquatorial(double jd) const // For Earth we require JD, for other planets JDE to describe rotation!
Mat4d StelObserver::getRotAltAzToEquatorial(double JD, double JDE) const
{ {
double lat = currentLocation.latitude; double lat = currentLocation.latitude;
// TODO: Figure out how to keep continuity in sky as reach poles // TODO: Figure out how to keep continuity in sky as we reach poles
// otherwise sky jumps in rotation when reach poles in equatorial mo de // otherwise sky jumps in rotation when reach poles in equatorial mo de
// This is a kludge // This is a kludge
// GZ: Actually, why would that be? Lat should be clamped elsewhere.
Added tests to track down problems in other locations.
Q_ASSERT(lat <= 90.0);
Q_ASSERT(lat >= -90.0);
if( lat > 90.0 ) lat = 90.0; if( lat > 90.0 ) lat = 90.0;
if( lat < -90.0 ) lat = -90.0; if( lat < -90.0 ) lat = -90.0;
// Include a DeltaT correction. Sidereal time and longitude here are return Mat4d::zrotation((getHomePlanet()->getSiderealTime(JD, JDE)+c
both in degrees, but DeltaT in seconds of time. urrentLocation.longitude)*M_PI/180.)
// 360 degrees = 24hrs; 15 degrees = 1hr = 3600s; 1 degree = 240s
// Apply DeltaT correction only for Earth
double deltaT = 0.;
if (getHomePlanet()->getEnglishName()=="Earth")
deltaT = StelApp::getInstance().getCore()->getDeltaT(jd)/240
.;
return Mat4d::zrotation((getHomePlanet()->getSiderealTime(jd)+curren
tLocation.longitude-deltaT)*M_PI/180.)
* Mat4d::yrotation((90.-lat)*M_PI/180.); * Mat4d::yrotation((90.-lat)*M_PI/180.);
} }
Mat4d StelObserver::getRotEquatorialToVsop87(void) const Mat4d StelObserver::getRotEquatorialToVsop87(void) const
{ {
return getHomePlanet()->getRotEquatorialToVsop87(); return getHomePlanet()->getRotEquatorialToVsop87();
} }
SpaceShipObserver::SpaceShipObserver(const StelLocation& startLoc, const St elLocation& target, double atransitSeconds) : StelObserver(startLoc), SpaceShipObserver::SpaceShipObserver(const StelLocation& startLoc, const St elLocation& target, double atransitSeconds) : StelObserver(startLoc),
moveStartLocation(startLoc), moveTargetLocation(target), art ificialPlanet(NULL), transitSeconds(atransitSeconds) moveStartLocation(startLoc), moveTargetLocation(target), art ificialPlanet(NULL), transitSeconds(atransitSeconds)
 End of changes. 9 change blocks. 
16 lines changed or deleted 37 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/