SolarSystem.cpp   SolarSystem.cpp 
skipping to change at line 23 skipping to change at line 23
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*/ */
#include "SolarSystem.hpp" #include "SolarSystem.hpp"
#include "renderer/StelGLSLShader.hpp" #include "StelTexture.hpp"
#include "renderer/StelRenderer.hpp"
#include "renderer/StelTextureNew.hpp"
#include "stellplanet.h" #include "stellplanet.h"
#include "Orbit.hpp" #include "Orbit.hpp"
#include "StelProjector.hpp" #include "StelProjector.hpp"
#include "StelApp.hpp" #include "StelApp.hpp"
#include "StelCore.hpp" #include "StelCore.hpp"
#include "StelTextureMgr.hpp"
#include "StelObjectMgr.hpp" #include "StelObjectMgr.hpp"
#include "StelLocaleMgr.hpp" #include "StelLocaleMgr.hpp"
#include "StelSkyCultureMgr.hpp" #include "StelSkyCultureMgr.hpp"
#include "StelFileMgr.hpp" #include "StelFileMgr.hpp"
#include "StelModuleMgr.hpp" #include "StelModuleMgr.hpp"
#include "StelIniParser.hpp" #include "StelIniParser.hpp"
#include "StelUtils.hpp"
#include "Planet.hpp" #include "Planet.hpp"
#include "MinorPlanet.hpp" #include "MinorPlanet.hpp"
#include "Comet.hpp" #include "Comet.hpp"
#include "StelSkyDrawer.hpp" #include "StelSkyDrawer.hpp"
#include "StelUtils.hpp" #include "StelUtils.hpp"
#include "StelPainter.hpp"
#include "TrailGroup.hpp" #include "TrailGroup.hpp"
#include "RefractionExtinction.hpp" #include "RefractionExtinction.hpp"
#include <algorithm>
#include <functional> #include <functional>
#include <algorithm>
#include <QDebug> #include <QTextStream>
#include <QFile>
#include <QMap>
#include <QMapIterator>
#include <QMultiMap>
#include <QSettings> #include <QSettings>
#include <QVariant>
#include <QString> #include <QString>
#include <QStringList> #include <QStringList>
#include <QTextStream> #include <QMap>
#include <QVariant> #include <QMultiMap>
#include <QMapIterator>
#include <QDebug>
#include <QDir> #include <QDir>
SolarSystem::SolarSystem() SolarSystem::SolarSystem()
: moonScale(1.) : shadowPlanetCount(0)
, flagMoonScale(false)
, moonScale(1.)
, labelsAmount(false)
, flagOrbits(false) , flagOrbits(false)
, flagLightTravelTime(false) , flagLightTravelTime(false)
, texPointer(NULL) , flagShow(false)
, flagMarker(false)
, allTrails(NULL) , allTrails(NULL)
{ {
planetNameFont.setPixelSize(StelApp::getInstance().getSettings()->va lue("gui/base_font_size", 13).toInt()); planetNameFont.setPixelSize(StelApp::getInstance().getSettings()->va lue("gui/base_font_size", 13).toInt());
setObjectName("SolarSystem"); setObjectName("SolarSystem");
} }
void SolarSystem::setFontSize(float newFontSize) void SolarSystem::setFontSize(float newFontSize)
{ {
planetNameFont.setPixelSize(newFontSize); planetNameFont.setPixelSize(newFontSize);
} }
skipping to change at line 91 skipping to change at line 93
// release selected: // release selected:
selected.clear(); selected.clear();
foreach (Orbit* orb, orbits) foreach (Orbit* orb, orbits)
{ {
delete orb; delete orb;
orb = NULL; orb = NULL;
} }
sun.clear(); sun.clear();
moon.clear(); moon.clear();
earth.clear(); earth.clear();
Planet::hintCircleTex.clear();
Planet::texEarthShadow.clear();
delete allTrails; delete allTrails;
allTrails = NULL; allTrails = NULL;
if(NULL != texPointer)
{
delete texPointer;
texPointer = NULL;
}
// Get rid of circular reference between the shared pointers which p revent proper destruction of the Planet objects. // Get rid of circular reference between the shared pointers which p revent proper destruction of the Planet objects.
foreach (PlanetP p, systemPlanets) foreach (PlanetP p, systemPlanets)
{ {
p->satellites.clear(); p->satellites.clear();
} }
} }
/************************************************************************* /*************************************************************************
Reimplementation of the getCallOrder method Reimplementation of the getCallOrder method
*************************************************************************/ *************************************************************************/
skipping to change at line 132 skipping to change at line 130
Q_ASSERT(conf); Q_ASSERT(conf);
loadPlanets(); // Load planets data loadPlanets(); // Load planets data
// Compute position and matrix of sun and all the satellites (ie pla nets) // Compute position and matrix of sun and all the satellites (ie pla nets)
// for the first initialization Q_ASSERT that center is sun center ( only impacts on light speed correction) // for the first initialization Q_ASSERT that center is sun center ( only impacts on light speed correction)
computePositions(StelUtils::getJDFromSystem()); computePositions(StelUtils::getJDFromSystem());
setSelected(""); // Fix a bug on macosX! Thanks Fumio! setSelected(""); // Fix a bug on macosX! Thanks Fumio!
setFlagMoonScale(conf->value("viewing/flag_moon_scaled", conf->value ("viewing/flag_init_moon_scaled", "false").toBool()).toBool()); // name ch ange setFlagMoonScale(conf->value("viewing/flag_moon_scaled", conf->value ("viewing/flag_init_moon_scaled", "false").toBool()).toBool()); // name ch ange
setMoonScale(conf->value("viewing/moon_scale", 5.0).toFloat()); setMoonScale(conf->value("viewing/moon_scale", 4.0).toFloat());
setFlagPlanets(conf->value("astro/flag_planets").toBool()); setFlagPlanets(conf->value("astro/flag_planets").toBool());
setFlagHints(conf->value("astro/flag_planets_hints").toBool()); setFlagHints(conf->value("astro/flag_planets_hints").toBool());
setFlagLabels(conf->value("astro/flag_planets_labels", true).toBool( )); setFlagLabels(conf->value("astro/flag_planets_labels", true).toBool( ));
setLabelsAmount(conf->value("astro/labels_amount", 3.).toFloat()); setLabelsAmount(conf->value("astro/labels_amount", 3.).toFloat());
setFlagOrbits(conf->value("astro/flag_planets_orbits").toBool()); setFlagOrbits(conf->value("astro/flag_planets_orbits").toBool());
setFlagLightTravelTime(conf->value("astro/flag_light_travel_time", f alse).toBool()); setFlagLightTravelTime(conf->value("astro/flag_light_travel_time", f alse).toBool());
setFlagMarkers(conf->value("astro/flag_planets_markers", true).toBoo l());
recreateTrails(); recreateTrails();
setFlagTrails(conf->value("astro/flag_object_trails", false).toBool( )); setFlagTrails(conf->value("astro/flag_object_trails", false).toBool( ));
StelObjectMgr *objectManager = GETSTELMODULE(StelObjectMgr); StelObjectMgr *objectManager = GETSTELMODULE(StelObjectMgr);
objectManager->registerStelObjectMgr(this); objectManager->registerStelObjectMgr(this);
connect(objectManager, SIGNAL(selectedObjectChanged(StelModule::Stel ModuleSelectAction)), connect(objectManager, SIGNAL(selectedObjectChanged(StelModule::Stel ModuleSelectAction)),
this, SLOT(selectedObjectChange(StelModule::StelModu leSelectAction))); this, SLOT(selectedObjectChange(StelModule::StelModu leSelectAction)));
texPointer = StelApp::getInstance().getTextureManager().createTextur
e(StelFileMgr::getInstallationDir()+"/textures/pointeur4.png");
Planet::hintCircleTex = StelApp::getInstance().getTextureManager().c
reateTexture(StelFileMgr::getInstallationDir()+"/textures/planet-indicator.
png");
StelApp *app = &StelApp::getInstance(); StelApp *app = &StelApp::getInstance();
connect(app, SIGNAL(languageChanged()), this, SLOT(updateI18n())); connect(app, SIGNAL(languageChanged()), this, SLOT(updateI18n()));
connect(app, SIGNAL(colorSchemeChanged(const QString&)), this, SLOT( setStelStyle(const QString&))); connect(app, SIGNAL(colorSchemeChanged(const QString&)), this, SLOT( setStelStyle(const QString&)));
QString displayGroup = N_("Display Options");
addAction("actionShow_Planets_Labels", displayGroup, N_("Planet labe
ls"), "labelsDisplayed", "P");
addAction("actionShow_Planets_Orbits", displayGroup, N_("Planet orbi
ts"), "orbitsDisplayed", "O");
addAction("actionShow_Planets_Trails", displayGroup, N_("Planet trai
ls"), "trailsDisplayed", "Shift+T");
}
void SolarSystem::deinit()
{
Planet::deinitShader();
} }
void SolarSystem::recreateTrails() void SolarSystem::recreateTrails()
{ {
// Create a trail group containing all the planets orbiting the sun (not including satellites) // Create a trail group containing all the planets orbiting the sun (not including satellites)
if (allTrails!=NULL) if (allTrails!=NULL)
delete allTrails; delete allTrails;
allTrails = new TrailGroup(365.f); allTrails = new TrailGroup(365.f);
foreach (const PlanetP& p, getSun()->satellites) foreach (const PlanetP& p, getSun()->satellites)
{ {
allTrails->addObject((QSharedPointer<StelObject>)p, &trailCo lor); allTrails->addObject((QSharedPointer<StelObject>)p, &trailCo lor);
} }
} }
void SolarSystem::drawPointer(const StelCore* core, StelRenderer* renderer) void SolarSystem::drawPointer(const StelCore* core)
{ {
const StelProjectorP prj = core->getProjection(StelCore::FrameJ2000) ; const StelProjectorP prj = core->getProjection(StelCore::FrameJ2000) ;
const QList<StelObjectP> newSelected = GETSTELMODULE(StelObjectMgr)- >getSelectedObject("Planet"); const QList<StelObjectP> newSelected = GETSTELMODULE(StelObjectMgr)- >getSelectedObject("Planet");
if (!newSelected.empty()) if (!newSelected.empty())
{ {
const StelObjectP obj = newSelected[0]; const StelObjectP obj = newSelected[0];
Vec3d pos=obj->getJ2000EquatorialPos(core); Vec3d pos=obj->getJ2000EquatorialPos(core);
Vec3d screenpos; Vec3d screenpos;
// Compute 2D pos and return if outside screen // Compute 2D pos and return if outside screen
if (!prj->project(pos, screenpos)) if (!prj->project(pos, screenpos))
return; return;
const Vec4f color = StelApp::getInstance().getVisionModeNigh StelPainter sPainter(prj);
t() Vec3f color = getPointersColor();
? Vec4f(1.0f,0.0f,0.0f,1.0f) : Vec4f(1.0f, sPainter.setColor(color[0],color[1],color[2]);
0.3f,0.3f,1.0f);
renderer->setGlobalColor(color);
float size = obj->getAngularSize(core)*M_PI/180.*prj->getPix elPerRadAtCenter()*2.; float size = obj->getAngularSize(core)*M_PI/180.*prj->getPix elPerRadAtCenter()*2.;
size+=40.f + 10.f*std::sin(2.f * StelApp::getInstance().getT otalRunTime());
if(NULL == texPointer) const float scale = prj->getDevicePixelsPerPixel()*StelApp::
{ getInstance().getGlobalScalingRatio();
texPointer = renderer->createTexture("textures/point size+= scale * (45.f + 10.f*std::sin(2.f * StelApp::getInsta
eur4.png"); nce().getTotalRunTime()));
}
texPointer->bind(); texPointer->bind();
renderer->setBlendMode(BlendMode_Alpha); sPainter.enableTexture2d(true);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal
transparency mode
size*=0.5; size*=0.5;
const float angleBase = StelApp::getInstance().getTotalRunTi me() * 10; const float angleBase = StelApp::getInstance().getTotalRunTi me() * 10;
// We draw 4 instances of the sprite at the corners of the p ointer // We draw 4 instances of the sprite at the corners of the p ointer
for (int i = 0; i < 4; ++i) for (int i = 0; i < 4; ++i)
{ {
const float angle = angleBase + i * 90; const float angle = angleBase + i * 90;
const double x = screenpos[0] + size * cos(angle / 1 80 * M_PI); const double x = screenpos[0] + size * cos(angle / 1 80 * M_PI);
const double y = screenpos[1] + size * sin(angle / 1 80 * M_PI); const double y = screenpos[1] + size * sin(angle / 1 80 * M_PI);
renderer->drawTexturedRect(x - 10, y - 10, 20, 20, a ngle); sPainter.drawSprite2dMode(x, y, 10, angle);
} }
} }
} }
void ellipticalOrbitPosFunc(double jd,double xyz[3], void* userDataPtr) void ellipticalOrbitPosFunc(double jd,double xyz[3], void* userDataPtr)
{ {
static_cast<EllipticalOrbit*>(userDataPtr)->positionAtTimevInVSOP87C oordinates(jd, xyz); static_cast<EllipticalOrbit*>(userDataPtr)->positionAtTimevInVSOP87C oordinates(jd, xyz);
} }
void cometOrbitPosFunc(double jd,double xyz[3], void* userDataPtr) void cometOrbitPosFunc(double jd,double xyz[3], void* userDataPtr)
{ {
static_cast<CometOrbit*>(userDataPtr)->positionAtTimevInVSOP87Coordi nates(jd, xyz); static_cast<CometOrbit*>(userDataPtr)->positionAtTimevInVSOP87Coordi nates(jd, xyz);
} }
// Init and load the solar system data // Init and load the solar system data
void SolarSystem::loadPlanets() void SolarSystem::loadPlanets()
{ {
qDebug() << "Loading Solar System data ..."; qDebug() << "Loading Solar System data ...";
QStringList solarSystemFiles; QStringList solarSystemFiles = StelFileMgr::findFileInAllPaths("data
try /ssystem.ini");
if (solarSystemFiles.isEmpty())
{ {
solarSystemFiles = StelFileMgr::findFileInAllPaths("data/ssy qWarning() << "ERROR while loading ssysyem.ini (unable to fi
stem.ini"); nd data/ssystem.ini): " << endl;
}
catch(std::runtime_error& e)
{
qWarning() << "ERROR while loading ssysyem.ini (unable to fi
nd data/ssystem.ini): " << e.what() << endl;
return; return;
} }
foreach (const QString& solarSystemFile, solarSystemFiles) foreach (const QString& solarSystemFile, solarSystemFiles)
{ {
if (loadPlanets(solarSystemFile)) if (loadPlanets(solarSystemFile))
break; break;
else else
{ {
sun.clear(); sun.clear();
skipping to change at line 364 skipping to change at line 371
orderedSections << levelMapIt.value(); orderedSections << levelMapIt.value();
} }
// Stage 3 (as described above). // Stage 3 (as described above).
int readOk=0; int readOk=0;
int totalPlanets=0; int totalPlanets=0;
for (int i = 0;i<orderedSections.size();++i) for (int i = 0;i<orderedSections.size();++i)
{ {
totalPlanets++; totalPlanets++;
const QString secname = orderedSections.at(i); const QString secname = orderedSections.at(i);
const QString englishName = pd.value(secname+"/name").toStri ng(); const QString englishName = pd.value(secname+"/name").toStri ng().simplified();
const QString strParent = pd.value(secname+"/parent").toStri ng(); const QString strParent = pd.value(secname+"/parent").toStri ng();
PlanetP parent; PlanetP parent;
if (strParent!="none") if (strParent!="none")
{ {
// Look in the other planets the one named with strP arent // Look in the other planets the one named with strP arent
foreach (const PlanetP& p, systemPlanets) foreach (const PlanetP& p, systemPlanets)
{ {
if (p->getEnglishName()==strParent) if (p->getEnglishName()==strParent)
{ {
parent = p; parent = p;
skipping to change at line 458 skipping to change at line 465
if (mean_anomaly <= -1e100) { if (mean_anomaly <= -1e100) {
mean_longitude = pd.value(secname+"/orbit_Me anLongitude").toDouble()*(M_PI/180.0); mean_longitude = pd.value(secname+"/orbit_Me anLongitude").toDouble()*(M_PI/180.0);
mean_anomaly = mean_longitude - long_of_peri center; mean_anomaly = mean_longitude - long_of_peri center;
} else { } else {
mean_anomaly *= (M_PI/180.0); mean_anomaly *= (M_PI/180.0);
mean_longitude = mean_anomaly + long_of_peri center; mean_longitude = mean_anomaly + long_of_peri center;
} }
// when the parent is the sun use ecliptic rather th an sun equator: // when the parent is the sun use ecliptic rather th an sun equator:
const double parentRotObliquity = parent->getParent( ) const double parentRotObliquity = parent->getParent( )
? parent->getRotObliquity() ? parent->getRotObliquity(2451545.0)
: 0.0; : 0.0;
const double parent_rot_asc_node = parent->getParent () const double parent_rot_asc_node = parent->getParent ()
? parent->getRotAscendingnode() ? parent->getRotAscendingnode()
: 0.0; : 0.0;
double parent_rot_j2000_longitude = 0.0; double parent_rot_j2000_longitude = 0.0;
if (parent->getParent()) { if (parent->getParent()) {
const double c_obl = cos(parentRotObliquity) ; const double c_obl = cos(parentRotObliquity) ;
const double s_obl = sin(parentRotObliquity) ; const double s_obl = sin(parentRotObliquity) ;
const double c_nod = cos(parent_rot_asc_node ); const double c_nod = cos(parent_rot_asc_node );
const double s_nod = sin(parent_rot_asc_node ); const double s_nod = sin(parent_rot_asc_node );
skipping to change at line 534 skipping to change at line 541
if (meanMotion <= -1e100) { if (meanMotion <= -1e100) {
const double period = pd.value(secname+"/orb it_Period",-1e100).toDouble(); const double period = pd.value(secname+"/orb it_Period",-1e100).toDouble();
if (period <= -1e100) { if (period <= -1e100) {
if (parent->getParent()) { if (parent->getParent()) {
qWarning() << "ERROR: " << e nglishName qWarning() << "ERROR: " << e nglishName
<< ": when the paren t body is not the sun, you must provide " << ": when the paren t body is not the sun, you must provide "
<< "either orbit_Mea nMotion or orbit_Period"; << "either orbit_Mea nMotion or orbit_Period";
} else { } else {
// in case of parent=sun: us e Gaussian gravitational constant // in case of parent=sun: us e Gaussian gravitational constant
// for calculating meanMotio n: // for calculating meanMotio n:
//meanMotion = (eccentricity
>= 0.9999 && eccentricity <= 1.0)
// ? 0.
01720209895 * (1.5/pericenterDistance) * sqrt(0.5/pericenterDistance)
// : (s
emi_major_axis > 0.0)
// ? 0.
01720209895 / (semi_major_axis*sqrt(semi_major_axis))
// : 0.
01720209895 / (-semi_major_axis*sqrt(-semi_major_axis));
meanMotion = (eccentricity = = 1.0) meanMotion = (eccentricity = = 1.0)
? 0. ? 0.
01720209895 * (1.5/pericenterDistance) * sqrt(0.5/pericenterDistance) 01720209895 * (1.5/pericenterDistance) * sqrt(0.5/pericenterDistance) // G
: (s Z: This is Heafner's W / dt
emi_major_axis > 0.0) : 0.
? 0. 01720209895 / (fabs(semi_major_axis)*sqrt(fabs(semi_major_axis)));
01720209895 / (semi_major_axis*sqrt(semi_major_axis))
: 0.
01720209895 / (-semi_major_axis*sqrt(-semi_major_axis));
} }
} else { } else {
meanMotion = 2.0*M_PI/period; meanMotion = 2.0*M_PI/period;
} }
} else { } else {
meanMotion *= (M_PI/180.0); meanMotion *= (M_PI/180.0);
} }
double time_at_pericenter = pd.value(secname+"/orbit _TimeAtPericenter",-1e100).toDouble(); double time_at_pericenter = pd.value(secname+"/orbit _TimeAtPericenter",-1e100).toDouble();
if (time_at_pericenter <= -1e100) { if (time_at_pericenter <= -1e100) {
const double epoch = pd.value(secname+"/orbi t_Epoch",-1e100).toDouble(); const double epoch = pd.value(secname+"/orbi t_Epoch",-1e100).toDouble();
skipping to change at line 561 skipping to change at line 571
qWarning() << "ERROR: " << englishNa me qWarning() << "ERROR: " << englishNa me
<< ": when you do not provid e orbit_TimeAtPericenter, you must provide both " << ": when you do not provid e orbit_TimeAtPericenter, you must provide both "
<< "orbit_Epoch and orbit_Me anAnomaly"; << "orbit_Epoch and orbit_Me anAnomaly";
//abort(); //abort();
continue; continue;
} else { } else {
mean_anomaly *= (M_PI/180.0); mean_anomaly *= (M_PI/180.0);
time_at_pericenter = epoch - mean_an omaly / meanMotion; time_at_pericenter = epoch - mean_an omaly / meanMotion;
} }
} }
const double orbitGoodDays=pd.value(secname+"/orbit_ good", 1000).toDouble();
const double inclination = pd.value(secname+"/orbit_ Inclination").toDouble()*(M_PI/180.0); const double inclination = pd.value(secname+"/orbit_ Inclination").toDouble()*(M_PI/180.0);
const double arg_of_pericenter = pd.value(secname+"/ orbit_ArgOfPericenter").toDouble()*(M_PI/180.0); const double arg_of_pericenter = pd.value(secname+"/ orbit_ArgOfPericenter").toDouble()*(M_PI/180.0);
const double ascending_node = pd.value(secname+"/orb it_AscendingNode").toDouble()*(M_PI/180.0); const double ascending_node = pd.value(secname+"/orb it_AscendingNode").toDouble()*(M_PI/180.0);
const double parentRotObliquity = parent->getParent( ) ? parent->getRotObliquity() : 0.0; const double parentRotObliquity = parent->getParent( ) ? parent->getRotObliquity(2451545.0) : 0.0;
const double parent_rot_asc_node = parent->getParent () ? parent->getRotAscendingnode() : 0.0; const double parent_rot_asc_node = parent->getParent () ? parent->getRotAscendingnode() : 0.0;
double parent_rot_j2000_longitude = 0.0; double parent_rot_j2000_longitude = 0.0;
if (parent->getParent()) { if (parent->getParent()) {
const double c_obl = cos(parentRotObliquity); const double c_obl = cos(parentRotObliquity);
const double s_obl = sin(parentRotObliquity); const double s_obl = sin(parentRotObliquity);
const double c_nod = cos(parent_rot_asc_node); const double c_nod = cos(parent_rot_asc_node);
const double s_nod = sin(parent_rot_asc_node); const double s_nod = sin(parent_rot_asc_node);
const Vec3d OrbitAxi s0( c_nod, s_nod, 0.0); const Vec3d OrbitAxi s0( c_nod, s_nod, 0.0);
const Vec3d OrbitAxi s1(-s_nod*c_obl, c_nod*c_obl,s_obl); const Vec3d OrbitAxi s1(-s_nod*c_obl, c_nod*c_obl,s_obl);
const Vec3d OrbitPol e( s_nod*s_obl,-c_nod*s_obl,c_obl); const Vec3d OrbitPol e( s_nod*s_obl,-c_nod*s_obl,c_obl);
const Vec3d J2000Pol e(StelCore::matJ2000ToVsop87.multiplyWithoutTranslation(Vec3d(0,0,1))); const Vec3d J2000Pol e(StelCore::matJ2000ToVsop87.multiplyWithoutTranslation(Vec3d(0,0,1)));
Vec3d J2000NodeOrigi n(J2000Pole^OrbitPole); Vec3d J2000NodeOrigi n(J2000Pole^OrbitPole);
J2000NodeOrigin.norm alize(); J2000NodeOrigin.norm alize();
parent_rot_j2000_lon gitude = atan2(J2000NodeOrigin*OrbitAxis1,J2000NodeOrigin*OrbitAxis0); parent_rot_j2000_lon gitude = atan2(J2000NodeOrigin*OrbitAxis1,J2000NodeOrigin*OrbitAxis0);
} }
//qDebug() << "Creating CometOrbit for" << englishNa me;
CometOrbit *orb = new CometOrbit(pericenterDistance, CometOrbit *orb = new CometOrbit(pericenterDistance,
eccentricity, eccentricity,
inclination, inclination,
ascending_node, ascending_node,
arg_of_pericenter, arg_of_pericenter,
time_at_pericenter, time_at_pericenter,
orbitGoodDays,
meanMotion, meanMotion,
parentRotObliquity, parentRotObliquity,
parent_rot_asc_node , parent_rot_asc_node ,
parent_rot_j2000_lo ngitude); parent_rot_j2000_lo ngitude);
orbits.push_back(orb); orbits.push_back(orb);
userDataPtr = orb; userDataPtr = orb;
posfunc = &cometOrbitPosFunc; posfunc = &cometOrbitPosFunc;
} }
if (funcName=="sun_special") if (funcName=="sun_special")
skipping to change at line 710 skipping to change at line 723
if (posfunc==NULL) if (posfunc==NULL)
{ {
qWarning() << "ERROR : can't find posfunc " << funcN ame << " for " << englishName; qWarning() << "ERROR : can't find posfunc " << funcN ame << " for " << englishName;
exit(-1); exit(-1);
} }
// Create the Solar System body and add it to the list // Create the Solar System body and add it to the list
QString type = pd.value(secname+"/type").toString(); QString type = pd.value(secname+"/type").toString();
PlanetP p; PlanetP p;
// New class objects, named "plutoid", has properties simila // New class objects, named "plutoid", has properties simila
r asteroids and we should calculate their r to asteroids and we should calculate their
// positions like for asteroids. Plutoids having one excepti // positions like for asteroids. Plutoids have one exception
on - Pluto - we should use special : Pluto - we should use special
// function for calculation of orbit of Pluto. // function for calculation of orbit of Pluto.
if ((type == "asteroid" || type == "plutoid") && !englishNam e.contains("Pluto")) if ((type == "asteroid" || type == "plutoid") && !englishNam e.contains("Pluto"))
{ {
p = PlanetP(new MinorPlanet(englishName, p = PlanetP(new MinorPlanet(englishName,
pd.value(secname+"/lighting").toBool( pd.value(secname+"/light
), ing").toBool(),
pd.value(secname+"/radius").toDouble( pd.value(secname+"/radiu
)/AU, s").toDouble()/AU,
pd.value(secname+"/oblateness", 0.0). pd.value(secname+"/oblat
toDouble(), eness", 0.0).toDouble(),
StelUtils::strToVec3f(pd.value(secnam StelUtils::strToVec3f(pd
e+"/color").toString()), .value(secname+"/color").toString()),
pd.value(secname+"/albedo").toFloat() pd.value(secname+"/albed
, o").toFloat(),
pd.value(secname+"/tex_map").toString pd.value(secname+"/tex_m
(), ap").toString(),
posfunc, posfunc,
userDataPtr, userDataPtr,
osculatingFunc, osculatingFunc,
closeOrbit, closeOrbit,
pd.value(secname+"/hidden", 0).toBool pd.value(secname+"/hidde
(), n", 0).toBool(),
type)); type));
QSharedPointer<MinorPlanet> mp = p.dynamicCast<Mino rPlanet>(); QSharedPointer<MinorPlanet> mp = p.dynamicCast<Mino rPlanet>();
//Number //Number
int minorPlanetNumber = pd.value(secname+"/minor_pla net_number", 0).toInt(); int minorPlanetNumber = pd.value(secname+"/minor_pla net_number", 0).toInt();
if (minorPlanetNumber) if (minorPlanetNumber)
{ {
mp->setMinorPlanetNumber(minorPlanetNumber); mp->setMinorPlanetNumber(minorPlanetNumber);
} }
//Provisional designation //Provisional designation
QString provisionalDesignation = pd.value(secname+"/ provisional_designation").toString(); QString provisionalDesignation = pd.value(secname+"/ provisional_designation").toString();
if (!provisionalDesignation.isEmpty()) if (!provisionalDesignation.isEmpty())
{ {
mp->setProvisionalDesignation(provisionalDes ignation); mp->setProvisionalDesignation(provisionalDes ignation);
} }
skipping to change at line 777 skipping to change at line 789
pd.value(secname+"/lighting").toBool( ), pd.value(secname+"/lighting").toBool( ),
pd.value(secname+"/radius").toDouble( )/AU, pd.value(secname+"/radius").toDouble( )/AU,
pd.value(secname+"/oblateness", 0.0). toDouble(), pd.value(secname+"/oblateness", 0.0). toDouble(),
StelUtils::strToVec3f(pd.value(secnam e+"/color").toString()), StelUtils::strToVec3f(pd.value(secnam e+"/color").toString()),
pd.value(secname+"/albedo").toFloat() , pd.value(secname+"/albedo").toFloat() ,
pd.value(secname+"/tex_map").toString (), pd.value(secname+"/tex_map").toString (),
posfunc, posfunc,
userDataPtr, userDataPtr,
osculatingFunc, osculatingFunc,
closeOrbit, closeOrbit,
pd.value(secname+"/hidden", 0).toBool pd.value(secname+"/hidden
(), ", 0).toBool(),
type)); type,
pd.value(secname+"/dust_w
idthfactor", 1.5f).toFloat(),
pd.value(secname+"/dust_l
engthfactor", 0.4f).toFloat(),
pd.value(secname+"/dust_b
rightnessfactor", 1.5f).toFloat()
));
QSharedPointer<Comet> mp = p.dynamicCast<Comet>(); QSharedPointer<Comet> mp = p.dynamicCast<Comet>();
//g,k magnitude system //g,k magnitude system
double magnitude = pd.value(secname+"/absolute_magni tude", -99).toDouble(); double magnitude = pd.value(secname+"/absolute_magni tude", -99).toDouble();
double slope = pd.value(secname+"/slope_parameter", 4.0).toDouble(); double slope = pd.value(secname+"/slope_parameter", 4.0).toDouble();
if (magnitude > -99) if (magnitude > -99)
{ {
if (slope >= 0 && slope <= 20) if (slope >= 0 && slope <= 20)
{ {
skipping to change at line 802 skipping to change at line 818
{ {
mp->setAbsoluteMagnitudeAndSlope(mag nitude, 4.0); mp->setAbsoluteMagnitudeAndSlope(mag nitude, 4.0);
} }
} }
mp->setSemiMajorAxis(pd.value(secname+"/orbit_SemiMa jorAxis", 0).toDouble()); mp->setSemiMajorAxis(pd.value(secname+"/orbit_SemiMa jorAxis", 0).toDouble());
} }
else else
{ {
// Set possible default name of the normal map for a
voiding yin-yang shaped moon
// phase when normal map key not exists. Example: mo
on_normals.png
// Details: https://bugs.launchpad.net/stellarium/+b
ug/1335609
QString normalMapName = englishName.toLower().append
("_normals.png");
p = PlanetP(new Planet(englishName, p = PlanetP(new Planet(englishName,
pd.value(secname+"/lighting").toBool( pd.value(secname+"/lighting")
), .toBool(),
pd.value(secname+"/radius").toDouble( pd.value(secname+"/radius").t
)/AU, oDouble()/AU,
pd.value(secname+"/oblateness", 0.0). pd.value(secname+"/oblateness
toDouble(), ", 0.0).toDouble(),
StelUtils::strToVec3f(pd.value(secnam StelUtils::strToVec3f(pd.valu
e+"/color").toString()), e(secname+"/color").toString()),
pd.value(secname+"/albedo").toFloat() pd.value(secname+"/albedo").t
, oFloat(),
pd.value(secname+"/tex_map").toString pd.value(secname+"/tex_map").
(), toString(),
posfunc, pd.value(secname+"/normals_ma
userDataPtr, p", normalMapName).toString(),
osculatingFunc, posfunc,
closeOrbit, userDataPtr,
pd.value(secname+"/hidden", 0).toBool osculatingFunc,
(), closeOrbit,
pd.value(secname+"/atmosphere", false pd.value(secname+"/hidden", 0
).toBool(), ).toBool(),
type)); pd.value(secname+"/atmosphere
", false).toBool(),
pd.value(secname+"/halo", 0).
toBool(),
type));
} }
if (!parent.isNull()) if (!parent.isNull())
{ {
parent->satellites.append(p); parent->satellites.append(p);
p->parent = parent; p->parent = parent;
} }
if (secname=="earth") earth = p; if (secname=="earth") earth = p;
if (secname=="sun") sun = p; if (secname=="sun") sun = p;
if (secname=="moon") moon = p; if (secname=="moon") moon = p;
skipping to change at line 879 skipping to change at line 901
systemPlanets.push_back(p); systemPlanets.push_back(p);
readOk++; readOk++;
} }
if (systemPlanets.isEmpty()) if (systemPlanets.isEmpty())
{ {
qWarning() << "No Solar System objects loaded from" << QDir: :toNativeSeparators(filePath); qWarning() << "No Solar System objects loaded from" << QDir: :toNativeSeparators(filePath);
return false; return false;
} }
qDebug() << "Loaded" << readOk << "/" << totalPlanets << "planet orb // special case: load earth shadow texture
its from" << QDir::toNativeSeparators(filePath); Planet::texEarthShadow = StelApp::getInstance().getTextureManager().
createTexture(StelFileMgr::getInstallationDir()+"/textures/earth-shadow.png
");
return true; return true;
} }
// Compute the position for every elements of the solar system. // Compute the position for every elements of the solar system.
// The order is not important since the position is computed relatively to the mother body // The order is not important since the position is computed relatively to the mother body
void SolarSystem::computePositions(double date, const Vec3d& observerPos) void SolarSystem::computePositions(double date, const Vec3d& observerPos)
{ {
if (flagLightTravelTime) if (flagLightTravelTime)
{ {
foreach (PlanetP p, systemPlanets) foreach (PlanetP p, systemPlanets)
skipping to change at line 939 skipping to change at line 963
// And sort them from the furthest to the closest to the observer // And sort them from the furthest to the closest to the observer
struct biggerDistance : public std::binary_function<PlanetP, PlanetP, bool> struct biggerDistance : public std::binary_function<PlanetP, PlanetP, bool>
{ {
bool operator()(PlanetP p1, PlanetP p2) bool operator()(PlanetP p1, PlanetP p2)
{ {
return p1->getDistance() > p2->getDistance(); return p1->getDistance() > p2->getDistance();
} }
}; };
StelTextureNew* SolarSystem::computeShadowInfo(StelRenderer* renderer)
{
// Acquire shadow informations
if(shadowModelMatricesBuffer.size() < shadowPlanetCount)
{
shadowModelMatricesBuffer.resize(shadowPlanetCount);
}
Mat4d* modelMatrices = shadowModelMatricesBuffer.data();
int p = 1;
foreach (const PlanetP& planet, systemPlanets)
{
if(planet->parent != sun || !planet->satellites.isEmpty())
{
planet->computeModelMatrix(modelMatrices[planet == s
un ? 0 : p++]);
}
}
const int size = StelUtils::smallestPowerOfTwoGreaterOrEqualTo(shado
wPlanetCount);
if(shadowInfoBuffer.size() < size * size)
{
shadowInfoBuffer.resize(size * size);
}
// Shadow info texture data
Vec4f* data = shadowInfoBuffer.data();
memset(data, '\0', size * size * sizeof(Vec4f));
int y = 1;
foreach (const PlanetP& target, systemPlanets)
{
if(target == sun || (target->parent == sun && target->satell
ites.isEmpty()))
continue;
const Mat4d mTarget = modelMatrices[y].inverse();
data[y * size] = Vec4f(mTarget[12], mTarget[13], mTarget[14]
, sun->getRadius());
int x = 1;
foreach (const PlanetP& source, systemPlanets)
{
if(source == sun || (source->parent == sun && source
->satellites.isEmpty()))
continue;
const Mat4d& mSource(modelMatrices[x]);
const Vec4d position = mTarget * mSource.getColumn(3
);
data[y * size + x] = Vec4f(position[0], position[1],
position[2], source->getRadius());
x++;
}
y++;
}
return renderer->createTexture(data, QSize(size, size), TextureDataF
ormat_RGBA_F32,
TextureParams().filtering(TextureFilt
ering_Nearest));
}
// Draw all the elements of the solar system // Draw all the elements of the solar system
// We are supposed to be in heliocentric coordinate // We are supposed to be in heliocentric coordinate
void SolarSystem::draw(StelCore* core, class StelRenderer* renderer) void SolarSystem::draw(StelCore* core)
{ {
if (!flagShow) if (!flagShow)
return; return;
// Compute each Planet distance to the observer // Compute each Planet distance to the observer
Vec3d obsHelioPos = core->getObserverHeliocentricEclipticPos(); Vec3d obsHelioPos = core->getObserverHeliocentricEclipticPos();
foreach (PlanetP p, systemPlanets) foreach (PlanetP p, systemPlanets)
{ {
p->computeDistance(obsHelioPos); p->computeDistance(obsHelioPos);
} }
// And sort them from the furthest to the closest // And sort them from the furthest to the closest
sort(systemPlanets.begin(),systemPlanets.end(),biggerDistance()); sort(systemPlanets.begin(),systemPlanets.end(),biggerDistance());
if (trailFader.getInterstate()>0.0000001f) if (trailFader.getInterstate()>0.0000001f)
{ {
StelPainter* sPainter = new StelPainter(core->getProjection2 d());
allTrails->setOpacity(trailFader.getInterstate()); allTrails->setOpacity(trailFader.getInterstate());
allTrails->draw(core, renderer); allTrails->draw(core, sPainter);
delete sPainter;
} }
// Make some voodoo to determine when labels should be displayed // Make some voodoo to determine when labels should be displayed
float maxMagLabel = (core->getSkyDrawer()->getLimitMagnitude()<5.f ? core->getSkyDrawer()->getLimitMagnitude() : float maxMagLabel = (core->getSkyDrawer()->getLimitMagnitude()<5.f ? core->getSkyDrawer()->getLimitMagnitude() :
5.f+(core->getSkyDrawer()->getLimitMagnitude()-5.f)* 1.2f) +(labelsAmount-3.f)*1.2f; 5.f+(core->getSkyDrawer()->getLimitMagnitude()-5.f)* 1.2f) +(labelsAmount-3.f)*1.2f;
sharedPlanetGraphics.lazyInit(renderer); // Draw the elements
foreach (const PlanetP& p, systemPlanets)
if(StelApp::getInstance().getRenderSolarShadows() && sharedPlanetGra
phics.shadowPlanetShader && renderer->areFloatTexturesSupported())
{
StelTextureNew* shadowInfo = computeShadowInfo(renderer);
sharedPlanetGraphics.planetShader = sharedPlanetGraphics.sha
dowPlanetShader;
sharedPlanetGraphics.info.info = 1;
sharedPlanetGraphics.info.infoCount = shadowPlanetCount;
const QSize size = shadowInfo->getDimensions();
Q_ASSERT_X(size.width() == size.height(), Q_FUNC_INFO,
"Shadow info texture is not square");
sharedPlanetGraphics.info.infoSize = size.width();
shadowInfo->bind(1);
// Draw the elements
int i = 1;
foreach (const PlanetP& p, systemPlanets)
{
if((p == sun || (p->parent == sun && p->satellites.i
sEmpty())) && sharedPlanetGraphics.planetShader == sharedPlanetGraphics.sha
dowPlanetShader)
{
sharedPlanetGraphics.info.current = 0;
sharedPlanetGraphics.planetShader = sharedPl
anetGraphics.simplePlanetShader;
p->draw(core, renderer, maxMagLabel, planetN
ameFont, sharedPlanetGraphics);
sharedPlanetGraphics.planetShader = sharedPl
anetGraphics.shadowPlanetShader;
}
else
{
sharedPlanetGraphics.info.current = i;
p->draw(core, renderer, maxMagLabel, planetN
ameFont, sharedPlanetGraphics);
i++;
}
}
delete shadowInfo;
}
else
{ {
sharedPlanetGraphics.planetShader = sharedPlanetGraphics.sim p->draw(core, maxMagLabel, planetNameFont);
plePlanetShader;
// Draw the elements
foreach (const PlanetP& p, systemPlanets)
{
p->draw(core, renderer, maxMagLabel, planetNameFont,
sharedPlanetGraphics);
}
} }
if (GETSTELMODULE(StelObjectMgr)->getFlagSelectedObjectPointer()) if (GETSTELMODULE(StelObjectMgr)->getFlagSelectedObjectPointer() &&
drawPointer(core, renderer); getFlagMarkers())
drawPointer(core);
} }
void SolarSystem::setStelStyle(const QString& section) void SolarSystem::setStelStyle(const QString& section)
{ {
// Load colors from config file // Load colors from config file
QSettings* conf = StelApp::getInstance().getSettings(); QSettings* conf = StelApp::getInstance().getSettings();
QString defaultColor = conf->value(section+"/default_color").toStrin g(); QString defaultColor = conf->value(section+"/default_color").toStrin g();
setLabelsColor(StelUtils::strToVec3f(conf->value(section+"/planet_na mes_color", defaultColor).toString())); setLabelsColor(StelUtils::strToVec3f(conf->value(section+"/planet_na mes_color", defaultColor).toString()));
setOrbitsColor(StelUtils::strToVec3f(conf->value(section+"/planet_or bits_color", defaultColor).toString())); setOrbitsColor(StelUtils::strToVec3f(conf->value(section+"/planet_or bits_color", defaultColor).toString()));
setTrailsColor(StelUtils::strToVec3f(conf->value(section+"/object_tr ails_color", defaultColor).toString())); setTrailsColor(StelUtils::strToVec3f(conf->value(section+"/object_tr ails_color", defaultColor).toString()));
setPointersColor(StelUtils::strToVec3f(conf->value(section+"/planet_ pointers_color", "1.0,0.3,0.3").toString()));
// Recreate the trails to apply new colors // Recreate the trails to apply new colors
recreateTrails(); recreateTrails();
} }
PlanetP SolarSystem::searchByEnglishName(QString planetEnglishName) const PlanetP SolarSystem::searchByEnglishName(QString planetEnglishName) const
{ {
foreach (const PlanetP& p, systemPlanets) foreach (const PlanetP& p, systemPlanets)
{ {
if (p->getEnglishName() == planetEnglishName) if (p->getEnglishName() == planetEnglishName)
skipping to change at line 1123 skipping to change at line 1047
StelObjectP SolarSystem::searchByName(const QString& name) const StelObjectP SolarSystem::searchByName(const QString& name) const
{ {
foreach (const PlanetP& p, systemPlanets) foreach (const PlanetP& p, systemPlanets)
{ {
if (p->getEnglishName() == name) if (p->getEnglishName() == name)
return qSharedPointerCast<StelObject>(p); return qSharedPointerCast<StelObject>(p);
} }
return StelObjectP(); return StelObjectP();
} }
float SolarSystem::getPlanetVMagnitude(QString planetName, bool withExtinct ion) const float SolarSystem::getPlanetVMagnitude(QString planetName) const
{ {
PlanetP p = searchByEnglishName(planetName); PlanetP p = searchByEnglishName(planetName);
float r = 0.f; float r = 0.f;
r = p->getVMagnitude(StelApp::getInstance().getCore(), withExtinctio n); r = p->getVMagnitude(StelApp::getInstance().getCore());
return r; return r;
} }
double SolarSystem::getDistanceToPlanet(QString planetName) const double SolarSystem::getDistanceToPlanet(QString planetName) const
{ {
PlanetP p = searchByEnglishName(planetName); PlanetP p = searchByEnglishName(planetName);
double r = 0.f; double r = 0.f;
r = p->getDistance(); r = p->getDistance();
return r; return r;
} }
skipping to change at line 1221 skipping to change at line 1145
{ {
result.append(qSharedPointerCast<StelObject>(p)); result.append(qSharedPointerCast<StelObject>(p));
} }
} }
return result; return result;
} }
// Update i18 names from english names according to current translator // Update i18 names from english names according to current translator
void SolarSystem::updateI18n() void SolarSystem::updateI18n()
{ {
StelTranslator& trans = StelApp::getInstance().getLocaleMgr().getApp StelTranslator(); const StelTranslator& trans = StelApp::getInstance().getLocaleMgr(). getAppStelTranslator();
foreach (PlanetP p, systemPlanets) foreach (PlanetP p, systemPlanets)
p->translateName(trans); p->translateName(trans);
} }
QString SolarSystem::getPlanetHashString(void) QString SolarSystem::getPlanetHashString(void)
{ {
QString str; QString str;
QTextStream oss(&str); QTextStream oss(&str);
foreach (const PlanetP& p, systemPlanets) foreach (const PlanetP& p, systemPlanets)
{ {
skipping to change at line 1484 skipping to change at line 1408
// Set/Get if Moon display is scaled // Set/Get if Moon display is scaled
void SolarSystem::setFlagMoonScale(bool b) void SolarSystem::setFlagMoonScale(bool b)
{ {
if (!b) getMoon()->setSphereScale(1); if (!b) getMoon()->setSphereScale(1);
else getMoon()->setSphereScale(moonScale); else getMoon()->setSphereScale(moonScale);
flagMoonScale = b; flagMoonScale = b;
} }
// Set/Get Moon display scaling factor // Set/Get Moon display scaling factor
void SolarSystem::setMoonScale(float f) void SolarSystem::setMoonScale(double f)
{ {
moonScale = f; moonScale = f;
if (flagMoonScale) if (flagMoonScale)
getMoon()->setSphereScale(moonScale); getMoon()->setSphereScale(moonScale);
} }
// Set selected planets by englishName // Set selected planets by englishName
void SolarSystem::setSelected(const QString& englishName) void SolarSystem::setSelected(const QString& englishName)
{ {
setSelected(searchByEnglishName(englishName)); setSelected(searchByEnglishName(englishName));
skipping to change at line 1541 skipping to change at line 1465
foreach (Orbit* orb, orbits) foreach (Orbit* orb, orbits)
{ {
delete orb; delete orb;
orb = NULL; orb = NULL;
} }
orbits.clear(); orbits.clear();
sun.clear(); sun.clear();
moon.clear(); moon.clear();
earth.clear(); earth.clear();
Planet::texEarthShadow.clear(); //Loaded in loadPlanets()
delete allTrails; delete allTrails;
allTrails = NULL; allTrails = NULL;
foreach (PlanetP p, systemPlanets) foreach (PlanetP p, systemPlanets)
{ {
p->satellites.clear(); p->satellites.clear();
p.clear(); p.clear();
} }
systemPlanets.clear(); systemPlanets.clear();
skipping to change at line 1573 skipping to change at line 1498
setFlagMoonScale(flagScaleMoon); setFlagMoonScale(flagScaleMoon);
setMoonScale(moonScale); setMoonScale(moonScale);
setFlagPlanets(flagPlanets); setFlagPlanets(flagPlanets);
setFlagHints(flagHints); setFlagHints(flagHints);
setFlagLabels(flagLabels); setFlagLabels(flagLabels);
setFlagOrbits(flagOrbits); setFlagOrbits(flagOrbits);
// Restore translations // Restore translations
updateI18n(); updateI18n();
} }
double SolarSystem::getEclipseFactor(const StelCore* core) const
{
Vec3d Lp = sun->getEclipticPos();
Vec3d P3 = core->getObserverHeliocentricEclipticPos();
const double RS = sun->getRadius();
double final_illumination = 1.0;
foreach (const PlanetP& planet, systemPlanets)
{
if(planet == sun || planet == core->getCurrentPlanet())
continue;
Mat4d trans;
planet->computeModelMatrix(trans);
const Vec3d C = trans * Vec3d(0, 0, 0);
const double radius = planet->getRadius();
Vec3d v1 = Lp - P3;
Vec3d v2 = C - P3;
const double L = v1.length();
const double l = v2.length();
v1 = v1 / L;
v2 = v2 / l;
const double R = RS / L;
const double r = radius / l;
const double d = ( v1 - v2 ).length();
/*double L = (Lp - P3).length();
double l = (C - P3).length();
double R = RS / L;
double r = radius / l;
double d = ( (Lp - P3) / L - (C - P3) / l ).length();*/
if(planet->englishName == "Moon")
{
v1 = planet->getHeliocentricEclipticPos();
//C = planet->getHeliocentricEclipticPos();
}
double illumination;
// distance too far
if(d >= R + r)
{
illumination = 1.0;
}
// umbra
else if(r >= R + d)
{
illumination = 0.0;
}
// penumbra completely inside
else if(d + r <= R)
{
illumination = 1.0 - r * r / (R * R);
}
// penumbra partially inside
else
{
const double x = (R * R + d * d - r * r) / (2.0 * d)
;
const double alpha = std::acos(x / R);
const double beta = std::acos((d - x) / r);
const double AR = R * R * (alpha - 0.5 * std::sin(2.
0 * alpha));
const double Ar = r * r * (beta - 0.5 * std::sin(2.0
* beta));
const double AS = R * R * 2.0 * std::asin(1.0);
illumination = 1.0 - (AR + Ar) / AS;
}
if(illumination < final_illumination)
final_illumination = illumination;
}
return final_illumination;
}
 End of changes. 54 change blocks. 
238 lines changed or deleted 165 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/