Observability.cpp   Observability.cpp 
skipping to change at line 445 skipping to change at line 445
else // There is no source selected! else // There is no source selected!
{ {
// If no source is selected, get the position vector of the screen c enter: // If no source is selected, get the position vector of the screen c enter:
selName.clear(); selName.clear();
isStar = true; isStar = true;
isMoon = false; isMoon = false;
isSun = false; isSun = false;
isScreen = true; isScreen = true;
Vec3d currentPos = GETSTELMODULE(StelMovementMgr)->getViewDi rectionJ2000(); Vec3d currentPos = GETSTELMODULE(StelMovementMgr)->getViewDi rectionJ2000();
currentPos.normalize(); currentPos.normalize();
EquPos = core->j2000ToEquinoxEqu(currentPos); EquPos = core->j2000ToEquinoxEqu(currentPos, StelCore::Refra ctionOff);
LocPos = core->j2000ToAltAz(currentPos, StelCore::Refraction Off); LocPos = core->j2000ToAltAz(currentPos, StelCore::Refraction Off);
} }
// Convert EquPos to RA/Dec: // Convert EquPos to RA/Dec:
toRADec(EquPos, selRA, selDec); toRADec(EquPos, selRA, selDec);
// Compute source's altitude (in radians): // Compute source's altitude (in radians):
alti = std::asin(LocPos[2]); alti = std::asin(LocPos[2]);
// Force re-computation of ephemeris if the location changes or the user ch anges the configuration: // Force re-computation of ephemeris if the location changes or the user ch anges the configuration:
skipping to change at line 913 skipping to change at line 913
result -= (result > 12.) ? 24.0 : 0.0; result -= (result > 12.) ? 24.0 : 0.0;
return result; return result;
} }
//////////////////////////////////// ////////////////////////////////////
//////////////////////////////////// ////////////////////////////////////
// Converts a float time/angle span (in hours/degrees) in the (integer) for mat hh/dd,mm,ss: // Converts a float time/angle span (in hours/degrees) in the (integer) for mat hh/dd,mm,ss:
void Observability::double2hms(double hfloat, int &h1, int &h2, int &h3) void Observability::double2hms(double hfloat, int &h1, int &h2, int &h3)
{ {
double f1,f2,f3; h1 = (int)hfloat;
hfloat = qAbs(hfloat); h2 = (int)((qAbs(hfloat)-qAbs(double(h1)))*60);
double ffrac = std::modf(hfloat,&f1); h3 = (int)(((qAbs(hfloat)-qAbs(double(h1)))*60)-h2)*60;
double ffrac2 = std::modf(60.*ffrac,&f2);
ffrac2 = std::modf(3600.*(ffrac-f2/60.),&f3);
h1 = (int)f1 ; h2 = (int)qAbs(f2+0.0*ffrac2) ; h3 = (int)qAbs(f3);
} }
//////////////////////////////////// ////////////////////////////////////
//////////////////////////////////// ////////////////////////////////////
// Adds/subtracts 24hr to ensure a RA between 0 and 24hr: // Adds/subtracts 24hr to ensure a RA between 0 and 24hr:
double Observability::toUnsignedRA(double RA) double Observability::toUnsignedRA(double RA)
{ {
double tempRA,tempmod; double tempRA,tempmod;
if (RA<0.0) if (RA<0.0)
{ {
skipping to change at line 1029 skipping to change at line 1026
// Compute Earth's position throughout the year: // Compute Earth's position throughout the year:
Vec3d pos, sunPos; Vec3d pos, sunPos;
for (int i=0; i<nDays; i++) for (int i=0; i<nDays; i++)
{ {
yearJD[i].first = Jan1stJD + (double)i; yearJD[i].first = Jan1stJD + (double)i;
yearJD[i].second = yearJD[i].first+core->computeDeltaT(yearJ D[i].first)/86400.0; yearJD[i].second = yearJD[i].first+core->computeDeltaT(yearJ D[i].first)/86400.0;
myEarth->computePosition(yearJD[i].second); myEarth->computePosition(yearJD[i].second);
myEarth->computeTransMatrix(yearJD[i].first, yearJD[i].secon d); myEarth->computeTransMatrix(yearJD[i].first, yearJD[i].secon d);
pos = myEarth->getHeliocentricEclipticPos(); pos = myEarth->getHeliocentricEclipticPos();
sunPos = core->j2000ToEquinoxEqu((StelCore::matVsop87ToJ2000 )*(-pos)); sunPos = core->j2000ToEquinoxEqu((StelCore::matVsop87ToJ2000 )*(-pos), StelCore::RefractionOff);
EarthPos[i] = -pos; EarthPos[i] = -pos;
toRADec(sunPos,sunRA[i],sunDec[i]); toRADec(sunPos,sunRA[i],sunDec[i]);
}; };
//Return the Earth to its current time: //Return the Earth to its current time:
myEarth->computePosition(myJD.second); myEarth->computePosition(myJD.second);
myEarth->computeTransMatrix(myJD.first, myJD.second); myEarth->computeTransMatrix(myJD.first, myJD.second);
} }
/////////////////////////////////////////////////// ///////////////////////////////////////////////////
skipping to change at line 1263 skipping to change at line 1260
myMoon->computeTransMatrix(JD.first, JD.second); myMoon->computeTransMatrix(JD.first, JD.second);
} }
else // Compute coordinates: else // Compute coordinates:
{ {
myEarth->computePosition(JD.second); myEarth->computePosition(JD.second);
myEarth->computeTransMatrix(JD.first, JD.second); myEarth->computeTransMatrix(JD.first, JD.second);
Vec3d earthPos = myEarth->getHeliocentricEclipticPos(); Vec3d earthPos = myEarth->getHeliocentricEclipticPos();
double curSidT; double curSidT;
// Sun coordinates: // Sun coordinates:
Vec3d sunPos = core->j2000ToEquinoxEqu((StelCore::matVsop87T oJ2000)*(-earthPos)); Vec3d sunPos = core->j2000ToEquinoxEqu((StelCore::matVsop87T oJ2000)*(-earthPos), StelCore::RefractionOff);
toRADec(sunPos, raSun, decSun); toRADec(sunPos, raSun, decSun);
// Moon coordinates: // Moon coordinates:
curSidT = myEarth->getSiderealTime(JD.first, JD.second)/Rad2 Deg; curSidT = myEarth->getSiderealTime(JD.first, JD.second)/Rad2 Deg;
RotObserver = (Mat4d::zrotation(curSidT))*ObserverLoc; RotObserver = (Mat4d::zrotation(curSidT))*ObserverLoc;
LocTrans = (StelCore::matVsop87ToJ2000)*(Mat4d::translation( -earthPos)); LocTrans = (StelCore::matVsop87ToJ2000)*(Mat4d::translation( -earthPos));
myMoon->computePosition(JD.second); myMoon->computePosition(JD.second);
myMoon->computeTransMatrix(JD.first, JD.second); myMoon->computeTransMatrix(JD.first, JD.second);
Vec3d moonPos = myMoon->getHeliocentricEclipticPos(); Vec3d moonPos = myMoon->getHeliocentricEclipticPos();
sunPos = (core->j2000ToEquinoxEqu(LocTrans*moonPos))-RotObse rver; sunPos = (core->j2000ToEquinoxEqu(LocTrans*moonPos, StelCore ::RefractionOff))-RotObserver;
eclLon = moonPos[0]*earthPos[1] - moonPos[1]*earthPos[0]; eclLon = moonPos[0]*earthPos[1] - moonPos[1]*earthPos[0];
toRADec(sunPos,raMoon,decMoon); toRADec(sunPos,raMoon,decMoon);
}; };
} }
////////////////////////////////////////////// //////////////////////////////////////////////
////////////////////////// //////////////////////////
// Get the Observer-to-Moon distance JD: // Get the Observer-to-Moon distance JD:
skipping to change at line 1313 skipping to change at line 1310
// Pos2 = core->j2000ToEquinoxEqu((core->matVsop87ToJ2000)*(-Po s0)); // Pos2 = core->j2000ToEquinoxEqu((core->matVsop87ToJ2000)*(-Po s0));
// toRADec(Pos2,RASun,DecSun); // toRADec(Pos2,RASun,DecSun);
// Moon coordinates: // Moon coordinates:
// curSidT = myEarth->getSiderealTime(JD)/Rad2Deg; // curSidT = myEarth->getSiderealTime(JD)/Rad2Deg;
// RotObserver = (Mat4d::zrotation(curSidT))*ObserverLoc; // RotObserver = (Mat4d::zrotation(curSidT))*ObserverLoc;
LocTrans = (StelCore::matVsop87ToJ2000)*(Mat4d::translation( -earthPos)); LocTrans = (StelCore::matVsop87ToJ2000)*(Mat4d::translation( -earthPos));
myMoon->computePosition(JD.second); myMoon->computePosition(JD.second);
myMoon->computeTransMatrix(JD.first, JD.second); myMoon->computeTransMatrix(JD.first, JD.second);
Pos1 = myMoon->getHeliocentricEclipticPos(); Pos1 = myMoon->getHeliocentricEclipticPos();
Pos2 = (core->j2000ToEquinoxEqu(LocTrans*Pos1)); //-RotObser ver; Pos2 = (core->j2000ToEquinoxEqu(LocTrans*Pos1), StelCore::Re fractionOff); //-RotObserver;
distance = std::sqrt(Pos2*Pos2); distance = std::sqrt(Pos2*Pos2);
// toRADec(Pos2,RAMoon,DecMoon); // toRADec(Pos2,RAMoon,DecMoon);
}; };
} }
////////////////////////////////////////////// //////////////////////////////////////////////
////////////////////////////////////////////// //////////////////////////////////////////////
// Get the Coords of a planet: // Get the Coords of a planet:
skipping to change at line 1344 skipping to change at line 1341
} else } else
{ {
// Compute planet's position: // Compute planet's position:
myPlanet->computePosition(JD.second); myPlanet->computePosition(JD.second);
myPlanet->computeTransMatrix(JD.first, JD.second); myPlanet->computeTransMatrix(JD.first, JD.second);
Pos1 = myPlanet->getHeliocentricEclipticPos(); Pos1 = myPlanet->getHeliocentricEclipticPos();
myEarth->computePosition(JD.second); myEarth->computePosition(JD.second);
myEarth->computeTransMatrix(JD.first, JD.second); myEarth->computeTransMatrix(JD.first, JD.second);
Pos2 = myEarth->getHeliocentricEclipticPos(); Pos2 = myEarth->getHeliocentricEclipticPos();
LocTrans = (StelCore::matVsop87ToJ2000)*(Mat4d::translation( -Pos2)); LocTrans = (StelCore::matVsop87ToJ2000)*(Mat4d::translation( -Pos2));
Pos2 = core->j2000ToEquinoxEqu(LocTrans*Pos1); Pos2 = core->j2000ToEquinoxEqu(LocTrans*Pos1, StelCore::Refr actionOff);
toRADec(Pos2,RA,Dec); toRADec(Pos2,RA,Dec);
}; };
} }
////////////////////////////////////////////// //////////////////////////////////////////////
////////////////////////////////////////////// //////////////////////////////////////////////
// Solves Moon's, Sun's, or Planet's ephemeris by bissection. // Solves Moon's, Sun's, or Planet's ephemeris by bissection.
bool Observability::calculateSolarSystemEvents(StelCore* core, int bodyType ) bool Observability::calculateSolarSystemEvents(StelCore* core, int bodyType )
{ {
skipping to change at line 1378 skipping to change at line 1375
{ {
lastType = bodyType; lastType = bodyType;
myEarth->computePosition(myJD.second); myEarth->computePosition(myJD.second);
myEarth->computeTransMatrix(myJD.first, myJD.second); myEarth->computeTransMatrix(myJD.first, myJD.second);
Vec3d earthPos = myEarth->getHeliocentricEclipticPos(); Vec3d earthPos = myEarth->getHeliocentricEclipticPos();
if (bodyType == 1) // Sun position if (bodyType == 1) // Sun position
{ {
Pos2 = core->j2000ToEquinoxEqu((StelCore::matVsop87T oJ2000)*(-earthPos)); Pos2 = core->j2000ToEquinoxEqu((StelCore::matVsop87T oJ2000)*(-earthPos), StelCore::RefractionOff);
} }
else if (bodyType==2) // Moon position else if (bodyType==2) // Moon position
{ {
curSidT = myEarth->getSiderealTime(myJD.first, myJD. second)/Rad2Deg; curSidT = myEarth->getSiderealTime(myJD.first, myJD. second)/Rad2Deg;
RotObserver = (Mat4d::zrotation(curSidT))*ObserverLo c; RotObserver = (Mat4d::zrotation(curSidT))*ObserverLo c;
LocTrans = (StelCore::matVsop87ToJ2000)*(Mat4d::tran slation(-earthPos)); LocTrans = (StelCore::matVsop87ToJ2000)*(Mat4d::tran slation(-earthPos));
myMoon->computePosition(myJD.second); myMoon->computePosition(myJD.second);
myMoon->computeTransMatrix(myJD.first, myJD.second); myMoon->computeTransMatrix(myJD.first, myJD.second);
Pos1 = myMoon->getHeliocentricEclipticPos(); Pos1 = myMoon->getHeliocentricEclipticPos();
Pos2 = (core->j2000ToEquinoxEqu(LocTrans*Pos1))-RotO bserver; Pos2 = (core->j2000ToEquinoxEqu(LocTrans*Pos1, StelC ore::RefractionOff))-RotObserver;
} }
else // Planet position else // Planet position
{ {
myPlanet->computePosition(myJD.second); myPlanet->computePosition(myJD.second);
myPlanet->computeTransMatrix(myJD.first, myJD.second ); myPlanet->computeTransMatrix(myJD.first, myJD.second );
Pos1 = myPlanet->getHeliocentricEclipticPos(); Pos1 = myPlanet->getHeliocentricEclipticPos();
LocTrans = (StelCore::matVsop87ToJ2000)*(Mat4d::tran slation(-earthPos)); LocTrans = (StelCore::matVsop87ToJ2000)*(Mat4d::tran slation(-earthPos));
Pos2 = core->j2000ToEquinoxEqu(LocTrans*Pos1); Pos2 = core->j2000ToEquinoxEqu(LocTrans*Pos1, StelCo re::RefractionOff);
}; };
toRADec(Pos2,ra,dec); toRADec(Pos2,ra,dec);
Vec3d moonAltAz = core->equinoxEquToAltAz(Pos2, StelCore::Re fractionOff); Vec3d moonAltAz = core->equinoxEquToAltAz(Pos2, StelCore::Re fractionOff);
hasRisen = moonAltAz[2] > refractedHorizonAlt; hasRisen = moonAltAz[2] > refractedHorizonAlt;
// Initial guesses of rise/set/transit times. // Initial guesses of rise/set/transit times.
// They are called 'Moon', but are also used for the Sun or planet: // They are called 'Moon', but are also used for the Sun or planet:
double Hcurr = -calculateHourAngle(mylat,alti,selDec)*sign(L ocPos[1]); double Hcurr = -calculateHourAngle(mylat,alti,selDec)*sign(L ocPos[1]);
 End of changes. 10 change blocks. 
15 lines changed or deleted 12 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/