GSoC/GCI Archive
Google Code-in 2013 KDE

Marble: Add Moon pixmap to the stars plugin and take the Marble clock into account

completed by: Illya Kovalevskyy

mentors: Torsten Rahn, Dennis Nienhüser, René Küttner

Currently in

https://git.reviewboard.kde.org/r/114680/

the sun pixmap is used to render the moon. Instead

http://byte.kde.org/~tackat/moon.png

should be used. This pixmap needs to get properly rotated and scaled however.

A first approximation of the rotation angle would be:

angle = marbleModel()->planet()->epsilon() * cos( ra_moon )

Add a comment to the code that this calculation does not take the 5 degree inclination of the moon orbit into account. (so the maximum error of this angle is about 10 degrees off)

It needs to be tested whether this angle needs to be applied clockwise or counterclockwise. Check KStars or Stellarium to find out - or use a map from the internet.

In order to get a matching scaling value please use  SolarSystem::getDiamMoon () from the astrolib and use this formula:

width = skyRadius * sin( diamMoon );

height = width;

The pixmap should get scaled accordingly.

In the future we will rotate the moon pixmap a bit before it gets scaled. Please take this into account for the implementation.

Also currently the position of the moon is drawn according to the system time. This is wrong since Marble has its own MarbleClock. Synchronize the calculation with the Marble Clock using

SolarSysstem::setCurrentMJD(int year, int month, int day, int hour, int min, double sec)

Also take note of void SolarSystem::setTimezone(double d)

Test the moon position for different dates set inside Marble and compare to KStars or maps on the internet.

In the next follow-up task the lunar phase is added.