Merge lp:~georg-zotti/stellarium/gz_fix-ecliptic-obliquity into lp:stellarium

Proposed by gzotti
Status: Merged
Approved by: Alexander Wolf
Approved revision: 7625
Merged at revision: 7748
Proposed branch: lp:~georg-zotti/stellarium/gz_fix-ecliptic-obliquity
Merge into: lp:stellarium
Diff against target: 2869 lines (+1419/-206)
28 files modified
README (+5/-1)
data/default_config.ini.cmake (+22/-6)
src/CMakeLists.txt (+19/-0)
src/core/StelCore.cpp (+82/-15)
src/core/StelCore.hpp (+61/-36)
src/core/StelObject.cpp (+39/-19)
src/core/StelObject.hpp (+12/-2)
src/core/StelObserver.cpp (+28/-2)
src/core/VecMath.hpp (+42/-2)
src/core/modules/GridLinesMgr.cpp (+273/-24)
src/core/modules/GridLinesMgr.hpp (+140/-17)
src/core/modules/Landscape.cpp (+6/-0)
src/core/modules/Planet.cpp (+62/-18)
src/core/modules/Planet.hpp (+9/-3)
src/core/modules/SolarSystem.cpp (+4/-0)
src/core/planetsephems/elp82b.h (+1/-1)
src/core/planetsephems/gust86.c (+1/-1)
src/core/planetsephems/gust86.h (+3/-3)
src/core/planetsephems/precession.c (+260/-0)
src/core/planetsephems/precession.h (+59/-0)
src/core/planetsephems/sidereal_time.c (+35/-20)
src/core/planetsephems/vsop87.h (+1/-1)
src/gui/ConfigurationDialog.cpp (+4/-1)
src/gui/LocationDialog.cpp (+1/-1)
src/gui/ViewDialog.cpp (+5/-1)
src/gui/viewDialog.ui (+89/-32)
src/tests/testPrecession.cpp (+121/-0)
src/tests/testPrecession.hpp (+35/-0)
To merge this branch: bzr merge lp:~georg-zotti/stellarium/gz_fix-ecliptic-obliquity
Reviewer Review Type Date Requested Status
Alexander Wolf Approve
gzotti Needs Resubmitting
Review via email: mp+265992@code.launchpad.net

Description of the change

This brings an important change in accuracy, fixing several questions about accuracy of simulation in antiquity. Please see branch description for details.

There are a few issues to be fixed as discussed in the last few weeks. Precession (coming here), deltaT once again (I suggest doing this next) and Nutation (IAU-2000A should replace the currently used old model from the 1980s). Accuracy gains/testing against solutions known to be accurate) is best done in this sequence. I left a few remarks and TODO notes in the code in places that should soon be fixed (IMHO these are things that should be done before 0.14 is prepared).

To post a comment you must log in.
7615. By gzotti

Added reference to README. A few docfixes and removed some excess comments.

Revision history for this message
Alexander Wolf (alexwolf) wrote :

Georg, are you can add unit tests for this feature? It should be helpful for checking accuracy and checking for correct for the code.

review: Needs Information
Revision history for this message
Alexander Wolf (alexwolf) wrote :

Oh! One important note - pole precision line is not a circle, it's spirale. Current implementation can confuse many peoples. I think this line may be implemented as line with some range of the dates, like orbits in Satellites plugin.

review: Needs Information
Revision history for this message
Alexander Wolf (alexwolf) wrote :

Revision 7610 contains the code:

oss << q_("Ecliptic obliquity (of date): %1").arg(StelUtils::radToDmsStr(ecl, true)) << "<br>";

which will be displayed when any object is selected.

But (!):
1) this line give info about current planet, where observer is located, not about the selected object!
2) Ecliptic obliquity for Sun is not have physical sense.

Revision history for this message
Alexander Wolf (alexwolf) wrote :

Revision 7612: I think short keys for add/subtract Julian century should be added. :)

Revision history for this message
Alexander Wolf (alexwolf) wrote :

Revision 7613: same problem as in revision 7610 - the planetocentric distance shows info not for the selected planet, what will be confused users.

Revision history for this message
Alexander Wolf (alexwolf) wrote :

I'm sorry, but notes from my last 3 comments should be fixed IMHO.

review: Needs Fixing
Revision history for this message
gzotti (georg-zotti) wrote :

> Revision 7610 contains the code:
>
> oss << q_("Ecliptic obliquity (of date): %1").arg(StelUtils::radToDmsStr(ecl,
> true)) << "<br>";
>
> which will be displayed when any object is selected.
>
> But (!):
> 1) this line give info about current planet, where observer is located, not
> about the selected object!
> 2) Ecliptic obliquity for Sun is not have physical sense.

"Ecliptic" is only Earth's orbital plane, there is no source or reason for confusion. But given the fact that we also don't show ecliptical grid of date if located on other planets, I will change to not show it if location is not on Earth.

Revision history for this message
gzotti (georg-zotti) wrote :

> Revision 7612: I think short keys for add/subtract Julian century should be
> added. :)

Yes, only in comparing the merge submission I have seen that Sidereal Year has vanished (?)
I would even like to have Sidereal, Tropical, Julian, and Anomalistic year! But I am easily running out of hotkeys! Whatever time jumps we decide upon for 0.14 I think we can add them just before release.

Revision history for this message
Alexander Wolf (alexwolf) wrote :

>"Ecliptic" is only Earth's orbital plane, there is no source or reason for confusion. But given the fact that we also don't show ecliptical grid of date if located on other planets, I will change to not show it if location is not on Earth.

Why? When we say "ecliptic" then we saying about Earth, it's typical, but other planets has "path of the Sun" too and other planet has ecliptic too ;)

Revision history for this message
Alexander Wolf (alexwolf) wrote :

> Yes, only in comparing the merge submission I have seen that Sidereal Year has vanished (?)

No, it exists. (Hint: http://bazaar.launchpad.net/~stellarium/stellarium/trunk/revision/7734)

> I would even like to have Sidereal, Tropical, Julian, and Anomalistic year! But I am easily running out of hotkeys! Whatever time jumps we decide upon for 0.14 I think we can add them just before release.

What about filling feature request, because we can forget it?

Revision history for this message
Alexander Wolf (alexwolf) wrote :

Oops... Why "Ecliptic obliquity (of date)" string are ignores the option of settings for decimal format displaying? :)

Revision history for this message
Alexander Wolf (alexwolf) wrote :

Georg, please ignore my comment about precession :)

Revision history for this message
gzotti (georg-zotti) wrote :

> Revision 7613: same problem as in revision 7610 - the planetocentric distance
> shows info not for the selected planet, what will be confused users.

Oh yes, it does. It should display how many km observer is located away from his planet's center.

But ... argh - something is wrong for off-earth sites. Must fix that, sure. (Last-minute thing I wanted to put in here, only tested for Earth. *-(

Revision history for this message
gzotti (georg-zotti) wrote :

> >"Ecliptic" is only Earth's orbital plane, there is no source or reason for
> confusion. But given the fact that we also don't show ecliptical grid of date
> if located on other planets, I will change to not show it if location is not
> on Earth.
>
> Why? When we say "ecliptic" then we saying about Earth, it's typical, but
> other planets has "path of the Sun" too and other planet has ecliptic too ;)

No, "The Ecliptic" is specifically the projection of Earth's instantaneous orbital plane onto the celestial sphere, appearing as great circle.

Other planets' orbital planes are just called "orbital planes", and Stellarium so far never made an attempt to show other planets' orbital planes (although it would certainly be nice for astronaut training...). "Ecliptic" is particularly Earth-related, like "The Moon" is only our Earth's moon.

There is apparently some widespread idea that Earth's orbital plane is stable in VSOP coordinates. It is not the case, as we can see here and now! VSOP has the J2000.0 ecliptical plane as their XY-plane, which Stellarium can show as "Ecliptic of J2000.0". But Earth's orbit is wandering around a bit, which is called the Precession of the Ecliptic (Earlier name: "planetary precession", but in the post-2000 literature authors preferred "Precession of the Ecliptic").

Revision history for this message
gzotti (georg-zotti) wrote :

> Oops... Why "Ecliptic obliquity (of date)" string are ignores the option of
> settings for decimal format displaying? :)

fixed in r7616, thanks.

Revision history for this message
gzotti (georg-zotti) wrote :

> Oh! One important note - pole precision line is not a circle, it's spirale.
> Current implementation can confuse many peoples. I think this line may be
> implemented as line with some range of the dates, like orbits in Satellites
> plugin.

Yes it's a spiral. But what I show here is the "instantaneous circle" which at least visualizes the concept. Avid observers will note that stars orbiting the instantaneous pole of ecliptic of date next to this circle will intersect the circle, and that Polaris will have a different polar distance next time it is pole star. I think this is perfectly enough as visualisation for now.

When the feature request "orbit with labeled date marks" has been implemented, maybe someone can also implement the spiral with date labels then?

In these time ranges (tens of thousands of years) it's sad to see that VSOP87 only covers less than 1/2 cycle... But I have never seen the answer to "what happens outside -4000...+8000" as clearly.

DE431 should show a bit more than 1 cycle, at least.

Revision history for this message
gzotti (georg-zotti) wrote :

> Georg, please ignore my comment about precession :)

I hope you mean ignoring the spiral request? I have no plan to implement any spiral path before December (if at all), there are really more urgent things (e.g. moon rotation!) and I do also not have infinite time, sorry.

Revision history for this message
gzotti (georg-zotti) wrote :

> > Revision 7613: same problem as in revision 7610 - the planetocentric
> distance
> > shows info not for the selected planet, what will be confused users.
>
> Oh yes, it does. It should display how many km observer is located away from
> his planet's center.
>
> But ... argh - something is wrong for off-earth sites. Must fix that, sure.
> (Last-minute thing I wanted to put in here, only tested for Earth. *-(

OK, fixed that in r7617.

This value may actually only be useful while testing. Again, it does not give distance to observed object, but to the center of the planet you are standing on. (Needed for topocentric correction, which used purely-spherical planets until now.)

7616. By gzotti

show ecliptic obliquity also with non-decimal string

7617. By gzotti

ensure getDistanceFromCenter() does not cause problems while observing from SpaceShipObserver

Revision history for this message
Alexander Wolf (alexwolf) wrote :

OK, I think ecliptic obliquity and XYZ should display for Earth only and she should not mixed with other data for the chosen planets. What think about adding "For Earth:" line after info (after the one empty line) and put ecliptic obliquity and XYZ data after it.

The question for info with the planetocentric distance is more difficult here, because this infobox should not mixed with data about chosen planet too. But this data available for all planets in general. I think I can propose compromise for visualization of this data - add the planetocentric distance info as tooltip for height data on bottom toolbar.

Revision history for this message
Alexander Wolf (alexwolf) wrote :

I guess we can open question about implementation rendering line of precession after introducing DE4x parts.

7618. By gzotti

added unit tests (themselves untested, TBD on other platform)

7619. By gzotti

added test case files

7620. By gzotti

commented away XYZ and planetocentric observer coordinates

7621. By gzotti

harmonized visible (grid) and displayed ecliptical coordinates for non-earth locations. We cannot compute orbit-related coordinates for other planets yet :-(

Revision history for this message
gzotti (georg-zotti) wrote :

> OK, I think ecliptic obliquity and XYZ should display for Earth only and she
> should not mixed with other data for the chosen planets. What think about
> adding "For Earth:" line after info (after the one empty line) and put
> ecliptic obliquity and XYZ data after it.

Given that nobody outside our development team thinks that "Ecliptic" does not refer to the Earth only, I see no need to annotate "Ecliptic" with "Earth".

By the way, the "ecliptical coordinates" in the infostring are totally nonsense for observer locations outside earth. You would have to first find orbital plane for the planet, and then the "spring point" (ascending node between orbital plane and planet equator). The situation found here were in principle terrestrial ecliptical coordinates with different obliquity, that's nonsense. I now have changed this, for non-terrestrial observers, to

*) show "ecliptical coordinates J2000" referring to earth's orbital plane of J2000.
   The displayed coordinates fit to the displayed ecliptical grid of J2000.
*) Disable display of ecliptical coordinates of date because they were wrong.
*) Disable display of "Ecliptic obliquity" for non-earth observers to avoid confusion.

If we want to display "axis inclination to planet's orbit" or (90-Planet.getRotObliquity(JDE)), this may be a nice extra information.

Also XYZ is mostly here for testing, but it should show selected object's position in "parentocentric" XYZ coordinates (i.e., for moons we have the respective planets as zero). I have commented it away for your comfort. Please do not delete the lines, though, I think it can be helpful when integrating DE431 which have to be rotated into VSOP87 reference frame.

> The question for info with the planetocentric distance is more difficult here,
> because this infobox should not mixed with data about chosen planet too. But
> this data available for all planets in general. I think I can propose
> compromise for visualization of this data - add the planetocentric distance
> info as tooltip for height data on bottom toolbar.

Also here I just wanted a quick view while I move latitude with the location panel open, and not just qDebug() lines in the logfile. The current location was admittedly not good, but this is an intermediate state, not polished. If you can make a tooltip from that, it's fine.

r7621 has the latest changes. I now move to Linux for testing the unit test...

7622. By gzotti

avoid debug print also in "regular" debug builds.

7623. By gzotti

added toString() functions for matrices. Clarified (unused) upper3x3().

7624. By gzotti

First unit test for precession complete.

7625. By gzotti

added another test

Revision history for this message
gzotti (georg-zotti) wrote :

> Georg, are you can add unit tests for this feature? It should be helpful for
> checking accuracy and checking for correct for the code.

Alright, a few unit tests against the numerical example given in the paper are completed (r7625). There was even a minus missing in the (otherwise unused) reference solution :-P
Not sure about how the unit tests are used in an automatic workflow, are debug messages allowed? I leave them in but commented away, for further development.

Alex, I hope this completes the package of your requests. This branch does not care for other planets' orbital planes which were never properly handled by now, only applications in terrestrial history will see a benefit.

Again, this is Step 1 of 3 to be done in the next few weeks to solve several critical questions by historically inclined audience. #2 shall be correct application of DeltaT, and #3 shall bring in Nutation with the IAU-2000A model fitting to the 2006 precession of which this Vondrak model is a compatible, extended version.

Anything missing?

review: Needs Resubmitting
Revision history for this message
Alexander Wolf (alexwolf) wrote :

>Not sure about how the unit tests are used in an automatic workflow, are debug messages allowed?

No.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'README'
--- README 2015-03-23 00:02:31 +0000
+++ README 2015-07-28 19:18:20 +0000
@@ -207,6 +207,10 @@
207 [19] "Astronomy on the Personal Computer" by O. Montenbruck & T. Pfleger (4nd ed., 2000)207 [19] "Astronomy on the Personal Computer" by O. Montenbruck & T. Pfleger (4nd ed., 2000)
208 [20] "Calendrical Calculations" by E. M. Reingold & N. Dershowitz (2nd ed., 2001)208 [20] "Calendrical Calculations" by E. M. Reingold & N. Dershowitz (2nd ed., 2001)
209 [21] DeltaT webpage by V. Reijs: http://www.iol.ie/~geniet/eng/DeltaTeval.htm209 [21] DeltaT webpage by V. Reijs: http://www.iol.ie/~geniet/eng/DeltaTeval.htm
210 1.5 An accurate long-time precession model compatible with P03:
211 J. Vondrak, N. Capitaine, P. Wallace: New precession expressions, valid for long time intervals.
212 Astronomy&Astrophysics 534, A22 (2011); DOI: 10.1051/0004-6361/201117274
213
210214
2112. Included source code2152. Included source code
212 2.1 Some computation of the sideral time (sidereal_time.h/c) and pluto216 2.1 Some computation of the sideral time (sidereal_time.h/c) and pluto
@@ -252,7 +256,7 @@
252 -) compute nr_of_measurements = the number of valid b,v,r values256 -) compute nr_of_measurements = the number of valid b,v,r values
253 -) throw away or keep stars (depending on magnitude,257 -) throw away or keep stars (depending on magnitude,
254 nr_of_measurements, combination of flags, tycho2 number)258 nr_of_measurements, combination of flags, tycho2 number)
255 -) add all stars from hiparcos (incl. component solutions), and259 -) add all stars from Hipparcos (incl. component solutions), and
256 tycho2+1st supplement260 tycho2+1st supplement
257 -) reorganize the stars in several brigthness levels and261 -) reorganize the stars in several brigthness levels and
258 triangular zones according to position and magnitude262 triangular zones according to position and magnitude
259263
=== modified file 'data/default_config.ini.cmake'
--- data/default_config.ini.cmake 2015-06-19 18:02:55 +0000
+++ data/default_config.ini.cmake 2015-07-28 19:18:20 +0000
@@ -113,7 +113,6 @@
113#base_font_name = DejaVu Sans113#base_font_name = DejaVu Sans
114mouse_cursor_timeout = 10114mouse_cursor_timeout = 10
115flag_mouse_cursor_timeout = false115flag_mouse_cursor_timeout = false
116day_key_mode = calendar
117selected_object_info = all116selected_object_info = all
118auto_hide_horizontal_toolbar = true117auto_hide_horizontal_toolbar = true
119auto_hide_vertical_toolbar = true118auto_hide_vertical_toolbar = true
@@ -124,13 +123,27 @@
124gui_base_color = 0.5,0.5,0.7123gui_base_color = 0.5,0.5,0.7
125gui_text_color = 0.8,0.9,0.9124gui_text_color = 0.8,0.9,0.9
126azimuthal_color = 0.3,0.2,0.1125azimuthal_color = 0.3,0.2,0.1
127equatorial_color = 0.1,0.2,0.3126daylight_text_color = 0.0,0.0,0.0
128equatorial_J2000_color = 0.1,0.3,0.4127#
128#equatorial_color = 0.1,0.2,0.3
129#equatorial_J2000_color = 0.1,0.3,0.4
130#equator_color = 0.2,0.2,0.6
131#ecliptic_color = 0.6,0.2,0.2
132#ecliptic_J2000_color = 0.3,0.3,0.1
133# GZ instead: Note -al colors go to the grids.
134ecliptic_J2000_color = 0.7,0.2,0.2
135ecliptic_color = 0.9,0.6,0.2
136ecliptical_J2000_color = 0.4,0.1,0.1
137ecliptical_color = 0.6,0.3,0.1
138# default: same as ecliptic_color
139precession_circle_color = 0.9,0.6,0.2
140equator_J2000_color = 0.2,0.2,0.6
141equator_color = 0.3,0.5,1.0
142equatorial_J2000_color = 0.1,0.1,0.5
143equatorial_color = 0.2,0.3,0.8
144#
129galactic_color = 0.0,0.3,0.2145galactic_color = 0.0,0.3,0.2
130galactic_equator_color = 0.5,0.3,0.1146galactic_equator_color = 0.5,0.3,0.1
131equator_color = 0.2,0.2,0.6
132ecliptic_color = 0.6,0.2,0.2
133ecliptic_J2000_color = 0.3,0.3,0.1
134meridian_color = 0.2,0.6,0.2147meridian_color = 0.2,0.6,0.2
135longitude_color = 0.2,0.4,0.4148longitude_color = 0.2,0.4,0.4
136horizon_color = 0.2,0.6,0.2149horizon_color = 0.2,0.6,0.2
@@ -207,11 +220,14 @@
207flag_azimuthal_grid = false220flag_azimuthal_grid = false
208flag_equatorial_grid = false221flag_equatorial_grid = false
209flag_equatorial_J2000_grid = false222flag_equatorial_J2000_grid = false
223flag_ecliptic_grid = false
210flag_ecliptic_J2000_grid = false224flag_ecliptic_J2000_grid = false
211flag_galactic_grid = false225flag_galactic_grid = false
212flag_galactic_equator_line = false226flag_galactic_equator_line = false
213flag_equator_line = false227flag_equator_line = false
228flag_equator_J2000_line = false
214flag_ecliptic_line = false229flag_ecliptic_line = false
230flag_ecliptic__J2000_line = false
215flag_meridian_line = false231flag_meridian_line = false
216flag_longitude_line = false232flag_longitude_line = false
217flag_horizon_line = false233flag_horizon_line = false
218234
=== modified file 'src/CMakeLists.txt'
--- src/CMakeLists.txt 2015-06-13 20:19:16 +0000
+++ src/CMakeLists.txt 2015-07-28 19:18:20 +0000
@@ -174,6 +174,8 @@
174 core/planetsephems/marssat.h174 core/planetsephems/marssat.h
175 core/planetsephems/pluto.c175 core/planetsephems/pluto.c
176 core/planetsephems/pluto.h176 core/planetsephems/pluto.h
177 core/planetsephems/precession.c
178 core/planetsephems/precession.h
177 core/planetsephems/sidereal_time.c179 core/planetsephems/sidereal_time.c
178 core/planetsephems/sidereal_time.h180 core/planetsephems/sidereal_time.h
179 core/planetsephems/stellplanet.c181 core/planetsephems/stellplanet.c
@@ -620,6 +622,23 @@
620ADD_DEPENDENCIES(buildTests testRefraction)622ADD_DEPENDENCIES(buildTests testRefraction)
621ADD_TEST(testRefraction)623ADD_TEST(testRefraction)
622624
625SET(tests_testPrecession_SRCS
626 tests/testPrecession.hpp
627 tests/testPrecession.cpp
628 core/planetsephems/precession.h
629 core/planetsephems/precession.c
630 core/StelUtils.hpp
631 core/StelUtils.cpp)
632IF(WIN32)
633 # StelUtils required zlib sources
634 SET(tests_testPrecession_SRCS ${tests_testPrecession_SRCS} ${zlib_SRCS})
635ENDIF()
636ADD_EXECUTABLE(testPrecession EXCLUDE_FROM_ALL ${tests_testPrecession_SRCS})
637QT5_USE_MODULES(testPrecession Core Gui Widgets Script Declarative Test)
638TARGET_LINK_LIBRARIES(testPrecession ${extLinkerOptionTest})
639ADD_DEPENDENCIES(buildTests testPrecession)
640ADD_TEST(testPrecession)
641
623ADD_CUSTOM_TARGET(tests COMMENT "Run the Stellarium unit tests")642ADD_CUSTOM_TARGET(tests COMMENT "Run the Stellarium unit tests")
624FOREACH(NAME ${STELLARIUM_TESTS})643FOREACH(NAME ${STELLARIUM_TESTS})
625 IF(MSVC)644 IF(MSVC)
626645
=== modified file 'src/core/StelCore.cpp'
--- src/core/StelCore.cpp 2015-07-25 17:05:44 +0000
+++ src/core/StelCore.cpp 2015-07-28 19:18:20 +0000
@@ -37,6 +37,7 @@
37#include "LandscapeMgr.hpp"37#include "LandscapeMgr.hpp"
38#include "StelTranslator.hpp"38#include "StelTranslator.hpp"
39#include "StelActionMgr.hpp"39#include "StelActionMgr.hpp"
40#include "precession.h"
4041
41#include <QSettings>42#include <QSettings>
42#include <QDebug>43#include <QDebug>
@@ -311,10 +312,12 @@
311 {312 {
312 case FrameAltAz:313 case FrameAltAz:
313 return getProjection(getAltAzModelViewTransform(refractionMode));314 return getProjection(getAltAzModelViewTransform(refractionMode));
314 case FrameHeliocentricEcliptic:315 case FrameHeliocentricEclipticJ2000:
315 return getProjection(getHeliocentricEclipticModelViewTransform(refractionMode));316 return getProjection(getHeliocentricEclipticModelViewTransform(refractionMode));
316 case FrameObservercentricEcliptic:317 case FrameObservercentricEclipticJ2000:
317 return getProjection(getObservercentricEclipticModelViewTransform(refractionMode));318 return getProjection(getObservercentricEclipticJ2000ModelViewTransform(refractionMode));
319 case FrameObservercentricEclipticOfDate:
320 return getProjection(getObservercentricEclipticOfDateModelViewTransform(refractionMode));
318 case FrameEquinoxEqu:321 case FrameEquinoxEqu:
319 return getProjection(getEquinoxEquModelViewTransform(refractionMode));322 return getProjection(getEquinoxEquModelViewTransform(refractionMode));
320 case FrameJ2000:323 case FrameJ2000:
@@ -635,9 +638,9 @@
635Vec3d StelCore::heliocentricEclipticToAltAz(const Vec3d& v, RefractionMode refMode) const638Vec3d StelCore::heliocentricEclipticToAltAz(const Vec3d& v, RefractionMode refMode) const
636{639{
637 if (refMode==RefractionOff || skyDrawer==NULL || (refMode==RefractionAuto && skyDrawer->getFlagHasAtmosphere()==false))640 if (refMode==RefractionOff || skyDrawer==NULL || (refMode==RefractionAuto && skyDrawer->getFlagHasAtmosphere()==false))
638 return matHeliocentricEclipticToAltAz*v;641 return matHeliocentricEclipticJ2000ToAltAz*v;
639 Vec3d r(v);642 Vec3d r(v);
640 r.transfo4d(matHeliocentricEclipticToAltAz);643 r.transfo4d(matHeliocentricEclipticJ2000ToAltAz);
641 skyDrawer->getRefraction().forward(r);644 skyDrawer->getRefraction().forward(r);
642 return r;645 return r;
643}646}
@@ -648,26 +651,29 @@
648 return matHeliocentricEclipticToEquinoxEqu*v;651 return matHeliocentricEclipticToEquinoxEqu*v;
649}652}
650653
654/*
651//! Transform vector from heliocentric coordinate to false equatorial : equatorial655//! Transform vector from heliocentric coordinate to false equatorial : equatorial
652//! coordinate but centered on the observer position (usefull for objects close to earth)656//! coordinate but centered on the observer position (useful for objects close to earth)
657//! Unused as of V0.13
653Vec3d StelCore::heliocentricEclipticToEarthPosEquinoxEqu(const Vec3d& v) const658Vec3d StelCore::heliocentricEclipticToEarthPosEquinoxEqu(const Vec3d& v) const
654{659{
655 return matAltAzToEquinoxEqu*matHeliocentricEclipticToAltAz*v;660 return matAltAzToEquinoxEqu*matHeliocentricEclipticToAltAz*v;
656}661}
662*/
657663
658StelProjector::ModelViewTranformP StelCore::getHeliocentricEclipticModelViewTransform(RefractionMode refMode) const664StelProjector::ModelViewTranformP StelCore::getHeliocentricEclipticModelViewTransform(RefractionMode refMode) const
659{665{
660 if (refMode==RefractionOff || skyDrawer==NULL || (refMode==RefractionAuto && skyDrawer->getFlagHasAtmosphere()==false))666 if (refMode==RefractionOff || skyDrawer==NULL || (refMode==RefractionAuto && skyDrawer->getFlagHasAtmosphere()==false))
661 return StelProjector::ModelViewTranformP(new StelProjector::Mat4dTransform(matAltAzModelView*matHeliocentricEclipticToAltAz));667 return StelProjector::ModelViewTranformP(new StelProjector::Mat4dTransform(matAltAzModelView*matHeliocentricEclipticJ2000ToAltAz));
662 Refraction* refr = new Refraction(skyDrawer->getRefraction());668 Refraction* refr = new Refraction(skyDrawer->getRefraction());
663 // The pretransform matrix will convert from input coordinates to AltAz needed by the refraction function.669 // The pretransform matrix will convert from input coordinates to AltAz needed by the refraction function.
664 refr->setPreTransfoMat(matHeliocentricEclipticToAltAz);670 refr->setPreTransfoMat(matHeliocentricEclipticJ2000ToAltAz);
665 refr->setPostTransfoMat(matAltAzModelView);671 refr->setPostTransfoMat(matAltAzModelView);
666 return StelProjector::ModelViewTranformP(refr);672 return StelProjector::ModelViewTranformP(refr);
667}673}
668674
669//! Get the modelview matrix for observer-centric ecliptic (Vsop87) drawing675//! Get the modelview matrix for observer-centric ecliptic J2000 (Vsop87A) drawing
670StelProjector::ModelViewTranformP StelCore::getObservercentricEclipticModelViewTransform(RefractionMode refMode) const676StelProjector::ModelViewTranformP StelCore::getObservercentricEclipticJ2000ModelViewTransform(RefractionMode refMode) const
671{677{
672 if (refMode==RefractionOff || skyDrawer==NULL || (refMode==RefractionAuto && skyDrawer->getFlagHasAtmosphere()==false))678 if (refMode==RefractionOff || skyDrawer==NULL || (refMode==RefractionAuto && skyDrawer->getFlagHasAtmosphere()==false))
673 return StelProjector::ModelViewTranformP(new StelProjector::Mat4dTransform(matAltAzModelView*matJ2000ToAltAz*matVsop87ToJ2000));679 return StelProjector::ModelViewTranformP(new StelProjector::Mat4dTransform(matAltAzModelView*matJ2000ToAltAz*matVsop87ToJ2000));
@@ -678,6 +684,19 @@
678 return StelProjector::ModelViewTranformP(refr);684 return StelProjector::ModelViewTranformP(refr);
679}685}
680686
687//! Get the modelview matrix for observer-centric ecliptic-of-date drawing
688StelProjector::ModelViewTranformP StelCore::getObservercentricEclipticOfDateModelViewTransform(RefractionMode refMode) const
689{
690 double eps_A=getPrecessionAngleVondrakCurrentEpsilonA();
691 if (refMode==RefractionOff || skyDrawer==NULL || (refMode==RefractionAuto && skyDrawer->getFlagHasAtmosphere()==false))
692 return StelProjector::ModelViewTranformP(new StelProjector::Mat4dTransform(matAltAzModelView*matEquinoxEquToAltAz* Mat4d::xrotation(eps_A)));
693 Refraction* refr = new Refraction(skyDrawer->getRefraction());
694 // The pretransform matrix will convert from input coordinates to AltAz needed by the refraction function.
695 refr->setPreTransfoMat(matEquinoxEquToAltAz* Mat4d::xrotation(eps_A));
696 refr->setPostTransfoMat(matAltAzModelView);
697 return StelProjector::ModelViewTranformP(refr);
698}
699
681//! Get the modelview matrix for observer-centric equatorial at equinox drawing700//! Get the modelview matrix for observer-centric equatorial at equinox drawing
682StelProjector::ModelViewTranformP StelCore::getEquinoxEquModelViewTransform(RefractionMode refMode) const701StelProjector::ModelViewTranformP StelCore::getEquinoxEquModelViewTransform(RefractionMode refMode) const
683{702{
@@ -729,31 +748,52 @@
729 return StelProjector::ModelViewTranformP(refr);748 return StelProjector::ModelViewTranformP(refr);
730}749}
731750
751// GZ: One of the most important functions, totally void of doc. :-(
752// called in update() (for every frame)
732void StelCore::updateTransformMatrices()753void StelCore::updateTransformMatrices()
733{754{
734 matAltAzToEquinoxEqu = position->getRotAltAzToEquatorial(JDay);755 matAltAzToEquinoxEqu = position->getRotAltAzToEquatorial(JDay);
735 matEquinoxEquToAltAz = matAltAzToEquinoxEqu.transpose();756 matEquinoxEquToAltAz = matAltAzToEquinoxEqu.transpose();
736757
758 // multiply static J2000 earth axis tilt (eclipticalJ2000<->equatorialJ2000)
759 // in effect, this matrix transforms from VSOP87 ecliptical J2000 to planet-based equatorial coordinates.
760 // For earth, matJ2000ToEquinoxEqu is the precession matrix.
761 // TODO: rename matEquinoxEquToJ2000 to matEquinoxEquDateToJ2000
737 matEquinoxEquToJ2000 = matVsop87ToJ2000 * position->getRotEquatorialToVsop87();762 matEquinoxEquToJ2000 = matVsop87ToJ2000 * position->getRotEquatorialToVsop87();
738 matJ2000ToEquinoxEqu = matEquinoxEquToJ2000.transpose();763 matJ2000ToEquinoxEqu = matEquinoxEquToJ2000.transpose();
739 matJ2000ToAltAz = matEquinoxEquToAltAz*matJ2000ToEquinoxEqu;764 matJ2000ToAltAz = matEquinoxEquToAltAz*matJ2000ToEquinoxEqu;
740765
741 matHeliocentricEclipticToEquinoxEqu = matJ2000ToEquinoxEqu * matVsop87ToJ2000 * Mat4d::translation(-position->getCenterVsop87Pos());766 matHeliocentricEclipticToEquinoxEqu = matJ2000ToEquinoxEqu * matVsop87ToJ2000 * Mat4d::translation(-position->getCenterVsop87Pos());
742767
743 // These two next have to take into account the position of the observer on the earth768 // These two next have to take into account the position of the observer on the earth/planet of observation.
769 // GZ tmp could be called matAltAzToVsop87
744 Mat4d tmp = matJ2000ToVsop87 * matEquinoxEquToJ2000 * matAltAzToEquinoxEqu;770 Mat4d tmp = matJ2000ToVsop87 * matEquinoxEquToJ2000 * matAltAzToEquinoxEqu;
745771
746 matAltAzToHeliocentricEcliptic = Mat4d::translation(position->getCenterVsop87Pos()) * tmp *772 // TODO: getDistanceFromCenter assumes spherical planets. Use rectangular coordinates for observer!
773 matAltAzToHeliocentricEclipticJ2000 = Mat4d::translation(position->getCenterVsop87Pos()) * tmp *
747 Mat4d::translation(Vec3d(0.,0., position->getDistanceFromCenter()));774 Mat4d::translation(Vec3d(0.,0., position->getDistanceFromCenter()));
748775
749 matHeliocentricEclipticToAltAz = Mat4d::translation(Vec3d(0.,0.,-position->getDistanceFromCenter())) * tmp.transpose() *776 matHeliocentricEclipticJ2000ToAltAz = Mat4d::translation(Vec3d(0.,0.,-position->getDistanceFromCenter())) * tmp.transpose() *
750 Mat4d::translation(-position->getCenterVsop87Pos());777 Mat4d::translation(-position->getCenterVsop87Pos());
778
779
780// Given that ecliptic of date is apparently not used any longer as reference plane for astronomical computations, it is enough to display it.
781// This half-finished block of comments can the likely go away for V0.14. Else, do we have use for carrying the extra matrices with us? Then complete this:
782// // GZ Finally, new: rotation of the ecliptic of date. Not sure which direction, though...
783// double epsilon_A, chi_A, omega_A, psi_A;
784// // MAKE SURE JDay IS TT!!!
785// getPrecessionAnglesVondrak(JDay, &epsilon_A, &chi_A, &omega_A, &psi_A);
786// //matVsop87ToEclOfDate= Mat4d::xrotation(epsilon_A)*Mat4d::zrotation(chi_A)*Mat4d::xrotation(-omega_A)*Mat4d::zrotation(-psi_A);
787// matVsop87ToEclOfDate= Mat4d::xrotation(epsilon_A)*Mat4d::zrotation(chi_A)*Mat4d::xrotation(-23.4392803055555555556*(M_PI/180));
788// matEclOfDateToVsop87=matVsop87ToEclOfDate.transpose();
789// //matEclOfDateToVsop87= Mat4d::xrotation(epsilon_A)*Mat4d::zrotation(chi_A)*Mat4d::xrotation(-omega_A)*Mat4d::zrotation(-psi_A);
790// //matVsop87ToEclOfDate=matVsop87ToEclOfDate.transpose();
751}791}
752792
753// Return the observer heliocentric position793// Return the observer heliocentric position
754Vec3d StelCore::getObserverHeliocentricEclipticPos() const794Vec3d StelCore::getObserverHeliocentricEclipticPos() const
755{795{
756 return Vec3d(matAltAzToHeliocentricEcliptic[12], matAltAzToHeliocentricEcliptic[13], matAltAzToHeliocentricEcliptic[14]);796 return Vec3d(matAltAzToHeliocentricEclipticJ2000[12], matAltAzToHeliocentricEclipticJ2000[13], matAltAzToHeliocentricEclipticJ2000[14]);
757}797}
758798
759// Set the location to use by default at startup799// Set the location to use by default at startup
@@ -905,6 +945,11 @@
905 return position->getHomePlanet();945 return position->getHomePlanet();
906}946}
907947
948const StelObserver *StelCore::getCurrentObserver() const
949{
950 return position;
951}
952
908// Smoothly move the observer to the given location953// Smoothly move the observer to the given location
909void StelCore::moveObserverTo(const StelLocation& target, double duration, double durationIfPlanetChange)954void StelCore::moveObserverTo(const StelLocation& target, double duration, double durationIfPlanetChange)
910{955{
@@ -1045,6 +1090,16 @@
1045 addSolarDays(365.242190419);1090 addSolarDays(365.242190419);
1046}1091}
10471092
1093void StelCore::addTropicalCentury()
1094{
1095 addSolarDays(36524.21897);
1096}
1097
1098void StelCore::addJulianCentury()
1099{
1100 addSolarDays(36525.0);
1101}
1102
1048void StelCore::subtractHour()1103void StelCore::subtractHour()
1049{1104{
1050 addSolarDays(-JD_HOUR);1105 addSolarDays(-JD_HOUR);
@@ -1105,6 +1160,16 @@
1105 addSolarDays(-365.242190419);1160 addSolarDays(-365.242190419);
1106}1161}
11071162
1163void StelCore::subtractTropicalCentury()
1164{
1165 addSolarDays(-36524.21897);
1166}
1167
1168void StelCore::subtractJulianCentury()
1169{
1170 addSolarDays(-36525.0);
1171}
1172
1108void StelCore::addSolarDays(double d)1173void StelCore::addSolarDays(double d)
1109{1174{
1110 const PlanetP& home = position->getHomePlanet();1175 const PlanetP& home = position->getHomePlanet();
@@ -1717,10 +1782,12 @@
1717 return QString(" %1").arg(validRange);1782 return QString(" %1").arg(validRange);
1718}1783}
17191784
1785// return if sky plus atmosphere is bright enough from sunlight so that e.g. screen labels should be rendered dark.
1786// Could be renamed to isBrightDaylight()
1720bool StelCore::isDay() const1787bool StelCore::isDay() const
1721{1788{
1722 const Vec3d& sunPos = GETSTELMODULE(SolarSystem)->getSun()->getAltAzPosGeometric(this);1789 const Vec3d& sunPos = GETSTELMODULE(SolarSystem)->getSun()->getAltAzPosGeometric(this);
1723 return sunPos[2] > -0.12; // Nautical twilight1790 return sunPos[2] > -0.12; // Nautical twilight (0.12 > sin (6 deg),
1724}1791}
17251792
1726double StelCore::getCurrentEpoch() const1793double StelCore::getCurrentEpoch() const
17271794
=== modified file 'src/core/StelCore.hpp'
--- src/core/StelCore.hpp 2015-07-08 10:37:11 +0000
+++ src/core/StelCore.hpp 2015-07-28 19:18:20 +0000
@@ -1,6 +1,7 @@
1/*1/*
2 * Copyright (C) 2003 Fabien Chereau2 * Copyright (C) 2003 Fabien Chereau
3 * Copyright (C) 2012 Matthew Gates3 * Copyright (C) 2012 Matthew Gates
4 * Copyright (C) 2015 Georg Zotti (Precession fixes)
4 *5 *
5 * This program is free software; you can redistribute it and/or6 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License7 * modify it under the terms of the GNU General Public License
@@ -38,11 +39,11 @@
38//! Main class for Stellarium core processing.39//! Main class for Stellarium core processing.
39//! This class provides services like management of sky projections,40//! This class provides services like management of sky projections,
40//! tone conversion, or reference frame conversion. It is used by the41//! tone conversion, or reference frame conversion. It is used by the
41//! various StelModules to update and display themself.42//! various StelModules to update and display themselves.
42//! There is currently only one StelCore instance in Stellarium, but43//! There is currently only one StelCore instance in Stellarium, but
43//! in the future they may be more, allowing for example to display44//! in the future they may be more, allowing for example to display
44//! several independent views of the sky at the same time.45//! several independent views of the sky at the same time.
45//! @author Fabien Chereau46//! @author Fabien Chereau, Matthew Gates, Georg Zotti
46class StelCore : public QObject47class StelCore : public QObject
47{48{
48 Q_OBJECT49 Q_OBJECT
@@ -56,15 +57,17 @@
56 //! Supported reference frame types57 //! Supported reference frame types
57 enum FrameType58 enum FrameType
58 {59 {
59 FrameUninitialized, //!< Reference frame is not set (FMajerech: Added to avoid condition on uninitialized value in StelSkyLayerMgr::draw())60 FrameUninitialized, //!< Reference frame is not set (FMajerech: Added to avoid condition on uninitialized value in StelSkyLayerMgr::draw())
60 FrameAltAz, //!< Altazimuthal reference frame centered on observer.61 FrameAltAz, //!< Altazimuthal reference frame centered on observer.
61 FrameHeliocentricEcliptic, //!< Ecliptic reference frame centered on the Sun62 FrameHeliocentricEclipticJ2000, //!< Fixed-ecliptic reference frame centered on the Sun. GZ: This is J2000 ecliptical / almost VSOP87.
62 FrameObservercentricEcliptic, //!< Ecliptic reference frame centered on the Observer63 FrameObservercentricEclipticJ2000, //!< Fixed-ecliptic reference frame centered on the Observer. GZ: was ObservercentricEcliptic, but renamed because it is Ecliptic of J2000!
63 FrameEquinoxEqu, //!< Equatorial reference frame at the current equinox centered on the observer.64 FrameObservercentricEclipticOfDate, //!< Moving ecliptic reference frame centered on the Observer. GZ new for V0.14: Ecliptic of date, i.e. includes the precession of the ecliptic.
64 //! The north pole follows the precession of the planet on which the observer is located.65 FrameEquinoxEqu, //!< Equatorial reference frame at the current equinox centered on the observer.
65 FrameJ2000, //!< Equatorial reference frame at the J2000 equinox centered on the observer.66 //!< The north pole follows the precession of the planet on which the observer is located.
66 //! This is also the ICRS reference frame.67 //!< TBD: To be Corrected for V0.14 to really properly reflect ecliptical motion and precession (Vondrak 2011 model)
67 FrameGalactic //! Galactic reference frame centered on observer.68 FrameJ2000, //!< Equatorial reference frame at the J2000 equinox centered on the observer.
69 //!< This is also the ICRS reference frame.
70 FrameGalactic //!< Galactic reference frame centered on observer.
68 };71 };
6972
70 //! @enum ProjectionType73 //! @enum ProjectionType
@@ -150,11 +153,11 @@
150 //! only for 2d painting153 //! only for 2d painting
151 StelProjectorP getProjection2d() const;154 StelProjectorP getProjection2d() const;
152155
153 //! Get a new instance of projector using a modelview transformation corresponding to the the given frame.156 //! Get a new instance of projector using a modelview transformation corresponding to the given frame.
154 //! If not specified the refraction effect is included if atmosphere is on.157 //! If not specified the refraction effect is included if atmosphere is on.
155 StelProjectorP getProjection(FrameType frameType, RefractionMode refractionMode=RefractionAuto) const;158 StelProjectorP getProjection(FrameType frameType, RefractionMode refractionMode=RefractionAuto) const;
156159
157 //! Get a new instance of projector using the given modelview transformatione.160 //! Get a new instance of projector using the given modelview transformation.
158 //! If not specified the projection used is the one currently used as default.161 //! If not specified the projection used is the one currently used as default.
159 StelProjectorP getProjection(StelProjector::ModelViewTranformP modelViewTransform, ProjectionType projType=(ProjectionType)1000) const;162 StelProjectorP getProjection(StelProjector::ModelViewTranformP modelViewTransform, ProjectionType projType=(ProjectionType)1000) const;
160163
@@ -210,31 +213,35 @@
210213
211 //! Transform from heliocentric coordinate to equatorial at current equinox (for the planet where the observer stands)214 //! Transform from heliocentric coordinate to equatorial at current equinox (for the planet where the observer stands)
212 Vec3d heliocentricEclipticToEquinoxEqu(const Vec3d& v) const;215 Vec3d heliocentricEclipticToEquinoxEqu(const Vec3d& v) const;
213 //! Transform vector from heliocentric coordinate to false equatorial : equatorial216// //! Transform vector from heliocentric coordinate to false equatorial : equatorial
214 //! coordinate but centered on the observer position (usefull for objects close to earth)217// //! coordinate but centered on the observer position (useful for objects close to earth)
215 Vec3d heliocentricEclipticToEarthPosEquinoxEqu(const Vec3d& v) const;218// //! Unused as of V0.13
219// Vec3d heliocentricEclipticToEarthPosEquinoxEqu(const Vec3d& v) const;
216220
217 //! Get the modelview matrix for heliocentric ecliptic (Vsop87) drawing221 //! Get the modelview matrix for heliocentric ecliptic (Vsop87) drawing.
218 StelProjector::ModelViewTranformP getHeliocentricEclipticModelViewTransform(RefractionMode refMode=RefractionAuto) const;222 StelProjector::ModelViewTranformP getHeliocentricEclipticModelViewTransform(RefractionMode refMode=RefractionAuto) const;
219223
220 //! Get the modelview matrix for observer-centric ecliptic (Vsop87) drawing224 //! Get the modelview matrix for observer-centric ecliptic (Vsop87) drawing.
221 StelProjector::ModelViewTranformP getObservercentricEclipticModelViewTransform(RefractionMode refMode=RefractionAuto) const;225 StelProjector::ModelViewTranformP getObservercentricEclipticJ2000ModelViewTransform(RefractionMode refMode=RefractionAuto) const;
222226
223 //! Get the modelview matrix for observer-centric equatorial at equinox drawing227 //! Get the modelview matrix for observer-centric ecliptic of Date drawing.
228 StelProjector::ModelViewTranformP getObservercentricEclipticOfDateModelViewTransform(RefractionMode refMode=RefractionAuto) const;
229
230 //! Get the modelview matrix for observer-centric equatorial at equinox drawing.
224 StelProjector::ModelViewTranformP getEquinoxEquModelViewTransform(RefractionMode refMode=RefractionAuto) const;231 StelProjector::ModelViewTranformP getEquinoxEquModelViewTransform(RefractionMode refMode=RefractionAuto) const;
225232
226 //! Get the modelview matrix for observer-centric altazimuthal drawing233 //! Get the modelview matrix for observer-centric altazimuthal drawing.
227 StelProjector::ModelViewTranformP getAltAzModelViewTransform(RefractionMode refMode=RefractionAuto) const;234 StelProjector::ModelViewTranformP getAltAzModelViewTransform(RefractionMode refMode=RefractionAuto) const;
228235
229 //! Get the modelview matrix for observer-centric J2000 equatorial drawing236 //! Get the modelview matrix for observer-centric J2000 equatorial drawing.
230 StelProjector::ModelViewTranformP getJ2000ModelViewTransform(RefractionMode refMode=RefractionAuto) const;237 StelProjector::ModelViewTranformP getJ2000ModelViewTransform(RefractionMode refMode=RefractionAuto) const;
231238
232 //! Get the modelview matrix for observer-centric Galactic equatorial drawing239 //! Get the modelview matrix for observer-centric Galactic equatorial drawing.
233 StelProjector::ModelViewTranformP getGalacticModelViewTransform(RefractionMode refMode=RefractionAuto) const;240 StelProjector::ModelViewTranformP getGalacticModelViewTransform(RefractionMode refMode=RefractionAuto) const;
234241
235 //! Rotation matrix from equatorial J2000 to ecliptic (Vsop87)242 //! Rotation matrix from equatorial J2000 to ecliptic (VSOP87A).
236 static const Mat4d matJ2000ToVsop87;243 static const Mat4d matJ2000ToVsop87;
237 //! Rotation matrix from ecliptic (Vsop87) to equatorial J2000244 //! Rotation matrix from ecliptic (VSOP87A) to equatorial J2000.
238 static const Mat4d matVsop87ToJ2000;245 static const Mat4d matVsop87ToJ2000;
239 //! Rotation matrix from J2000 to Galactic reference frame, using FITS convention.246 //! Rotation matrix from J2000 to Galactic reference frame, using FITS convention.
240 static const Mat4d matJ2000ToGalactic;247 static const Mat4d matJ2000ToGalactic;
@@ -249,6 +256,10 @@
249256
250 const QSharedPointer<class Planet> getCurrentPlanet() const;257 const QSharedPointer<class Planet> getCurrentPlanet() const;
251258
259 //! Unfortunately we also need this.
260 const StelObserver* getCurrentObserver() const;
261
262
252 SphericalCap getVisibleSkyArea() const;263 SphericalCap getVisibleSkyArea() const;
253 264
254 //! Smoothly move the observer to the given location265 //! Smoothly move the observer to the given location
@@ -291,10 +302,12 @@
291 //! @return valid range302 //! @return valid range
292 QString getCurrentDeltaTAlgorithmValidRange(double jDay, QString* marker) const;303 QString getCurrentDeltaTAlgorithmValidRange(double jDay, QString* marker) const;
293304
294 //! Checks for current time of day - it's night or day?305 //! Checks for altitude of sun - is it night or day?
306 //! @return true if sun higher than about -6 degrees, i.e. "day" includes civil twilight.
307 //! @note Useful mostly for brightness-controlled GUI decisions like font colors.
295 bool isDay() const;308 bool isDay() const;
296309
297 //! Get value of the current Julian epoch310 //! Get value of the current Julian epoch (i.e. current year with decimal fraction, e.g. 2012.34567)
298 double getCurrentEpoch() const;311 double getCurrentEpoch() const;
299312
300 //! Get the default Mapping used by the Projection313 //! Get the default Mapping used by the Projection
@@ -451,6 +464,10 @@
451 void addTropicalMonth();464 void addTropicalMonth();
452 //! Add one mean tropical year to the simulation time.465 //! Add one mean tropical year to the simulation time.
453 void addTropicalYear();466 void addTropicalYear();
467 //! Add one mean tropical century to the simulation time.
468 void addTropicalCentury();
469 //! Add one Julian century to the simulation time.
470 void addJulianCentury();
454471
455 //! Subtract one synodic month to the simulation time.472 //! Subtract one synodic month to the simulation time.
456 void subtractSynodicMonth();473 void subtractSynodicMonth();
@@ -466,7 +483,11 @@
466 //! Subtract one mean tropical month to the simulation time.483 //! Subtract one mean tropical month to the simulation time.
467 void subtractTropicalMonth();484 void subtractTropicalMonth();
468 //! Subtract one mean tropical year to the simulation time.485 //! Subtract one mean tropical year to the simulation time.
469 void subtractTropicalYear(); 486 void subtractTropicalYear();
487 //! Subtract one mean tropical century to the simulation time.
488 void subtractTropicalCentury();
489 //! Subtract one Julian century to the simulation time.
490 void subtractJulianCentury();
470491
471 //! Add a number of Earth Solar days to the current simulation time492 //! Add a number of Earth Solar days to the current simulation time
472 //! @param d the decimal number of days to add (use negative values to subtract)493 //! @param d the decimal number of days to add (use negative values to subtract)
@@ -525,13 +546,17 @@
525 void resetSync();546 void resetSync();
526547
527 // Matrices used for every coordinate transfo548 // Matrices used for every coordinate transfo
528 Mat4d matHeliocentricEclipticToAltAz; // Transform from heliocentric ecliptic (Vsop87) to observer-centric altazimuthal coordinate549 Mat4d matHeliocentricEclipticJ2000ToAltAz; // Transform from heliocentric ecliptic Cartesian (VSOP87A) to topocentric (StelObserver) altazimuthal coordinate
529 Mat4d matAltAzToHeliocentricEcliptic; // Transform from observer-centric altazimuthal coordinate to heliocentric ecliptic (Vsop87)550 Mat4d matAltAzToHeliocentricEclipticJ2000; // Transform from topocentric (StelObserver) altazimuthal coordinate to heliocentric ecliptic Cartesian (VSOP87A)
530 Mat4d matAltAzToEquinoxEqu; // Transform from observer-centric altazimuthal coordinate to Earth Equatorial551 Mat4d matAltAzToEquinoxEqu; // Transform from topocentric altazimuthal coordinate to Earth Equatorial
531 Mat4d matEquinoxEquToAltAz; // Transform from observer-centric altazimuthal coordinate to Earth Equatorial552 Mat4d matEquinoxEquToAltAz; // Transform from Earth Equatorial to topocentric (StelObserver) altazimuthal coordinate
532 Mat4d matHeliocentricEclipticToEquinoxEqu; // Transform from heliocentric ecliptic (Vsop87) to earth equatorial coordinate553 Mat4d matHeliocentricEclipticToEquinoxEqu; // Transform from heliocentric ecliptic Cartesian (VSOP87A) to earth equatorial coordinate
533 Mat4d matEquinoxEquToJ2000;554 Mat4d matEquinoxEquToJ2000; // GZ For Earth, this should be inverse precession matrix. Yes, =Rz(VSOPoffset)Rx(eps0)Rz(-psiA)Rx(-omA)Rz(chiA)
534 Mat4d matJ2000ToEquinoxEqu;555 Mat4d matJ2000ToEquinoxEqu; // GZ: Should be precession matrix?
556// Mat4d matEclOfDateToVsop87; // GZ NEW: precession of the ecliptic
557// Mat4d matVsop87ToEclOfDate; // GZ NEW: precession of the ecliptic
558
559
535 Mat4d matJ2000ToAltAz;560 Mat4d matJ2000ToAltAz;
536561
537 Mat4d matAltAzModelView; // Modelview matrix for observer-centric altazimuthal drawing562 Mat4d matAltAzModelView; // Modelview matrix for observer-centric altazimuthal drawing
538563
=== modified file 'src/core/StelObject.cpp'
--- src/core/StelObject.cpp 2015-06-12 18:45:39 +0000
+++ src/core/StelObject.cpp 2015-07-28 19:18:20 +0000
@@ -28,6 +28,7 @@
28#include "RefractionExtinction.hpp"28#include "RefractionExtinction.hpp"
29#include "StelLocation.hpp"29#include "StelLocation.hpp"
30#include "SolarSystem.hpp"30#include "SolarSystem.hpp"
31#include "StelModuleMgr.hpp"
3132
32#include <QRegExp>33#include <QRegExp>
33#include <QDebug>34#include <QDebug>
@@ -42,6 +43,7 @@
42Vec3d StelObject::getSiderealPosGeometric(const StelCore* core) const43Vec3d StelObject::getSiderealPosGeometric(const StelCore* core) const
43{44{
44 // Hour Angle corrected to Delta-T value45 // Hour Angle corrected to Delta-T value
46 // TODO: make code readable by calling siderealTime(JD_UT), this should not contain a deltaT in its algorithm.
45 double dt = (core->getDeltaT(core->getJDay())/240.)*M_PI/180.;47 double dt = (core->getDeltaT(core->getJDay())/240.)*M_PI/180.;
46 return Mat4d::zrotation(-core->getLocalSiderealTime()+dt)* getEquinoxEquatorialPos(core);48 return Mat4d::zrotation(-core->getLocalSiderealTime()+dt)* getEquinoxEquatorialPos(core);
47}49}
@@ -52,6 +54,7 @@
52 Vec3d v=getAltAzPosApparent(core);54 Vec3d v=getAltAzPosApparent(core);
53 v = core->altAzToEquinoxEqu(v, StelCore::RefractionOff);55 v = core->altAzToEquinoxEqu(v, StelCore::RefractionOff);
54 // Hour Angle corrected to Delta-T value56 // Hour Angle corrected to Delta-T value
57 // TODO: make code readable by calling siderealTime(JD_UT), this should not contain a deltaT in its algorithm.
55 double dt = (core->getDeltaT(core->getJDay())/240.)*M_PI/180.;58 double dt = (core->getDeltaT(core->getJDay())/240.)*M_PI/180.;
56 return Mat4d::zrotation(-core->getLocalSiderealTime()+dt)*v;59 return Mat4d::zrotation(-core->getLocalSiderealTime()+dt)*v;
57}60}
@@ -109,6 +112,9 @@
109{112{
110 bool withAtmosphere = core->getSkyDrawer()->getFlagHasAtmosphere();113 bool withAtmosphere = core->getSkyDrawer()->getFlagHasAtmosphere();
111 bool withDecimalDegree = StelApp::getInstance().getFlagShowDecimalDegrees();;114 bool withDecimalDegree = StelApp::getInstance().getFlagShowDecimalDegrees();;
115 double az_app, alt_app;
116 StelUtils::rectToSphe(&az_app,&alt_app,getAltAzPosApparent(core));
117 Q_UNUSED(az_app);
112 QString cepoch = qc_("on date", "coordinates for current epoch");118 QString cepoch = qc_("on date", "coordinates for current epoch");
113 QString res;119 QString res;
114 if (flags&RaDecJ2000)120 if (flags&RaDecJ2000)
@@ -137,7 +143,7 @@
137 QString hadec;143 QString hadec;
138 StelUtils::rectToSphe(&ra_sidereal,&dec_sidereal,getSiderealPosGeometric(core));144 StelUtils::rectToSphe(&ra_sidereal,&dec_sidereal,getSiderealPosGeometric(core));
139 ra_sidereal = 2.*M_PI-ra_sidereal;145 ra_sidereal = 2.*M_PI-ra_sidereal;
140 if (withAtmosphere)146 if (withAtmosphere && (alt_app>-3.0*M_PI/180.0)) // Don't show refracted values much below horizon where model is meaningless.
141 {147 {
142 StelUtils::rectToSphe(&ra_sidereal,&dec_sidereal,getSiderealPosApparent(core));148 StelUtils::rectToSphe(&ra_sidereal,&dec_sidereal,getSiderealPosApparent(core));
143 ra_sidereal = 2.*M_PI-ra_sidereal;149 ra_sidereal = 2.*M_PI-ra_sidereal;
@@ -175,16 +181,12 @@
175 az = 3.*M_PI - az; // N is zero, E is 90 degrees181 az = 3.*M_PI - az; // N is zero, E is 90 degrees
176 if (az > M_PI*2)182 if (az > M_PI*2)
177 az -= M_PI*2;183 az -= M_PI*2;
178 if (withAtmosphere)184 if (withAtmosphere && (alt_app>-3.0*M_PI/180.0)) // Don't show refracted altitude much below horizon where model is meaningless.
179 {185 {
180 StelUtils::rectToSphe(&az,&alt,getAltAzPosApparent(core));
181 az = 3.*M_PI - az; // N is zero, E is 90 degrees
182 if (az > M_PI*2)
183 az -= M_PI*2;
184 if (withDecimalDegree)186 if (withDecimalDegree)
185 res += q_("Az/Alt: %1/%2").arg(StelUtils::radToDecDegStr(az), StelUtils::radToDecDegStr(alt)) + " " + q_("(apparent)") + "<br>";187 res += q_("Az/Alt: %1/%2").arg(StelUtils::radToDecDegStr(az), StelUtils::radToDecDegStr(alt_app)) + " " + q_("(apparent)") + "<br>";
186 else188 else
187 res += q_("Az/Alt: %1/%2").arg(StelUtils::radToDmsStr(az,true), StelUtils::radToDmsStr(alt,true)) + " " + q_("(apparent)") + "<br>";189 res += q_("Az/Alt: %1/%2").arg(StelUtils::radToDmsStr(az,true), StelUtils::radToDmsStr(alt_app,true)) + " " + q_("(apparent)") + "<br>";
188 }190 }
189 else191 else
190 {192 {
@@ -197,7 +199,15 @@
197199
198 if (flags&EclipticCoord)200 if (flags&EclipticCoord)
199 {201 {
200 double ecl = core->getCurrentPlanet()->getRotObliquity(2451545.0);202 // N.B. Ecliptical coordinates are particularly earth-bound.
203 // It may be OK to have terrestrial ecliptical coordinates of J2000.0 (standard epoch) because those are in practice linked with VSOP XY plane,
204 // and because the ecliptical grid of J2000 is also shown for observers on other planets.
205 // The formulation here has never computed the true position of any observer planet's orbital plane except for Earth,
206 // or ever displayed the coordinates in the observer planet's equivalent to Earth's ecliptical coordinates.
207 // As quick test you can observe if in any "Ecliptic coordinate" as seen from e.g. Mars or Jupiter the Sun was ever close to beta=0.
208
209 //double ecl = core->getCurrentPlanet()->getRotObliquity(2451545.0);
210 double ecl=GETSTELMODULE(SolarSystem)->getEarth()->getRotObliquity(2451545.0);
201 double ra_equ, dec_equ, lambda, beta;211 double ra_equ, dec_equ, lambda, beta;
202 StelUtils::rectToSphe(&ra_equ,&dec_equ,getJ2000EquatorialPos(core));212 StelUtils::rectToSphe(&ra_equ,&dec_equ,getJ2000EquatorialPos(core));
203 StelUtils::equToEcl(ra_equ, dec_equ, ecl, &lambda, &beta);213 StelUtils::equToEcl(ra_equ, dec_equ, ecl, &lambda, &beta);
@@ -206,14 +216,24 @@
206 res += q_("Ecliptic longitude/latitude") + QString(" (J%1): %2/%3").arg(QString::number(2000.f, 'f', 1), StelUtils::radToDecDegStr(lambda), StelUtils::radToDecDegStr(beta)) + "<br>";216 res += q_("Ecliptic longitude/latitude") + QString(" (J%1): %2/%3").arg(QString::number(2000.f, 'f', 1), StelUtils::radToDecDegStr(lambda), StelUtils::radToDecDegStr(beta)) + "<br>";
207 else217 else
208 res += q_("Ecliptic longitude/latitude") + QString(" (J%1): %2/%3").arg(QString::number(2000.f, 'f', 1), StelUtils::radToDmsStr(lambda, true), StelUtils::radToDmsStr(beta, true)) + "<br>";218 res += q_("Ecliptic longitude/latitude") + QString(" (J%1): %2/%3").arg(QString::number(2000.f, 'f', 1), StelUtils::radToDmsStr(lambda, true), StelUtils::radToDmsStr(beta, true)) + "<br>";
209 ecl = core->getCurrentPlanet()->getRotObliquity(core->getJDay());219
210 StelUtils::rectToSphe(&ra_equ,&dec_equ,getEquinoxEquatorialPos(core));220 if (core->getCurrentPlanet()->getEnglishName()=="Earth")
211 StelUtils::equToEcl(ra_equ, dec_equ, ecl, &lambda, &beta);221 {
212 if (lambda<0) lambda+=2.0*M_PI;222 ecl = GETSTELMODULE(SolarSystem)->getEarth()->getRotObliquity(2451545.0);
213 if (withDecimalDegree)223
214 res += q_("Ecliptic longitude/latitude") + QString(" (%1): %2/%3").arg(cepoch, StelUtils::radToDecDegStr(lambda), StelUtils::radToDecDegStr(beta)) + "<br>";224 StelUtils::rectToSphe(&ra_equ,&dec_equ,getEquinoxEquatorialPos(core));
215 else225 StelUtils::equToEcl(ra_equ, dec_equ, ecl, &lambda, &beta);
216 res += q_("Ecliptic longitude/latitude") + QString(" (%1): %2/%3").arg(cepoch, StelUtils::radToDmsStr(lambda, true), StelUtils::radToDmsStr(beta, true)) + "<br>";226 if (lambda<0) lambda+=2.0*M_PI;
227 if (withDecimalDegree)
228 res += q_("Ecliptic longitude/latitude") + QString(" (%1): %2/%3").arg(cepoch, StelUtils::radToDecDegStr(lambda), StelUtils::radToDecDegStr(beta)) + "<br>";
229 else
230 res += q_("Ecliptic longitude/latitude") + QString(" (%1): %2/%3").arg(cepoch, StelUtils::radToDmsStr(lambda, true), StelUtils::radToDmsStr(beta, true)) + "<br>";
231 // GZ Only for now: display epsilon_A, angle between Earth's Axis and ecl. of date.
232 if (withDecimalDegree)
233 res += q_("Ecliptic obliquity") + QString(" (%1): %2").arg(cepoch, StelUtils::radToDecDegStr(ecl)) + "<br>";
234 else
235 res += q_("Ecliptic obliquity") + QString(" (%1): %2").arg(cepoch, StelUtils::radToDmsStr(ecl)) + "<br>";
236 }
217 }237 }
218238
219 if (flags&GalacticCoord)239 if (flags&GalacticCoord)
@@ -249,8 +269,8 @@
249 StelCore* core = StelApp::getInstance().getCore();269 StelCore* core = StelApp::getInstance().getCore();
250 if (core->isDay() && core->getSkyDrawer()->getFlagHasAtmosphere()==true)270 if (core->isDay() && core->getSkyDrawer()->getFlagHasAtmosphere()==true)
251 {271 {
252 // Let's make info text is more readable when atmosphere enabled at daylight.272 // make info text more readable when atmosphere enabled at daylight.
253 color = StelUtils::strToVec3f(StelApp::getInstance().getSettings()->value("color/daylight_color", "0.0,0.0,0.0").toString());273 color = StelUtils::strToVec3f(StelApp::getInstance().getSettings()->value("color/daylight_text_color", "0.0,0.0,0.0").toString());
254 }274 }
255 str.prepend(QString("<font color=%1>").arg(StelUtils::vec3fToHtmlColor(color)));275 str.prepend(QString("<font color=%1>").arg(StelUtils::vec3fToHtmlColor(color)));
256 str.append(QString("</font>"));276 str.append(QString("</font>"));
257277
=== modified file 'src/core/StelObject.hpp'
--- src/core/StelObject.hpp 2014-10-17 22:54:15 +0000
+++ src/core/StelObject.hpp 2015-07-28 19:18:20 +0000
@@ -57,13 +57,23 @@
57 GalacticCoord = 0x00000800, //!< The galactic position57 GalacticCoord = 0x00000800, //!< The galactic position
58 ObjectType = 0x00001000, //!< The type of the object (star, planet, etc.)58 ObjectType = 0x00001000, //!< The type of the object (star, planet, etc.)
59 EclipticCoord = 0x00002000, //!< The ecliptic position59 EclipticCoord = 0x00002000, //!< The ecliptic position
60 PlainText = 0x00004000 //!< Strip HTML tags from output60 EclipticCoordXYZ = 0x00004000, //!< The ecliptic position, XYZ of VSOP87A (used mainly for debugging, not public)
61 PlainText = 0x00010000, //!< Strip HTML tags from output
62// TODO GZ
63// RaDecJ2000Planetocentric = 0x00020000, //!< The planetocentric equatorial position (J2000 ref) [Mostly to compare with almanacs]
64// RaDecOfDatePlanetocentric = 0x00040000 //!< The planetocentric equatorial position (of date)
65// // and split Ecliptical into
66// EclipticCoordJ2000 = 0x00002000, //!< The ecliptic position w.r.t. ecliptic of eq.J2000.0
67// EclipticCoordOfDate = 0x00002000, //!< The ecliptic position w.r.t. ecliptic of eq. of date
68
69
61 };70 };
62 typedef QFlags<InfoStringGroupFlags> InfoStringGroup;71 typedef QFlags<InfoStringGroupFlags> InfoStringGroup;
63 Q_FLAGS(InfoStringGroup)72 Q_FLAGS(InfoStringGroup)
6473
65 //! A pre-defined set of specifiers for the getInfoString flags argument to getInfoString74 //! A pre-defined set of specifiers for the getInfoString flags argument to getInfoString
66 static const InfoStringGroupFlags AllInfo = (InfoStringGroupFlags)(Name|CatalogNumber|Magnitude|RaDecJ2000|RaDecOfDate|AltAzi|Distance|Size|Extra|HourAngle|AbsoluteMagnitude|GalacticCoord|ObjectType|EclipticCoord);75 static const InfoStringGroupFlags AllInfo = (InfoStringGroupFlags)(Name|CatalogNumber|Magnitude|RaDecJ2000|RaDecOfDate|AltAzi|Distance|Size|Extra|HourAngle|
76 AbsoluteMagnitude|GalacticCoord|ObjectType|EclipticCoord|EclipticCoordXYZ);
67 //! A pre-defined set of specifiers for the getInfoString flags argument to getInfoString77 //! A pre-defined set of specifiers for the getInfoString flags argument to getInfoString
68 static const InfoStringGroupFlags ShortInfo = (InfoStringGroupFlags)(Name|CatalogNumber|Magnitude|RaDecJ2000);78 static const InfoStringGroupFlags ShortInfo = (InfoStringGroupFlags)(Name|CatalogNumber|Magnitude|RaDecJ2000);
6979
7080
=== modified file 'src/core/StelObserver.cpp'
--- src/core/StelObserver.cpp 2015-02-01 20:44:54 +0000
+++ src/core/StelObserver.cpp 2015-07-28 19:18:20 +0000
@@ -183,6 +183,7 @@
183183
184const QSharedPointer<Planet> StelObserver::getHomePlanet(void) const184const QSharedPointer<Planet> StelObserver::getHomePlanet(void) const
185{185{
186 Q_ASSERT(planet);
186 return planet;187 return planet;
187}188}
188189
@@ -191,22 +192,47 @@
191 return getHomePlanet()->getHeliocentricEclipticPos();192 return getHomePlanet()->getHeliocentricEclipticPos();
192}193}
193194
195// Used to approximate solution with assuming a spherical planet.
196// Since V0.14, following Meeus, Astr. Alg. 2nd ed, Ch.11.
194double StelObserver::getDistanceFromCenter(void) const197double StelObserver::getDistanceFromCenter(void) const
195{198{
196 return getHomePlanet()->getRadius() + (currentLocation.altitude/(1000*AU));199 if (getHomePlanet()->getRadius()==0.0) // the transitional ArtificialPlanet od SpaceShipObserver has this
200 return currentLocation.altitude/(1000*AU);
201
202 double a=getHomePlanet()->getRadius();
203 double bByA = getHomePlanet()->getOneMinusOblateness(); // b/a;
204
205 if (fabs(currentLocation.latitude)>=89.9) // avoid tan(90) issues.
206 return a * bByA;
207
208 double latRad=currentLocation.latitude*(M_PI/180.0);
209 double u = atan( bByA * tan(latRad));
210 // qDebug() << "getDistanceFromCenter: a=" << a*AU << "b/a=" << bByA << "b=" << bByA*a *AU << "latRad=" << latRad << "u=" << u;
211 Q_ASSERT(fabs(u)<= fabs(latRad));
212 double altFix=(currentLocation.altitude/(1000.0*AU)) / a;
213
214 double rhoSinPhiPrime= bByA * sin(u) + altFix*sin(latRad);
215 double rhoCosPhiPrime= cos(u) + altFix*cos(latRad);
216
217 double rho = sqrt(rhoSinPhiPrime*rhoSinPhiPrime+rhoCosPhiPrime*rhoCosPhiPrime);
218 return rho*a;
197}219}
198220
199Mat4d StelObserver::getRotAltAzToEquatorial(double jd) const221Mat4d StelObserver::getRotAltAzToEquatorial(double jd) const
200{222{
201 double lat = currentLocation.latitude;223 double lat = currentLocation.latitude;
202 // TODO: Figure out how to keep continuity in sky as reach poles224 // TODO: Figure out how to keep continuity in sky as we reach poles
203 // otherwise sky jumps in rotation when reach poles in equatorial mode225 // otherwise sky jumps in rotation when reach poles in equatorial mode
204 // This is a kludge226 // This is a kludge
227 // GZ: Actually, why would that be? Lat should be clamped elsewhere. Added tests.
228 Q_ASSERT(lat <= 90.0);
229 Q_ASSERT(lat >= -90.0);
205 if( lat > 90.0 ) lat = 90.0;230 if( lat > 90.0 ) lat = 90.0;
206 if( lat < -90.0 ) lat = -90.0;231 if( lat < -90.0 ) lat = -90.0;
207 // Include a DeltaT correction. Sidereal time and longitude here are both in degrees, but DeltaT in seconds of time.232 // Include a DeltaT correction. Sidereal time and longitude here are both in degrees, but DeltaT in seconds of time.
208 // 360 degrees = 24hrs; 15 degrees = 1hr = 3600s; 1 degree = 240s233 // 360 degrees = 24hrs; 15 degrees = 1hr = 3600s; 1 degree = 240s
209 // Apply DeltaT correction only for Earth234 // Apply DeltaT correction only for Earth
235 // TODO: make code readable by calling siderealTime(JD_UT), this should not contain a deltaT in its algorithm.
210 double deltaT = 0.;236 double deltaT = 0.;
211 if (getHomePlanet()->getEnglishName()=="Earth")237 if (getHomePlanet()->getEnglishName()=="Earth")
212 deltaT = StelApp::getInstance().getCore()->getDeltaT(jd)/240.;238 deltaT = StelApp::getInstance().getCore()->getDeltaT(jd)/240.;
213239
=== modified file 'src/core/VecMath.hpp'
--- src/core/VecMath.hpp 2015-04-01 14:36:44 +0000
+++ src/core/VecMath.hpp 2015-07-28 19:18:20 +0000
@@ -241,6 +241,7 @@
241 inline void normalize();241 inline void normalize();
242242
243 inline void transfo4d(const Mat4d&);243 inline void transfo4d(const Mat4d&);
244 QString toString() const {return QString("[%1, %2, %3, %4]").arg(v[0]).arg(v[1]).arg(v[2]).arg(v[3]);}
244245
245 T v[4]; // The 4 values246 T v[4]; // The 4 values
246};247};
@@ -273,8 +274,22 @@
273274
274 Matrix3<T> transpose() const;275 Matrix3<T> transpose() const;
275 Matrix3<T> inverse() const;276 Matrix3<T> inverse() const;
277 //! return trace (sum of diagonal elements).
278 inline T trace() const {return r[0]+r[4]+r[8];}
279 //! return rotational angle
280 inline T angle() const {return acos(0.5*(this->trace()-1.0));}
276281
277 inline void print(void) const;282 inline void print(void) const;
283 QString toString(int fieldWidth=0, char format='g', int precision=-1) const {return QString("[[%1, %2, %3], [%4, %5, %6], [%7, %8, %9]]")
284 .arg(r[0], fieldWidth, format, precision)
285 .arg(r[1], fieldWidth, format, precision)
286 .arg(r[2], fieldWidth, format, precision)
287 .arg(r[3], fieldWidth, format, precision)
288 .arg(r[4], fieldWidth, format, precision)
289 .arg(r[5], fieldWidth, format, precision)
290 .arg(r[6], fieldWidth, format, precision)
291 .arg(r[7], fieldWidth, format, precision)
292 .arg(r[8], fieldWidth, format, precision);}
278293
279 T r[9];294 T r[9];
280};295};
@@ -322,8 +337,9 @@
322 Matrix4<T> transpose() const;337 Matrix4<T> transpose() const;
323 Matrix4<T> inverse() const;338 Matrix4<T> inverse() const;
324339
325 //Returns the upper 3x3 Matrix of the current 4x4 Matrix340 //Returns the upper 3x3 Matrix of the current 4x4 Matrix
326 Matrix3<T> upper3x3() const;341 Matrix3<T> upper3x3() const;
342 Matrix3<T> upper3x3Transposed() const;
327343
328 inline Vector4<T> getRow(const int row) const;344 inline Vector4<T> getRow(const int row) const;
329 inline Vector4<T> getColumn(const int column) const;345 inline Vector4<T> getColumn(const int column) const;
@@ -332,6 +348,23 @@
332 inline QMatrix4x4 convertToQMatrix() const;348 inline QMatrix4x4 convertToQMatrix() const;
333349
334 inline void print(void) const;350 inline void print(void) const;
351 QString toString(int fieldWidth=0, char format='g', int precision=-1) const {return QString("[[%1, %2, %3, %4], [%5, %6, %7, %8], [%9, %10, %11, %12], [%13, %14, %15, %16]]")
352 .arg(r[0], fieldWidth, format, precision)
353 .arg(r[1], fieldWidth, format, precision)
354 .arg(r[2], fieldWidth, format, precision)
355 .arg(r[3], fieldWidth, format, precision)
356 .arg(r[4], fieldWidth, format, precision)
357 .arg(r[5], fieldWidth, format, precision)
358 .arg(r[6], fieldWidth, format, precision)
359 .arg(r[7], fieldWidth, format, precision)
360 .arg(r[8], fieldWidth, format, precision)
361 .arg(r[9], fieldWidth, format, precision)
362 .arg(r[10], fieldWidth, format, precision)
363 .arg(r[11], fieldWidth, format, precision)
364 .arg(r[12], fieldWidth, format, precision)
365 .arg(r[13], fieldWidth, format, precision)
366 .arg(r[14], fieldWidth, format, precision)
367 .arg(r[15], fieldWidth, format, precision);}
335368
336 T r[16];369 T r[16];
337};370};
@@ -1467,8 +1500,15 @@
1467 #undef SWAP_ROWS1500 #undef SWAP_ROWS
1468}1501}
14691502
1503
1470template<class T> Matrix3<T> Matrix4<T>::upper3x3() const1504template<class T> Matrix3<T> Matrix4<T>::upper3x3() const
1471{1505{
1506 return Matrix3<T>(r[0], r[1], r[2],
1507 r[4], r[5], r[6],
1508 r[8], r[9], r[10]);
1509}
1510template<class T> Matrix3<T> Matrix4<T>::upper3x3Transposed() const
1511{
1472 return Matrix3<T>(r[0], r[4], r[8],1512 return Matrix3<T>(r[0], r[4], r[8],
1473 r[1], r[5], r[9],1513 r[1], r[5], r[9],
1474 r[2], r[6], r[10]);1514 r[2], r[6], r[10]);
14751515
=== modified file 'src/core/modules/GridLinesMgr.cpp'
--- src/core/modules/GridLinesMgr.cpp 2015-03-26 15:44:34 +0000
+++ src/core/modules/GridLinesMgr.cpp 2015-07-28 19:18:20 +0000
@@ -29,6 +29,7 @@
29#include "StelCore.hpp"29#include "StelCore.hpp"
30#include "StelPainter.hpp"30#include "StelPainter.hpp"
31#include "StelSkyDrawer.hpp"31#include "StelSkyDrawer.hpp"
32#include "precession.h"
3233
33#include <set>34#include <set>
34#include <QSettings>35#include <QSettings>
@@ -66,15 +67,19 @@
66public:67public:
67 enum SKY_LINE_TYPE68 enum SKY_LINE_TYPE
68 {69 {
69 EQUATOR,70 EQUATOR_J2000,
70 ECLIPTIC,71 EQUATOR_OF_DATE,
72 ECLIPTIC_J2000,
73 ECLIPTIC_OF_DATE,
74 PRECESSIONCIRCLE_N,
75 PRECESSIONCIRCLE_S,
71 MERIDIAN,76 MERIDIAN,
72 HORIZON,77 HORIZON,
73 GALACTICEQUATOR,78 GALACTICEQUATOR,
74 LONGITUDE79 LONGITUDE
75 };80 };
76 // Create and precompute positions of a SkyGrid81 // Create and precompute positions of a SkyGrid
77 SkyLine(SKY_LINE_TYPE _line_type = EQUATOR);82 SkyLine(SKY_LINE_TYPE _line_type = EQUATOR_J2000);
78 virtual ~SkyLine();83 virtual ~SkyLine();
79 void draw(StelCore* core) const;84 void draw(StelCore* core) const;
80 void setColor(const Vec3f& c) {color = c;}85 void setColor(const Vec3f& c) {color = c;}
@@ -202,7 +207,8 @@
202207
203 break; 208 break;
204 }209 }
205 case StelCore::FrameObservercentricEcliptic: 210 case StelCore::FrameObservercentricEclipticJ2000:
211 case StelCore::FrameObservercentricEclipticOfDate:
206 {212 {
207 double raAngle = d->raAngle;213 double raAngle = d->raAngle;
208 if (raAngle<0.)214 if (raAngle<0.)
@@ -355,12 +361,11 @@
355 if (QOpenGLContext::currentContext()->format().renderableType()==QSurfaceFormat::OpenGL)361 if (QOpenGLContext::currentContext()->format().renderableType()==QSurfaceFormat::OpenGL)
356 glEnable(GL_LINE_SMOOTH);362 glEnable(GL_LINE_SMOOTH);
357 #endif363 #endif
358 Vec4f textColor(color[0], color[1], color[2], 0);364
365 // make text colors just a bit brighter. (But if >1, QColor::setRgb fails and makes text invisible.)
366 Vec4f textColor(qMin(1.0f, 1.25f*color[0]), qMin(1.0f, 1.25f*color[1]), qMin(1.0f, 1.25f*color[2]), fader.getInterstate());
359 sPainter.setColor(color[0],color[1],color[2], fader.getInterstate());367 sPainter.setColor(color[0],color[1],color[2], fader.getInterstate());
360368
361 textColor*=2;
362 textColor[3]=fader.getInterstate();
363
364 sPainter.setFont(font);369 sPainter.setFont(font);
365 ViewportEdgeIntersectCallbackData userData(&sPainter);370 ViewportEdgeIntersectCallbackData userData(&sPainter);
366 userData.textColor = textColor;371 userData.textColor = textColor;
@@ -586,14 +591,27 @@
586 frameType = StelCore::FrameAltAz;591 frameType = StelCore::FrameAltAz;
587 label = q_("Meridian");592 label = q_("Meridian");
588 break;593 break;
589 case ECLIPTIC:594 case ECLIPTIC_J2000:
590 frameType = StelCore::FrameObservercentricEcliptic;595 frameType = StelCore::FrameObservercentricEclipticJ2000;
591 label = q_("Ecliptic");596 label = q_("Ecliptic of J2000.0");
592 break;597 break;
593 case EQUATOR:598 case ECLIPTIC_OF_DATE:
599 frameType = StelCore::FrameObservercentricEclipticOfDate;
600 label = q_("Ecliptic of Date");
601 break;
602 case EQUATOR_J2000:
603 frameType = StelCore::FrameJ2000;
604 label = q_("Equator of J2000.0");
605 break;
606 case EQUATOR_OF_DATE:
594 frameType = StelCore::FrameEquinoxEqu;607 frameType = StelCore::FrameEquinoxEqu;
595 label = q_("Equator");608 label = q_("Equator");
596 break;609 break;
610 case PRECESSIONCIRCLE_N:
611 case PRECESSIONCIRCLE_S:
612 frameType = StelCore::FrameObservercentricEclipticOfDate;
613 label = q_("Precession Circle");
614 break;
597 case HORIZON:615 case HORIZON:
598 frameType = StelCore::FrameAltAz;616 frameType = StelCore::FrameAltAz;
599 label = q_("Horizon");617 label = q_("Horizon");
@@ -603,10 +621,12 @@
603 label = q_("Galactic Equator");621 label = q_("Galactic Equator");
604 break;622 break;
605 case LONGITUDE:623 case LONGITUDE:
606 frameType = StelCore::FrameObservercentricEcliptic;624 frameType = StelCore::FrameObservercentricEclipticJ2000; // TODO: Switch to FrameObservercentriEclipticOfDate
607 // TRANSLATORS: Full term is "opposition/conjunction longitude"625 // TRANSLATORS: Full term is "opposition/conjunction longitude"
608 label = q_("O./C. longitude");626 label = q_("O./C. longitude");
609 break;627 break;
628 default:
629 Q_ASSERT(0);
610 }630 }
611}631}
612632
@@ -625,7 +645,10 @@
625 sPainter.setColor(color[0], color[1], color[2], fader.getInterstate());645 sPainter.setColor(color[0], color[1], color[2], fader.getInterstate());
626 glEnable(GL_BLEND);646 glEnable(GL_BLEND);
627 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal transparency mode647 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal transparency mode
628648 #ifdef GL_LINE_SMOOTH
649 if (QOpenGLContext::currentContext()->format().renderableType()==QSurfaceFormat::OpenGL)
650 glEnable(GL_LINE_SMOOTH);
651 #endif
629 Vec4f textColor(color[0], color[1], color[2], 0); 652 Vec4f textColor(color[0], color[1], color[2], 0);
630 textColor[3]=fader.getInterstate();653 textColor[3]=fader.getInterstate();
631654
@@ -635,6 +658,79 @@
635 userData.text = label;658 userData.text = label;
636 /////////////////////////////////////////////////659 /////////////////////////////////////////////////
637 // Draw the line660 // Draw the line
661
662 // Precession circles are Small Circles, all others are Great Circles.
663 if (line_type==PRECESSIONCIRCLE_N || line_type==PRECESSIONCIRCLE_S)
664 {
665 const double lat=(line_type==PRECESSIONCIRCLE_S ? -1.0 : 1.0) * (M_PI/2.0-getPrecessionAngleVondrakCurrentEpsilonA());
666 SphericalCap declinationCap(Vec3d(0,0,1), std::sin(lat));
667 const Vec3d rotCenter(0,0,declinationCap.d);
668
669 Vec3d p1, p2;
670 if (!SphericalCap::intersectionPoints(viewPortSphericalCap, declinationCap, p1, p2))
671 {
672 if ((viewPortSphericalCap.d<declinationCap.d && viewPortSphericalCap.contains(declinationCap.n))
673 || (viewPortSphericalCap.d<-declinationCap.d && viewPortSphericalCap.contains(-declinationCap.n)))
674 {
675 // The line is fully included in the viewport, draw it in 3 sub-arcs to avoid length > 180.
676 Vec3d pt1;
677 Vec3d pt2;
678 Vec3d pt3;
679 const double lon1=0.0;
680 const double lon2=120.0*M_PI/180.0;
681 const double lon3=240.0*M_PI/180.0;
682 StelUtils::spheToRect(lon1, lat, pt1); pt1.normalize();
683 StelUtils::spheToRect(lon2, lat, pt2); pt2.normalize();
684 StelUtils::spheToRect(lon3, lat, pt3); pt3.normalize();
685
686 sPainter.drawSmallCircleArc(pt1, pt2, rotCenter, viewportEdgeIntersectCallback, &userData);
687 sPainter.drawSmallCircleArc(pt2, pt3, rotCenter, viewportEdgeIntersectCallback, &userData);
688 sPainter.drawSmallCircleArc(pt3, pt1, rotCenter, viewportEdgeIntersectCallback, &userData);
689 #ifdef GL_LINE_SMOOTH
690 if (QOpenGLContext::currentContext()->format().renderableType()==QSurfaceFormat::OpenGL)
691 glDisable(GL_LINE_SMOOTH);
692 #endif
693 glDisable(GL_BLEND);
694 return;
695 }
696 else
697 {
698 #ifdef GL_LINE_SMOOTH
699 if (QOpenGLContext::currentContext()->format().renderableType()==QSurfaceFormat::OpenGL)
700 glDisable(GL_LINE_SMOOTH);
701 #endif
702 glDisable(GL_BLEND);
703 return;
704 }
705 }
706 // Draw the arc in 2 sub-arcs to avoid lengths > 180 deg
707 Vec3d middlePoint = p1-rotCenter+p2-rotCenter;
708 middlePoint.normalize();
709 middlePoint*=(p1-rotCenter).length();
710 middlePoint+=rotCenter;
711 if (!viewPortSphericalCap.contains(middlePoint))
712 {
713 middlePoint-=rotCenter;
714 middlePoint*=-1.;
715 middlePoint+=rotCenter;
716 }
717
718 sPainter.drawSmallCircleArc(p1, middlePoint, rotCenter,viewportEdgeIntersectCallback, &userData);
719 sPainter.drawSmallCircleArc(p2, middlePoint, rotCenter, viewportEdgeIntersectCallback, &userData);
720
721 // OpenGL ES 2.0 doesn't have GL_LINE_SMOOTH
722 #ifdef GL_LINE_SMOOTH
723 if (QOpenGLContext::currentContext()->format().renderableType()==QSurfaceFormat::OpenGL)
724 glDisable(GL_LINE_SMOOTH);
725 #endif
726
727 glDisable(GL_BLEND);
728
729
730 return;
731 }
732
733 // All the other "lines" are Great Circles
638 SphericalCap meridianSphericalCap(Vec3d(0,0,1), 0); 734 SphericalCap meridianSphericalCap(Vec3d(0,0,1), 0);
639 Vec3d fpt(1,0,0);735 Vec3d fpt(1,0,0);
640 if (line_type==MERIDIAN)736 if (line_type==MERIDIAN)
@@ -683,6 +779,14 @@
683 sPainter.drawGreatCircleArc(p1, middlePoint, NULL, viewportEdgeIntersectCallback, &userData);779 sPainter.drawGreatCircleArc(p1, middlePoint, NULL, viewportEdgeIntersectCallback, &userData);
684 sPainter.drawGreatCircleArc(p2, middlePoint, NULL, viewportEdgeIntersectCallback, &userData);780 sPainter.drawGreatCircleArc(p2, middlePoint, NULL, viewportEdgeIntersectCallback, &userData);
685781
782 // OpenGL ES 2.0 doesn't have GL_LINE_SMOOTH
783 #ifdef GL_LINE_SMOOTH
784 if (QOpenGLContext::currentContext()->format().renderableType()==QSurfaceFormat::OpenGL)
785 glDisable(GL_LINE_SMOOTH);
786 #endif
787
788 glDisable(GL_BLEND);
789
686// // Johannes: use a big radius as a dirty workaround for the bug that the790// // Johannes: use a big radius as a dirty workaround for the bug that the
687// // ecliptic line is not drawn around the observer, but around the sun:791// // ecliptic line is not drawn around the observer, but around the sun:
688// const Vec3d vv(1000000,0,0);792// const Vec3d vv(1000000,0,0);
@@ -694,11 +798,16 @@
694 setObjectName("GridLinesMgr");798 setObjectName("GridLinesMgr");
695 equGrid = new SkyGrid(StelCore::FrameEquinoxEqu);799 equGrid = new SkyGrid(StelCore::FrameEquinoxEqu);
696 equJ2000Grid = new SkyGrid(StelCore::FrameJ2000);800 equJ2000Grid = new SkyGrid(StelCore::FrameJ2000);
697 eclJ2000Grid = new SkyGrid(StelCore::FrameObservercentricEcliptic);801 eclJ2000Grid = new SkyGrid(StelCore::FrameObservercentricEclipticJ2000);
802 eclGrid = new SkyGrid(StelCore::FrameObservercentricEclipticOfDate);
698 galacticGrid = new SkyGrid(StelCore::FrameGalactic);803 galacticGrid = new SkyGrid(StelCore::FrameGalactic);
699 aziGrid = new SkyGrid(StelCore::FrameAltAz);804 aziGrid = new SkyGrid(StelCore::FrameAltAz);
700 equatorLine = new SkyLine(SkyLine::EQUATOR);805 equatorLine = new SkyLine(SkyLine::EQUATOR_OF_DATE);
701 eclipticLine = new SkyLine(SkyLine::ECLIPTIC);806 equatorJ2000Line = new SkyLine(SkyLine::EQUATOR_J2000);
807 eclipticJ2000Line = new SkyLine(SkyLine::ECLIPTIC_J2000); // previous eclipticLine
808 eclipticLine = new SkyLine(SkyLine::ECLIPTIC_OF_DATE); // GZ NEW
809 precessionCircleN = new SkyLine(SkyLine::PRECESSIONCIRCLE_N);
810 precessionCircleS = new SkyLine(SkyLine::PRECESSIONCIRCLE_S);
702 meridianLine = new SkyLine(SkyLine::MERIDIAN);811 meridianLine = new SkyLine(SkyLine::MERIDIAN);
703 horizonLine = new SkyLine(SkyLine::HORIZON);812 horizonLine = new SkyLine(SkyLine::HORIZON);
704 galacticEquatorLine = new SkyLine(SkyLine::GALACTICEQUATOR);813 galacticEquatorLine = new SkyLine(SkyLine::GALACTICEQUATOR);
@@ -710,10 +819,15 @@
710 delete equGrid;819 delete equGrid;
711 delete equJ2000Grid;820 delete equJ2000Grid;
712 delete eclJ2000Grid;821 delete eclJ2000Grid;
822 delete eclGrid;
713 delete galacticGrid;823 delete galacticGrid;
714 delete aziGrid;824 delete aziGrid;
715 delete equatorLine;825 delete equatorLine;
826 delete equatorJ2000Line;
716 delete eclipticLine;827 delete eclipticLine;
828 delete eclipticJ2000Line;
829 delete precessionCircleN;
830 delete precessionCircleS;
717 delete meridianLine;831 delete meridianLine;
718 delete horizonLine;832 delete horizonLine;
719 delete galacticEquatorLine;833 delete galacticEquatorLine;
@@ -739,9 +853,13 @@
739 setFlagEquatorGrid(conf->value("viewing/flag_equatorial_grid").toBool());853 setFlagEquatorGrid(conf->value("viewing/flag_equatorial_grid").toBool());
740 setFlagEquatorJ2000Grid(conf->value("viewing/flag_equatorial_J2000_grid").toBool());854 setFlagEquatorJ2000Grid(conf->value("viewing/flag_equatorial_J2000_grid").toBool());
741 setFlagEclipticJ2000Grid(conf->value("viewing/flag_ecliptic_J2000_grid").toBool());855 setFlagEclipticJ2000Grid(conf->value("viewing/flag_ecliptic_J2000_grid").toBool());
856 setFlagEclipticGrid(conf->value("viewing/flag_ecliptic_grid").toBool());
742 setFlagGalacticGrid(conf->value("viewing/flag_galactic_grid").toBool());857 setFlagGalacticGrid(conf->value("viewing/flag_galactic_grid").toBool());
743 setFlagEquatorLine(conf->value("viewing/flag_equator_line").toBool());858 setFlagEquatorLine(conf->value("viewing/flag_equator_line").toBool());
859 setFlagEquatorJ2000Line(conf->value("viewing/flag_equator_J2000_line").toBool());
744 setFlagEclipticLine(conf->value("viewing/flag_ecliptic_line").toBool());860 setFlagEclipticLine(conf->value("viewing/flag_ecliptic_line").toBool());
861 setFlagEclipticJ2000Line(conf->value("viewing/flag_ecliptic_J2000_line").toBool());
862 setFlagPrecessionCircles(conf->value("viewing/flag_precession_circles").toBool());
745 setFlagMeridianLine(conf->value("viewing/flag_meridian_line").toBool());863 setFlagMeridianLine(conf->value("viewing/flag_meridian_line").toBool());
746 setFlagHorizonLine(conf->value("viewing/flag_horizon_line").toBool());864 setFlagHorizonLine(conf->value("viewing/flag_horizon_line").toBool());
747 setFlagGalacticEquatorLine(conf->value("viewing/flag_galactic_equator_line").toBool());865 setFlagGalacticEquatorLine(conf->value("viewing/flag_galactic_equator_line").toBool());
@@ -755,14 +873,18 @@
755 addAction("actionShow_Equatorial_Grid", displayGroup, N_("Equatorial grid"), "equatorGridDisplayed", "E");873 addAction("actionShow_Equatorial_Grid", displayGroup, N_("Equatorial grid"), "equatorGridDisplayed", "E");
756 addAction("actionShow_Azimuthal_Grid", displayGroup, N_("Azimuthal grid"), "azimuthalGridDisplayed", "Z");874 addAction("actionShow_Azimuthal_Grid", displayGroup, N_("Azimuthal grid"), "azimuthalGridDisplayed", "Z");
757 addAction("actionShow_Ecliptic_Line", displayGroup, N_("Ecliptic line"), "eclipticLineDisplayed", ",");875 addAction("actionShow_Ecliptic_Line", displayGroup, N_("Ecliptic line"), "eclipticLineDisplayed", ",");
876 addAction("actionShow_Ecliptic_J2000_Line", displayGroup, N_("Ecliptic J2000 line"), "eclipticJ2000LineDisplayed");
758 addAction("actionShow_Equator_Line", displayGroup, N_("Equator line"), "equatorLineDisplayed", ".");877 addAction("actionShow_Equator_Line", displayGroup, N_("Equator line"), "equatorLineDisplayed", ".");
878 addAction("actionShow_Equator_J2000_Line", displayGroup, N_("Equator J2000 line"), "equatorJ2000LineDisplayed"); // or with Hotkey??
759 addAction("actionShow_Meridian_Line", displayGroup, N_("Meridian line"), "meridianLineDisplayed", ";");879 addAction("actionShow_Meridian_Line", displayGroup, N_("Meridian line"), "meridianLineDisplayed", ";");
760 addAction("actionShow_Horizon_Line", displayGroup, N_("Horizon line"), "horizonLineDisplayed", "H");880 addAction("actionShow_Horizon_Line", displayGroup, N_("Horizon line"), "horizonLineDisplayed", "H");
761 addAction("actionShow_Equatorial_J2000_Grid", displayGroup, N_("Equatorial J2000 grid"), "equatorJ2000GridDisplayed");881 addAction("actionShow_Equatorial_J2000_Grid", displayGroup, N_("Equatorial J2000 grid"), "equatorJ2000GridDisplayed");
762 addAction("actionShow_Ecliptic_J2000_Grid", displayGroup, N_("Ecliptic J2000 grid"), "eclipticJ2000GridDisplayed");882 addAction("actionShow_Ecliptic_J2000_Grid", displayGroup, N_("Ecliptic J2000 grid"), "eclipticJ2000GridDisplayed");
883 addAction("actionShow_Ecliptic_Grid", displayGroup, N_("Ecliptic grid"), "eclipticGridDisplayed");
763 addAction("actionShow_Galactic_Grid", displayGroup, N_("Galactic grid"), "galacticGridDisplayed");884 addAction("actionShow_Galactic_Grid", displayGroup, N_("Galactic grid"), "galacticGridDisplayed");
764 addAction("actionShow_Galactic_Equator_Line", displayGroup, N_("Galactic equator"), "galacticEquatorLineDisplayed");885 addAction("actionShow_Galactic_Equator_Line", displayGroup, N_("Galactic equator"), "galacticEquatorLineDisplayed");
765 addAction("actionShow_Longitude_Line", displayGroup, N_("Opposition/conjunction longitude line"), "longitudeLineDisplayed");886 addAction("actionShow_Longitude_Line", displayGroup, N_("Opposition/conjunction longitude line"), "longitudeLineDisplayed");
887 addAction("actionShow_Precession_Circles", displayGroup, N_("Precession Circles"), "precessionCirclesDisplayed");
766}888}
767889
768void GridLinesMgr::update(double deltaTime)890void GridLinesMgr::update(double deltaTime)
@@ -771,10 +893,15 @@
771 equGrid->update(deltaTime);893 equGrid->update(deltaTime);
772 equJ2000Grid->update(deltaTime);894 equJ2000Grid->update(deltaTime);
773 eclJ2000Grid->update(deltaTime);895 eclJ2000Grid->update(deltaTime);
896 eclGrid->update(deltaTime);
774 galacticGrid->update(deltaTime);897 galacticGrid->update(deltaTime);
775 aziGrid->update(deltaTime);898 aziGrid->update(deltaTime);
776 equatorLine->update(deltaTime);899 equatorLine->update(deltaTime);
900 equatorJ2000Line->update(deltaTime);
777 eclipticLine->update(deltaTime);901 eclipticLine->update(deltaTime);
902 eclipticJ2000Line->update(deltaTime);
903 precessionCircleN->update(deltaTime);
904 precessionCircleS->update(deltaTime);
778 meridianLine->update(deltaTime);905 meridianLine->update(deltaTime);
779 horizonLine->update(deltaTime);906 horizonLine->update(deltaTime);
780 galacticEquatorLine->update(deltaTime);907 galacticEquatorLine->update(deltaTime);
@@ -783,17 +910,30 @@
783910
784void GridLinesMgr::draw(StelCore* core)911void GridLinesMgr::draw(StelCore* core)
785{912{
786 equGrid->draw(core);
787 galacticGrid->draw(core);913 galacticGrid->draw(core);
914 eclJ2000Grid->draw(core);
915 // While ecliptic of J2000 may be helpful to get a feeling of the Z=0 plane of VSOP87,
916 // ecliptic of date is related to Earth and does not make much sense for the other planets.
917 // Of course, orbital plane of respective planet would be better, but is not implemented.
918 if (core->getCurrentPlanet()->getEnglishName()=="Earth")
919 eclGrid->draw(core);
788 equJ2000Grid->draw(core);920 equJ2000Grid->draw(core);
789 eclJ2000Grid->draw(core);921 equGrid->draw(core);
790 aziGrid->draw(core);922 aziGrid->draw(core);
923 // Lines after grids, to be able to e.g. draw equators in different color!
924 galacticEquatorLine->draw(core);
925 eclipticJ2000Line->draw(core);
926 if (core->getCurrentPlanet()->getEnglishName()=="Earth")
927 {
928 eclipticLine->draw(core);
929 precessionCircleN->draw(core);
930 precessionCircleS->draw(core);
931 }
932 longitudeLine->draw(core);
933 equatorJ2000Line->draw(core);
791 equatorLine->draw(core);934 equatorLine->draw(core);
792 eclipticLine->draw(core);
793 meridianLine->draw(core);935 meridianLine->draw(core);
794 horizonLine->draw(core);936 horizonLine->draw(core);
795 galacticEquatorLine->draw(core);
796 longitudeLine->draw(core);
797}937}
798938
799void GridLinesMgr::setStelStyle(const QString& section)939void GridLinesMgr::setStelStyle(const QString& section)
@@ -804,11 +944,14 @@
804 QString defaultColor = conf->value(section+"/default_color").toString();944 QString defaultColor = conf->value(section+"/default_color").toString();
805 setColorEquatorGrid(StelUtils::strToVec3f(conf->value(section+"/equatorial_color", defaultColor).toString()));945 setColorEquatorGrid(StelUtils::strToVec3f(conf->value(section+"/equatorial_color", defaultColor).toString()));
806 setColorEquatorJ2000Grid(StelUtils::strToVec3f(conf->value(section+"/equatorial_J2000_color", defaultColor).toString()));946 setColorEquatorJ2000Grid(StelUtils::strToVec3f(conf->value(section+"/equatorial_J2000_color", defaultColor).toString()));
807 setColorEclipticJ2000Grid(StelUtils::strToVec3f(conf->value(section+"/ecliptic_J2000_color", defaultColor).toString()));947 setColorEclipticJ2000Grid(StelUtils::strToVec3f(conf->value(section+"/ecliptical_J2000_color", defaultColor).toString()));
948 setColorEclipticGrid(StelUtils::strToVec3f(conf->value(section+"/ecliptical_color", defaultColor).toString()));
808 setColorGalacticGrid(StelUtils::strToVec3f(conf->value(section+"/galactic_color", defaultColor).toString()));949 setColorGalacticGrid(StelUtils::strToVec3f(conf->value(section+"/galactic_color", defaultColor).toString()));
809 setColorAzimuthalGrid(StelUtils::strToVec3f(conf->value(section+"/azimuthal_color", defaultColor).toString()));950 setColorAzimuthalGrid(StelUtils::strToVec3f(conf->value(section+"/azimuthal_color", defaultColor).toString()));
810 setColorEquatorLine(StelUtils::strToVec3f(conf->value(section+"/equator_color", defaultColor).toString()));951 setColorEquatorLine(StelUtils::strToVec3f(conf->value(section+"/equator_color", defaultColor).toString()));
811 setColorEclipticLine(StelUtils::strToVec3f(conf->value(section+"/ecliptic_color", defaultColor).toString()));952 setColorEclipticLine(StelUtils::strToVec3f(conf->value(section+"/ecliptic_color", defaultColor).toString()));
953 setColorEclipticJ2000Line(StelUtils::strToVec3f(conf->value(section+"/ecliptic_J2000_color", defaultColor).toString()));
954 setColorPrecessionCircles(StelUtils::strToVec3f(conf->value(section+"/precession_circles_color", defaultColor).toString()));
812 setColorMeridianLine(StelUtils::strToVec3f(conf->value(section+"/meridian_color", defaultColor).toString()));955 setColorMeridianLine(StelUtils::strToVec3f(conf->value(section+"/meridian_color", defaultColor).toString()));
813 setColorHorizonLine(StelUtils::strToVec3f(conf->value(section+"/horizon_color", defaultColor).toString()));956 setColorHorizonLine(StelUtils::strToVec3f(conf->value(section+"/horizon_color", defaultColor).toString()));
814 setColorGalacticEquatorLine(StelUtils::strToVec3f(conf->value(section+"/galactic_equator_color", defaultColor).toString()));957 setColorGalacticEquatorLine(StelUtils::strToVec3f(conf->value(section+"/galactic_equator_color", defaultColor).toString()));
@@ -817,8 +960,12 @@
817960
818void GridLinesMgr::updateLineLabels()961void GridLinesMgr::updateLineLabels()
819{962{
963 equatorJ2000Line->updateLabel();
820 equatorLine->updateLabel();964 equatorLine->updateLabel();
821 eclipticLine->updateLabel();965 eclipticLine->updateLabel();
966 eclipticJ2000Line->updateLabel();
967 precessionCircleN->updateLabel();
968 precessionCircleS->updateLabel();
822 meridianLine->updateLabel();969 meridianLine->updateLabel();
823 horizonLine->updateLabel();970 horizonLine->updateLabel();
824 galacticEquatorLine->updateLabel();971 galacticEquatorLine->updateLabel();
@@ -925,6 +1072,31 @@
925 }1072 }
926}1073}
9271074
1075//! Set flag for displaying Ecliptic of Date Grid
1076void GridLinesMgr::setFlagEclipticGrid(const bool displayed)
1077{
1078 if(displayed != eclGrid->isDisplayed()) {
1079 eclGrid->setDisplayed(displayed);
1080 emit eclipticGridDisplayedChanged(displayed);
1081 }
1082}
1083//! Get flag for displaying Ecliptic of Date Grid
1084bool GridLinesMgr::getFlagEclipticGrid(void) const
1085{
1086 return eclGrid->isDisplayed();
1087}
1088Vec3f GridLinesMgr::getColorEclipticGrid(void) const
1089{
1090 return eclGrid->getColor();
1091}
1092void GridLinesMgr::setColorEclipticGrid(const Vec3f& newColor)
1093{
1094 if(newColor != eclGrid->getColor()) {
1095 eclGrid->setColor(newColor);
1096 emit eclipticGridColorChanged(newColor);
1097 }
1098}
1099
928//! Set flag for displaying Galactic Grid1100//! Set flag for displaying Galactic Grid
929void GridLinesMgr::setFlagGalacticGrid(const bool displayed)1101void GridLinesMgr::setFlagGalacticGrid(const bool displayed)
930{1102{
@@ -975,6 +1147,31 @@
975 }1147 }
976}1148}
9771149
1150//! Set flag for displaying J2000 Equatorial Line
1151void GridLinesMgr::setFlagEquatorJ2000Line(const bool displayed)
1152{
1153 if(displayed != equatorJ2000Line->isDisplayed()) {
1154 equatorJ2000Line->setDisplayed(displayed);
1155 emit equatorJ2000LineDisplayedChanged(displayed);
1156 }
1157}
1158//! Get flag for displaying J2000 Equatorial Line
1159bool GridLinesMgr::getFlagEquatorJ2000Line(void) const
1160{
1161 return equatorJ2000Line->isDisplayed();
1162}
1163Vec3f GridLinesMgr::getColorEquatorJ2000Line(void) const
1164{
1165 return equatorJ2000Line->getColor();
1166}
1167void GridLinesMgr::setColorEquatorJ2000Line(const Vec3f& newColor)
1168{
1169 if(newColor != equatorJ2000Line->getColor()) {
1170 equatorJ2000Line->setColor(newColor);
1171 emit equatorJ2000LineColorChanged(newColor);
1172 }
1173}
1174
978//! Set flag for displaying Ecliptic Line1175//! Set flag for displaying Ecliptic Line
979void GridLinesMgr::setFlagEclipticLine(const bool displayed)1176void GridLinesMgr::setFlagEclipticLine(const bool displayed)
980{1177{
@@ -1000,6 +1197,58 @@
1000 }1197 }
1001}1198}
10021199
1200//! Set flag for displaying Ecliptic J2000 Line
1201void GridLinesMgr::setFlagEclipticJ2000Line(const bool displayed)
1202{
1203 if(displayed != eclipticJ2000Line->isDisplayed()) {
1204 eclipticJ2000Line->setDisplayed(displayed);
1205 emit eclipticJ2000LineDisplayedChanged(displayed);
1206 }
1207}
1208//! Get flag for displaying Ecliptic J2000 Line
1209bool GridLinesMgr::getFlagEclipticJ2000Line(void) const
1210{
1211 return eclipticJ2000Line->isDisplayed();
1212}
1213Vec3f GridLinesMgr::getColorEclipticJ2000Line(void) const
1214{
1215 return eclipticJ2000Line->getColor();
1216}
1217void GridLinesMgr::setColorEclipticJ2000Line(const Vec3f& newColor)
1218{
1219 if(newColor != eclipticJ2000Line->getColor()) {
1220 eclipticJ2000Line->setColor(newColor);
1221 emit eclipticJ2000LineColorChanged(newColor);
1222 }
1223}
1224
1225//! Set flag for displaying Precession Circles
1226void GridLinesMgr::setFlagPrecessionCircles(const bool displayed)
1227{
1228 if(displayed != precessionCircleN->isDisplayed()) {
1229 precessionCircleN->setDisplayed(displayed);
1230 precessionCircleS->setDisplayed(displayed);
1231 emit precessionCirclesDisplayedChanged(displayed);
1232 }
1233}
1234//! Get flag for displaying Precession Circles
1235bool GridLinesMgr::getFlagPrecessionCircles(void) const
1236{
1237 // precessionCircleS is always synchronous, no separate queries.
1238 return precessionCircleN->isDisplayed();
1239}
1240Vec3f GridLinesMgr::getColorPrecessionCircles(void) const
1241{
1242 return precessionCircleN->getColor();
1243}
1244void GridLinesMgr::setColorPrecessionCircles(const Vec3f& newColor)
1245{
1246 if(newColor != precessionCircleN->getColor()) {
1247 precessionCircleN->setColor(newColor);
1248 precessionCircleS->setColor(newColor);
1249 emit precessionCirclesColorChanged(newColor);
1250 }
1251}
10031252
1004//! Set flag for displaying Meridian Line1253//! Set flag for displaying Meridian Line
1005void GridLinesMgr::setFlagMeridianLine(const bool displayed)1254void GridLinesMgr::setFlagMeridianLine(const bool displayed)
10061255
=== modified file 'src/core/modules/GridLinesMgr.hpp'
--- src/core/modules/GridLinesMgr.hpp 2015-02-24 16:53:57 +0000
+++ src/core/modules/GridLinesMgr.hpp 2015-07-28 19:18:20 +0000
@@ -1,6 +1,7 @@
1/*1/*
2 * Stellarium2 * Stellarium
3 * Copyright (C) 2007 Fabien Chereau3 * Copyright (C) 2007 Fabien Chereau
4 * Copyright (C) 2015 Georg Zotti (more grids to illustrate precession issues)
4 *5 *
5 * This program is free software; you can redistribute it and/or6 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License7 * modify it under the terms of the GNU General Public License
@@ -27,8 +28,9 @@
27class SkyLine;28class SkyLine;
2829
29//! @class GridLinesMgr30//! @class GridLinesMgr
30//! The GridLinesMgr controls the drawing of the Azimuthal and Equatorial Grids,31//! The GridLinesMgr controls the drawing of the Azimuthal, Equatorial, Ecliptical and Galactic Grids,
31//! as well as the great circles: Meridian Line, Ecliptic Line and Equator Line.32//! as well as the great circles: Meridian Line, Ecliptic Lines of J2000.0 and date, Equator Line (of J2000.0 and date),
33//! Precession Circles, and a special line marking conjunction or opposition in ecliptical longitude (of date).
32class GridLinesMgr : public StelModule34class GridLinesMgr : public StelModule
33{35{
34 Q_OBJECT36 Q_OBJECT
@@ -40,6 +42,7 @@
40 READ getColorAzimuthalGrid42 READ getColorAzimuthalGrid
41 WRITE setColorAzimuthalGrid43 WRITE setColorAzimuthalGrid
42 NOTIFY azimuthalGridColorChanged)44 NOTIFY azimuthalGridColorChanged)
45
43 Q_PROPERTY(bool equatorGridDisplayed46 Q_PROPERTY(bool equatorGridDisplayed
44 READ getFlagEquatorGrid47 READ getFlagEquatorGrid
45 WRITE setFlagEquatorGrid48 WRITE setFlagEquatorGrid
@@ -48,18 +51,34 @@
48 READ getColorEquatorGrid51 READ getColorEquatorGrid
49 WRITE setColorEquatorGrid52 WRITE setColorEquatorGrid
50 NOTIFY equatorGridColorChanged)53 NOTIFY equatorGridColorChanged)
54
51 Q_PROPERTY(bool equatorJ2000GridDisplayed55 Q_PROPERTY(bool equatorJ2000GridDisplayed
52 READ getFlagEquatorJ2000Grid56 READ getFlagEquatorJ2000Grid
53 WRITE setFlagEquatorJ2000Grid57 WRITE setFlagEquatorJ2000Grid
54 NOTIFY equatorJ2000GridDisplayedChanged)58 NOTIFY equatorJ2000GridDisplayedChanged)
59 Q_PROPERTY(Vec3f equatorJ2000GridColor
60 READ getColorEquatorJ2000Grid
61 WRITE setColorEquatorJ2000Grid
62 NOTIFY equatorJ2000GridColorChanged)
63
55 Q_PROPERTY(bool eclipticJ2000GridDisplayed64 Q_PROPERTY(bool eclipticJ2000GridDisplayed
56 READ getFlagEclipticJ2000Grid65 READ getFlagEclipticJ2000Grid
57 WRITE setFlagEclipticJ2000Grid66 WRITE setFlagEclipticJ2000Grid
58 NOTIFY eclipticJ2000GridDisplayedChanged)67 NOTIFY eclipticJ2000GridDisplayedChanged)
59 Q_PROPERTY(Vec3f equatorJ2000GridColor68 Q_PROPERTY(Vec3f eclipticJ2000GridColor
60 READ getColorEquatorJ2000Grid69 READ getColorEclipticJ2000Grid
61 WRITE setColorEquatorJ2000Grid70 WRITE setColorEclipticJ2000Grid
62 NOTIFY equatorJ2000GridColorChanged)71 NOTIFY eclipticJ2000GridColorChanged)
72 // NEW
73 Q_PROPERTY(bool eclipticGridDisplayed
74 READ getFlagEclipticGrid
75 WRITE setFlagEclipticGrid
76 NOTIFY eclipticGridDisplayedChanged)
77 Q_PROPERTY(Vec3f eclipticGridColor
78 READ getColorEclipticGrid
79 WRITE setColorEclipticGrid
80 NOTIFY eclipticGridColorChanged)
81
63 Q_PROPERTY(bool galacticGridDisplayed82 Q_PROPERTY(bool galacticGridDisplayed
64 READ getFlagGalacticGrid83 READ getFlagGalacticGrid
65 WRITE setFlagGalacticGrid84 WRITE setFlagGalacticGrid
@@ -68,6 +87,7 @@
68 READ getColorGalacticGrid87 READ getColorGalacticGrid
69 WRITE setColorGalacticGrid88 WRITE setColorGalacticGrid
70 NOTIFY galacticGridColorChanged)89 NOTIFY galacticGridColorChanged)
90
71 Q_PROPERTY(bool equatorLineDisplayed91 Q_PROPERTY(bool equatorLineDisplayed
72 READ getFlagEquatorLine92 READ getFlagEquatorLine
73 WRITE setFlagEquatorLine93 WRITE setFlagEquatorLine
@@ -76,6 +96,17 @@
76 READ getColorEquatorLine96 READ getColorEquatorLine
77 WRITE setColorEquatorLine97 WRITE setColorEquatorLine
78 NOTIFY equatorLineColorChanged)98 NOTIFY equatorLineColorChanged)
99
100 Q_PROPERTY(bool equatorJ2000LineDisplayed
101 READ getFlagEquatorJ2000Line
102 WRITE setFlagEquatorJ2000Line
103 NOTIFY equatorJ2000LineDisplayedChanged)
104 Q_PROPERTY(Vec3f equatorJ2000LineColor
105 READ getColorEquatorJ2000Line
106 WRITE setColorEquatorJ2000Line
107 NOTIFY equatorJ2000LineColorChanged)
108
109 // This is now ecl. of date.
79 Q_PROPERTY(bool eclipticLineDisplayed110 Q_PROPERTY(bool eclipticLineDisplayed
80 READ getFlagEclipticLine111 READ getFlagEclipticLine
81 WRITE setFlagEclipticLine112 WRITE setFlagEclipticLine
@@ -84,6 +115,26 @@
84 READ getColorEclipticLine115 READ getColorEclipticLine
85 WRITE setColorEclipticLine116 WRITE setColorEclipticLine
86 NOTIFY eclipticLineColorChanged)117 NOTIFY eclipticLineColorChanged)
118
119 // new name, but replaces old ecliptic.
120 Q_PROPERTY(bool eclipticJ2000LineDisplayed
121 READ getFlagEclipticJ2000Line
122 WRITE setFlagEclipticJ2000Line
123 NOTIFY eclipticJ2000LineDisplayedChanged)
124 Q_PROPERTY(Vec3f eclipticJ2000LineColor
125 READ getColorEclipticJ2000Line
126 WRITE setColorEclipticJ2000Line
127 NOTIFY eclipticJ2000LineColorChanged)
128
129 Q_PROPERTY(bool precessionCirclesDisplayed
130 READ getFlagPrecessionCircles
131 WRITE setFlagPrecessionCircles
132 NOTIFY precessionCirclesDisplayedChanged)
133 Q_PROPERTY(Vec3f precessionCirclesColor
134 READ getColorPrecessionCircles
135 WRITE setColorPrecessionCircles
136 NOTIFY precessionCirclesColorChanged)
137
87 Q_PROPERTY(bool meridianLineDisplayed138 Q_PROPERTY(bool meridianLineDisplayed
88 READ getFlagMeridianLine139 READ getFlagMeridianLine
89 WRITE setFlagMeridianLine140 WRITE setFlagMeridianLine
@@ -92,6 +143,7 @@
92 READ getColorMeridianLine143 READ getColorMeridianLine
93 WRITE setColorMeridianLine144 WRITE setColorMeridianLine
94 NOTIFY meridianLineColorChanged)145 NOTIFY meridianLineColorChanged)
146
95 Q_PROPERTY(bool longitudeLineDisplayed147 Q_PROPERTY(bool longitudeLineDisplayed
96 READ getFlagLongitudeLine148 READ getFlagLongitudeLine
97 WRITE setFlagLongitudeLine149 WRITE setFlagLongitudeLine
@@ -100,6 +152,7 @@
100 READ getColorLongitudeLine152 READ getColorLongitudeLine
101 WRITE setColorLongitudeLine153 WRITE setColorLongitudeLine
102 NOTIFY longitudeLineColorChanged)154 NOTIFY longitudeLineColorChanged)
155
103 Q_PROPERTY(bool horizonLineDisplayed156 Q_PROPERTY(bool horizonLineDisplayed
104 READ getFlagHorizonLine157 READ getFlagHorizonLine
105 WRITE setFlagHorizonLine158 WRITE setFlagHorizonLine
@@ -108,6 +161,7 @@
108 READ getColorHorizonLine161 READ getColorHorizonLine
109 WRITE setColorHorizonLine162 WRITE setColorHorizonLine
110 NOTIFY horizonLineColorChanged)163 NOTIFY horizonLineColorChanged)
164
111 Q_PROPERTY(bool galacticEquatorLineDisplayed165 Q_PROPERTY(bool galacticEquatorLineDisplayed
112 READ getFlagGalacticEquatorLine166 READ getFlagGalacticEquatorLine
113 WRITE setFlagGalacticEquatorLine167 WRITE setFlagGalacticEquatorLine
@@ -125,17 +179,17 @@
125 // Methods defined in the StelModule class179 // Methods defined in the StelModule class
126 //! Initialize the GridLinesMgr. This process checks the values in the180 //! Initialize the GridLinesMgr. This process checks the values in the
127 //! application settings, and according to the settings there181 //! application settings, and according to the settings there
128 //! sets the visibility of the Equatorial Grid, Azimuthal Grid, Meridian Line,182 //! sets the visibility of the Equatorial Grids, Ecliptical Grids, Azimuthal Grid, Meridian Line,
129 //! Equator Line and Ecliptic Line.183 //! Equator Line and Ecliptic Lines.
130 virtual void init();184 virtual void init();
131185
132 //! Get the module ID, returns, "gridlines".186 //! Get the module ID, returns "GridLinesMgr".
133 virtual QString getModuleID() const {return "GridLinesMgr";}187 virtual QString getModuleID() const {return "GridLinesMgr";}
134188
135 //! Draw the grids and great circle lines.189 //! Draw the grids and great circle lines.
136 //! Draws the Equatorial Grid, Azimuthal Grid, Meridian Line, Equator Line190 //! Draws the Equatorial Grids, Ecliptical Grids, Azimuthal Grid, Meridian Line, Equator Line,
137 //! and Ecliptic Line according to the various flags which control their191 //! Ecliptic Lines, Precession Circles, and Conjunction-Opposition Line according to the
138 //! visibility.192 //! various flags which control their visibility.
139 virtual void draw(StelCore* core);193 virtual void draw(StelCore* core);
140194
141 //! Update time-dependent features.195 //! Update time-dependent features.
@@ -176,9 +230,9 @@
176 //! @endcode230 //! @endcode
177 void setColorEquatorGrid(const Vec3f& newColor);231 void setColorEquatorGrid(const Vec3f& newColor);
178232
179 //! Setter for displaying Equatorial Grid.233 //! Setter for displaying Equatorial J2000 Grid.
180 void setFlagEquatorJ2000Grid(const bool displayed);234 void setFlagEquatorJ2000Grid(const bool displayed);
181 //! Accessor for displaying Equatorial Grid.235 //! Accessor for displaying Equatorial J2000 Grid.
182 bool getFlagEquatorJ2000Grid(void) const;236 bool getFlagEquatorJ2000Grid(void) const;
183 //! Get the current color of the Equatorial J2000 Grid.237 //! Get the current color of the Equatorial J2000 Grid.
184 Vec3f getColorEquatorJ2000Grid(void) const;238 Vec3f getColorEquatorJ2000Grid(void) const;
@@ -190,7 +244,7 @@
190 //! @endcode244 //! @endcode
191 void setColorEquatorJ2000Grid(const Vec3f& newColor);245 void setColorEquatorJ2000Grid(const Vec3f& newColor);
192246
193 //! Setter for displaying Ecliptic Grid.247 //! Setter for displaying Ecliptic Grid of J2000.0.
194 void setFlagEclipticJ2000Grid(const bool displayed);248 void setFlagEclipticJ2000Grid(const bool displayed);
195 //! Accessor for displaying Ecliptic Grid.249 //! Accessor for displaying Ecliptic Grid.
196 bool getFlagEclipticJ2000Grid(void) const;250 bool getFlagEclipticJ2000Grid(void) const;
@@ -204,6 +258,20 @@
204 //! @endcode258 //! @endcode
205 void setColorEclipticJ2000Grid(const Vec3f& newColor);259 void setColorEclipticJ2000Grid(const Vec3f& newColor);
206260
261 //! Setter for displaying Ecliptic Grid of Date.
262 void setFlagEclipticGrid(const bool displayed);
263 //! Accessor for displaying Ecliptic Grid.
264 bool getFlagEclipticGrid(void) const;
265 //! Get the current color of the Ecliptic of Date Grid.
266 Vec3f getColorEclipticGrid(void) const;
267 //! Set the color of the Ecliptic Grid.
268 //! @param newColor The color of Ecliptic of Date grid
269 //! @code
270 //! // example of usage in scripts
271 //! GridLinesMgr.setColorEclipticGrid(Vec3f(1.0,0.0,0.0));
272 //! @endcode
273 void setColorEclipticGrid(const Vec3f& newColor);
274
207 //! Setter for displaying Galactic Grid.275 //! Setter for displaying Galactic Grid.
208 void setFlagGalacticGrid(const bool displayed);276 void setFlagGalacticGrid(const bool displayed);
209 //! Accessor for displaying Galactic Grid.277 //! Accessor for displaying Galactic Grid.
@@ -232,6 +300,34 @@
232 //! @endcode300 //! @endcode
233 void setColorEquatorLine(const Vec3f& newColor);301 void setColorEquatorLine(const Vec3f& newColor);
234302
303 //! Setter for displaying J2000 Equatorial Line.
304 void setFlagEquatorJ2000Line(const bool displayed);
305 //! Accessor for displaying J2000 Equatorial Line.
306 bool getFlagEquatorJ2000Line(void) const;
307 //! Get the current color of the J2000 Equatorial Line.
308 Vec3f getColorEquatorJ2000Line(void) const;
309 //! Set the color of the J2000 Equator Line.
310 //! @param newColor The color of J2000 equator line
311 //! @code
312 //! // example of usage in scripts
313 //! GridLinesMgr.setColorEquatorJ2000Line(Vec3f(1.0,0.0,0.0));
314 //! @endcode
315 void setColorEquatorJ2000Line(const Vec3f& newColor);
316
317 //! Setter for displaying Ecliptic of J2000 Line.
318 void setFlagEclipticJ2000Line(const bool displayed);
319 //! Accessor for displaying Ecliptic of J2000 Line.
320 bool getFlagEclipticJ2000Line(void) const;
321 //! Get the current color of the Ecliptic of J2000 Line.
322 Vec3f getColorEclipticJ2000Line(void) const;
323 //! Set the color of the Ecliptic of J2000 Line.
324 //! @param newColor The color of ecliptic 2000 line
325 //! @code
326 //! // example of usage in scripts
327 //! GridLinesMgr.setColorEcliptic2000Line(Vec3f(1.0,0.0,0.0));
328 //! @endcode
329 void setColorEclipticJ2000Line(const Vec3f& newColor);
330
235 //! Setter for displaying Ecliptic Line.331 //! Setter for displaying Ecliptic Line.
236 void setFlagEclipticLine(const bool displayed);332 void setFlagEclipticLine(const bool displayed);
237 //! Accessor for displaying Ecliptic Line.333 //! Accessor for displaying Ecliptic Line.
@@ -246,6 +342,20 @@
246 //! @endcode342 //! @endcode
247 void setColorEclipticLine(const Vec3f& newColor);343 void setColorEclipticLine(const Vec3f& newColor);
248344
345 //! Setter for displaying precession circles.
346 void setFlagPrecessionCircles(const bool displayed);
347 //! Accessor for displaying precession circles.
348 bool getFlagPrecessionCircles(void) const;
349 //! Get the current color of the precession circles.
350 Vec3f getColorPrecessionCircles(void) const;
351 //! Set the color of the precession circles.
352 //! @param newColor The color of precession circles
353 //! @code
354 //! // example of usage in scripts
355 //! GridLinesMgr.setColorPrecessionCircles(Vec3f(1.0,0.0,0.0));
356 //! @endcode
357 void setColorPrecessionCircles(const Vec3f& newColor);
358
249 //! Setter for displaying Meridian Line.359 //! Setter for displaying Meridian Line.
250 void setFlagMeridianLine(const bool displayed);360 void setFlagMeridianLine(const bool displayed);
251 //! Accessor for displaying Meridian Line.361 //! Accessor for displaying Meridian Line.
@@ -291,12 +401,12 @@
291 //! Setter for displaying Galactic Equator Line.401 //! Setter for displaying Galactic Equator Line.
292 void setFlagGalacticEquatorLine(const bool displayed);402 void setFlagGalacticEquatorLine(const bool displayed);
293 //! @deprecated Setter for displaying Galactic "Plane" (i.e., Equator) Line. Left here for compatibility with older scripts.403 //! @deprecated Setter for displaying Galactic "Plane" (i.e., Equator) Line. Left here for compatibility with older scripts.
294 //! @note will be delete in version 0.14404 //! @note will be deleted in version 0.14
295 void setFlagGalacticPlaneLine(const bool displayed) { setFlagGalacticEquatorLine(displayed); }405 void setFlagGalacticPlaneLine(const bool displayed) { setFlagGalacticEquatorLine(displayed); }
296 //! Accessor for displaying Galactic Equator Line.406 //! Accessor for displaying Galactic Equator Line.
297 bool getFlagGalacticEquatorLine(void) const;407 bool getFlagGalacticEquatorLine(void) const;
298 //! @deprecated Accessor for displaying Galactic "Plane" (i.e., Equator) Line. Left here for compatibility with older scripts.408 //! @deprecated Accessor for displaying Galactic "Plane" (i.e., Equator) Line. Left here for compatibility with older scripts.
299 //! @note will be delete in version 0.14409 //! @note will be deleted in version 0.14
300 bool getFlagGalacticPlaneLine(void) const { return getFlagGalacticEquatorLine(); }410 bool getFlagGalacticPlaneLine(void) const { return getFlagGalacticEquatorLine(); }
301 //! Get the current color of the Galactic Equator Line.411 //! Get the current color of the Galactic Equator Line.
302 Vec3f getColorGalacticEquatorLine(void) const;412 Vec3f getColorGalacticEquatorLine(void) const;
@@ -314,14 +424,22 @@
314 void equatorGridColorChanged(const Vec3f & newColor) const;424 void equatorGridColorChanged(const Vec3f & newColor) const;
315 void equatorJ2000GridDisplayedChanged(const bool displayed) const;425 void equatorJ2000GridDisplayedChanged(const bool displayed) const;
316 void equatorJ2000GridColorChanged(const Vec3f & newColor) const;426 void equatorJ2000GridColorChanged(const Vec3f & newColor) const;
427 void eclipticGridDisplayedChanged(const bool displayed) const;
428 void eclipticGridColorChanged(const Vec3f & newColor) const;
317 void eclipticJ2000GridDisplayedChanged(const bool displayed) const;429 void eclipticJ2000GridDisplayedChanged(const bool displayed) const;
318 void eclipticJ2000GridColorChanged(const Vec3f & newColor) const;430 void eclipticJ2000GridColorChanged(const Vec3f & newColor) const;
319 void galacticGridDisplayedChanged(const bool displayed) const;431 void galacticGridDisplayedChanged(const bool displayed) const;
320 void galacticGridColorChanged(const Vec3f & newColor) const;432 void galacticGridColorChanged(const Vec3f & newColor) const;
321 void equatorLineDisplayedChanged(const bool displayed) const;433 void equatorLineDisplayedChanged(const bool displayed) const;
322 void equatorLineColorChanged(const Vec3f & newColor) const;434 void equatorLineColorChanged(const Vec3f & newColor) const;
435 void equatorJ2000LineDisplayedChanged(const bool displayed) const;
436 void equatorJ2000LineColorChanged(const Vec3f & newColor) const;
323 void eclipticLineDisplayedChanged(const bool displayed) const;437 void eclipticLineDisplayedChanged(const bool displayed) const;
324 void eclipticLineColorChanged(const Vec3f & newColor) const;438 void eclipticLineColorChanged(const Vec3f & newColor) const;
439 void eclipticJ2000LineDisplayedChanged(const bool displayed) const;
440 void eclipticJ2000LineColorChanged(const Vec3f & newColor) const;
441 void precessionCirclesDisplayedChanged(const bool displayed) const;
442 void precessionCirclesColorChanged(const Vec3f & newColor) const;
325 void meridianLineDisplayedChanged(const bool displayed) const;443 void meridianLineDisplayedChanged(const bool displayed) const;
326 void meridianLineColorChanged(const Vec3f & newColor) const;444 void meridianLineColorChanged(const Vec3f & newColor) const;
327 void longitudeLineDisplayedChanged(const bool displayed) const;445 void longitudeLineDisplayedChanged(const bool displayed) const;
@@ -344,10 +462,15 @@
344 SkyGrid * equGrid; // Equatorial grid462 SkyGrid * equGrid; // Equatorial grid
345 SkyGrid * equJ2000Grid; // Equatorial J2000 grid463 SkyGrid * equJ2000Grid; // Equatorial J2000 grid
346 SkyGrid * galacticGrid; // Galactic grid464 SkyGrid * galacticGrid; // Galactic grid
465 SkyGrid * eclGrid; // Ecliptic of Date grid
347 SkyGrid * eclJ2000Grid; // Ecliptic J2000 grid466 SkyGrid * eclJ2000Grid; // Ecliptic J2000 grid
348 SkyGrid * aziGrid; // Azimuthal grid467 SkyGrid * aziGrid; // Azimuthal grid
349 SkyLine * equatorLine; // Celestial Equator line468 SkyLine * equatorLine; // Celestial Equator line
469 SkyLine * equatorJ2000Line; // Celestial Equator of J2000 line
350 SkyLine * eclipticLine; // Ecliptic line470 SkyLine * eclipticLine; // Ecliptic line
471 SkyLine * eclipticJ2000Line; // Ecliptic line of J2000
472 SkyLine * precessionCircleN; // Northern precession circle
473 SkyLine * precessionCircleS; // Southern precession circle
351 SkyLine * meridianLine; // Meridian line474 SkyLine * meridianLine; // Meridian line
352 SkyLine * longitudeLine; // Opposition/conjunction longitude line475 SkyLine * longitudeLine; // Opposition/conjunction longitude line
353 SkyLine * horizonLine; // Horizon line476 SkyLine * horizonLine; // Horizon line
354477
=== modified file 'src/core/modules/Landscape.cpp'
--- src/core/modules/Landscape.cpp 2015-06-30 12:08:33 +0000
+++ src/core/modules/Landscape.cpp 2015-07-28 19:18:20 +0000
@@ -803,6 +803,7 @@
803 float y_baseImg_1 = sides[currentSide].texCoords[1]+ y_img_1*(sides[currentSide].texCoords[3]-sides[currentSide].texCoords[1]);803 float y_baseImg_1 = sides[currentSide].texCoords[1]+ y_img_1*(sides[currentSide].texCoords[3]-sides[currentSide].texCoords[1]);
804 int y=(1.0-y_baseImg_1)*sidesImages[currentSide]->height(); // pixel Y from top.804 int y=(1.0-y_baseImg_1)*sidesImages[currentSide]->height(); // pixel Y from top.
805 QRgb pixVal=sidesImages[currentSide]->pixel(x, y);805 QRgb pixVal=sidesImages[currentSide]->pixel(x, y);
806/*
806#ifndef NDEBUG807#ifndef NDEBUG
807 // GZ: please leave the comment available for further development!808 // GZ: please leave the comment available for further development!
808 qDebug() << "Oldstyle Landscape sampling: az=" << az*180.0 << "° alt=" << alt_rad*180.0f/M_PI809 qDebug() << "Oldstyle Landscape sampling: az=" << az*180.0 << "° alt=" << alt_rad*180.0f/M_PI
@@ -811,6 +812,7 @@
811 << ", w=" << sidesImages[currentSide]->width() << " h=" << sidesImages[currentSide]->height()812 << ", w=" << sidesImages[currentSide]->width() << " h=" << sidesImages[currentSide]->height()
812 << " --> x:" << x << " y:" << y << " alpha:" << qAlpha(pixVal)/255.0f;813 << " --> x:" << x << " y:" << y << " alpha:" << qAlpha(pixVal)/255.0f;
813#endif814#endif
815*/
814 return qAlpha(pixVal)/255.0f;816 return qAlpha(pixVal)/255.0f;
815}817}
816818
@@ -1022,12 +1024,14 @@
1022 int y= mapImage->height()/2*(1 + radius*std::cos(az));1024 int y= mapImage->height()/2*(1 + radius*std::cos(az));
10231025
1024 QRgb pixVal=mapImage->pixel(x, y);1026 QRgb pixVal=mapImage->pixel(x, y);
1027/*
1025#ifndef NDEBUG1028#ifndef NDEBUG
1026 // GZ: please leave the comment available for further development!1029 // GZ: please leave the comment available for further development!
1027 qDebug() << "Landscape sampling: az=" << (az+angleRotateZ)/M_PI*180.0f << "° alt=" << alt_rad/M_PI*180.f1030 qDebug() << "Landscape sampling: az=" << (az+angleRotateZ)/M_PI*180.0f << "° alt=" << alt_rad/M_PI*180.f
1028 << "°, w=" << mapImage->width() << " h=" << mapImage->height()1031 << "°, w=" << mapImage->width() << " h=" << mapImage->height()
1029 << " --> x:" << x << " y:" << y << " alpha:" << qAlpha(pixVal)/255.0f;1032 << " --> x:" << x << " y:" << y << " alpha:" << qAlpha(pixVal)/255.0f;
1030#endif1033#endif
1034*/
1031 return qAlpha(pixVal)/255.0f;1035 return qAlpha(pixVal)/255.0f;
10321036
10331037
@@ -1210,6 +1214,7 @@
1210 int x=(az_phot/2.0f) * mapImage->width(); // pixel X from left.1214 int x=(az_phot/2.0f) * mapImage->width(); // pixel X from left.
12111215
1212 QRgb pixVal=mapImage->pixel(x, y);1216 QRgb pixVal=mapImage->pixel(x, y);
1217/*
1213#ifndef NDEBUG1218#ifndef NDEBUG
1214 // GZ: please leave the comment available for further development!1219 // GZ: please leave the comment available for further development!
1215 qDebug() << "Landscape sampling: az=" << az*180.0 << "° alt=" << alt_pm1*90.0f1220 qDebug() << "Landscape sampling: az=" << az*180.0 << "° alt=" << alt_pm1*90.0f
@@ -1217,6 +1222,7 @@
1217 << ", w=" << mapImage->width() << " h=" << mapImage->height()1222 << ", w=" << mapImage->width() << " h=" << mapImage->height()
1218 << " --> x:" << x << " y:" << y << " alpha:" << qAlpha(pixVal)/255.0f;1223 << " --> x:" << x << " y:" << y << " alpha:" << qAlpha(pixVal)/255.0f;
1219#endif1224#endif
1225*/
1220 return qAlpha(pixVal)/255.0f;1226 return qAlpha(pixVal)/255.0f;
12211227
1222}1228}
12231229
=== modified file 'src/core/modules/Planet.cpp'
--- src/core/modules/Planet.cpp 2015-06-21 11:42:04 +0000
+++ src/core/modules/Planet.cpp 2015-07-28 19:18:20 +0000
@@ -24,7 +24,8 @@
24#include "StelSkyDrawer.hpp"24#include "StelSkyDrawer.hpp"
25#include "SolarSystem.hpp"25#include "SolarSystem.hpp"
26#include "Planet.hpp"26#include "Planet.hpp"
2727#include "planetsephems/precession.h"
28#include "StelObserver.hpp"
28#include "StelProjector.hpp"29#include "StelProjector.hpp"
29#include "sidereal_time.h"30#include "sidereal_time.h"
30#include "StelTextureMgr.hpp"31#include "StelTextureMgr.hpp"
@@ -225,15 +226,21 @@
225226
226 oss << getPositionInfoString(core, flags);227 oss << getPositionInfoString(core, flags);
227228
228 if (flags&Extra)229 // GZ This is mostly for debugging. Maybe also useful for letting people use our results to cross-check theirs, but we should not act as reference, currently...
229 {230 // TODO: maybe separate this out into:
230 static SolarSystem *ssystem=GETSTELMODULE(SolarSystem);231 //if (flags&EclipticCoordXYZ)
231 double ecl= ssystem->getEarth()->getRotObliquity(core->getJDay());232 // For now: add to EclipticCoord
232 if (core->getCurrentLocation().planetName=="Earth")233 //if (flags&EclipticCoord)
233 oss << q_("Obliquity (of date, for Earth): %1").arg(StelUtils::radToDmsStr(ecl, true)) << "<br>";234 // oss << q_("Ecliptical XYZ (VSOP87A): %1/%2/%3").arg(QString::number(eclipticPos[0], 'f', 3), QString::number(eclipticPos[1], 'f', 3), QString::number(eclipticPos[2], 'f', 3)) << "<br>";
234 //if (englishName!="Sun")235// if (flags&Extra)
235 // oss << q_("Obliquity (of date): %1").arg(StelUtils::radToDmsStr(getRotObliquity(core->getJDay()), true)) << "<br>";236// {
236 }237// static SolarSystem *ssystem=GETSTELMODULE(SolarSystem);
238// double ecl= ssystem->getEarth()->getRotObliquity(core->getJDay());
239// if (core->getCurrentLocation().planetName=="Earth")
240// oss << q_("Ecliptic obliquity (of date): %1").arg(StelUtils::radToDmsStr(ecl, true)) << "<br>";
241// //if (englishName!="Sun")
242// // oss << q_("Obliquity (of date): %1").arg(StelUtils::radToDmsStr(getRotObliquity(core->getJDay()), true)) << "<br>";
243// }
237244
238 if (flags&Distance)245 if (flags&Distance)
239 {246 {
@@ -277,6 +284,10 @@
277 double siderealDay = getSiderealDay();284 double siderealDay = getSiderealDay();
278 if (flags&Extra)285 if (flags&Extra)
279 {286 {
287 // This is a string you can activate for debugging. It shows the distance between observer and center of the body you are standing on.
288 // May be helpful for debugging critical parallax corrections for eclipses.
289 // For general use, find a better location first.
290 // oss << q_("Planetocentric distance &rho;: %1 (km)").arg(core->getCurrentObserver()->getDistanceFromCenter() * AU) <<"<br>";
280 if (siderealPeriod>0)291 if (siderealPeriod>0)
281 {292 {
282 // TRANSLATORS: Sidereal (orbital) period for solar system bodies in days and in Julian years (symbol: a)293 // TRANSLATORS: Sidereal (orbital) period for solar system bodies in days and in Julian years (symbol: a)
@@ -291,7 +302,7 @@
291 oss << q_("The period of rotation is chaotic") << "<br>";302 oss << q_("The period of rotation is chaotic") << "<br>";
292 }303 }
293 }304 }
294 if (englishName.compare("Sun")!=0)305 if (englishName != "Sun")
295 {306 {
296 const Vec3d& observerHelioPos = core->getObserverHeliocentricEclipticPos();307 const Vec3d& observerHelioPos = core->getObserverHeliocentricEclipticPos();
297 oss << QString(q_("Phase Angle: %1")).arg(StelUtils::radToDmsStr(getPhaseAngle(observerHelioPos))) << "<br>";308 oss << QString(q_("Phase Angle: %1")).arg(StelUtils::radToDmsStr(getPhaseAngle(observerHelioPos))) << "<br>";
@@ -391,6 +402,10 @@
391 }402 }
392}403}
393404
405// return value in radians!
406// TODO: For earth, decide whether this should be Capitaine's omega_A (angle eclipticPoleJ2000//axis) or epsilon_A (angle axis//current ecliptic pole)
407// For now, it is epsilon_A, the angle between earth's rotational axis and mean ecliptic of date.
408// Details: e.g. Hilton etal, Report on Precession and the Ecliptic, Cel.Mech.Dyn.Astr.94:351-67 (2006), Fig1.
394double Planet::getRotObliquity(double JDay) const409double Planet::getRotObliquity(double JDay) const
395{410{
396 // JDay=2451545.0 for J2000.0411 // JDay=2451545.0 for J2000.0
@@ -575,16 +590,36 @@
575590
576}591}
577592
578// Compute the transformation matrix from the local Planet coordinate to the parent Planet coordinate593// Compute the transformation matrix from the local Planet coordinate system to the parent Planet coordinate system.
594// In case of the planets, this makes the axis point to the respective celestial pole.
595// TODO: Verify for the other planets if their axes are relative to J2000 ecliptic (VSOP87A XY plane) or relative to (precessed) ecliptic of date?
579void Planet::computeTransMatrix(double jd)596void Planet::computeTransMatrix(double jd)
580{597{
598 // TODO: correct this for earth with the new model.
581 axisRotation = getSiderealTime(jd);599 axisRotation = getSiderealTime(jd);
582600
583 // Special case - heliocentric coordinates are on ecliptic,601 // Special case - heliocentric coordinates are relative to eclipticJ2000 (VSOP87A XY plane),
584 // not solar equator...602 // not solar equator...
603
585 if (parent)604 if (parent)
586 {605 {
587 rotLocalToParent = Mat4d::zrotation(re.ascendingNode - re.precessionRate*(jd-re.epoch)) * Mat4d::xrotation(re.obliquity);606 // We can inject a proper precession plus even nutation matrix in this stage, if available.
607 if (englishName=="Earth")
608 {
609 // rotLocalToParent = Mat4d::zrotation(re.ascendingNode - re.precessionRate*(jd-re.epoch)) * Mat4d::xrotation(-getRotObliquity(jd));
610 // GZ: We follow Capitaine's (2003) formulation P=Rz(Chi_A)*Rx(-omega_A)*Rz(-psi_A)*Rx(eps_o).
611 // ADS: 2011A&A...534A..22V = A&A 534, A22 (2011): Vondrak, Capitane, Wallace: New Precession Expressions, valid for long time intervals:
612 // See also Hilton et al, Report on Precession and the Ecliptic. Cel.Mech.Dyn.Astr. 94:351-367 (2006).
613 double eps_A, chi_A, omega_A, psi_A;
614 getPrecessionAnglesVondrak(jd, &eps_A, &chi_A, &omega_A, &psi_A);
615 // GZ This is the right combination for precession of the equator: Nodal rotation psi_A,
616 // then rotation by omega_A, the angle between EclPoleJ2000 and EarthPoleOfDate.
617 // The final rotation by chi_A rotates the equinox (zero degree).
618 // To achieve ecliptical coords of date, you just have now to add a rotX by epsilon_A (obliquity of date).
619 rotLocalToParent= Mat4d::zrotation(-psi_A) * Mat4d::xrotation(-omega_A) * Mat4d::zrotation(chi_A);
620 }
621 else
622 rotLocalToParent = Mat4d::zrotation(re.ascendingNode - re.precessionRate*(jd-re.epoch)) * Mat4d::xrotation(re.obliquity);
588 }623 }
589}624}
590625
@@ -615,8 +650,17 @@
615double Planet::getSiderealTime(double jd) const650double Planet::getSiderealTime(double jd) const
616{651{
617 if (englishName=="Earth")652 if (englishName=="Earth")
618 {653 { // GZ I wanted to be sure that nutation is just those ignorable few arcseconds.
619 return get_apparent_sidereal_time(jd);654 //qDebug() << "Difference apparent-mean sidereal times (s): " << (get_apparent_sidereal_time(jd)- get_mean_sidereal_time(jd))* 240.0; // 1degree=4min=240s.
655 // TODO: Reactivate Nutation (but following IAU-2000A) after fixing JD_UT/JD_ET issues, then change this call back to apparent_sidereal_time.
656 //return get_apparent_sidereal_time(jd);
657 return get_mean_sidereal_time(jd);
658
659 // In the newer precession/nutation literature (starting around 2006) there are two sets of algorithms:
660 // "Classical" sidereal time (Greenwich hour angle GHA) and a solution based on Earth Rotational Angle ERA.
661 // We keep using the classical set, but make sure we are correct!
662
663
620 }664 }
621665
622 double t = jd - re.epoch;666 double t = jd - re.epoch;
@@ -1801,7 +1845,7 @@
1801 if (!re.siderealPeriod)1845 if (!re.siderealPeriod)
1802 return;1846 return;
18031847
1804 const StelProjectorP prj = core->getProjection(StelCore::FrameHeliocentricEcliptic);1848 const StelProjectorP prj = core->getProjection(StelCore::FrameHeliocentricEclipticJ2000);
18051849
1806 StelPainter sPainter(prj);1850 StelPainter sPainter(prj);
18071851
@@ -1812,7 +1856,7 @@
1812 sPainter.setColor(orbitColor[0], orbitColor[1], orbitColor[2], orbitFader.getInterstate());1856 sPainter.setColor(orbitColor[0], orbitColor[1], orbitColor[2], orbitFader.getInterstate());
1813 Vec3d onscreen;1857 Vec3d onscreen;
1814 // special case - use current Planet position as center vertex so that draws1858 // special case - use current Planet position as center vertex so that draws
1815 // on it's orbit all the time (since segmented rather than smooth curve)1859 // on its orbit all the time (since segmented rather than smooth curve)
1816 Vec3d savePos = orbit[ORBIT_SEGMENTS/2];1860 Vec3d savePos = orbit[ORBIT_SEGMENTS/2];
1817 orbit[ORBIT_SEGMENTS/2]=getHeliocentricEclipticPos();1861 orbit[ORBIT_SEGMENTS/2]=getHeliocentricEclipticPos();
1818 orbit[ORBIT_SEGMENTS]=orbit[0];1862 orbit[ORBIT_SEGMENTS]=orbit[0];
18191863
=== modified file 'src/core/modules/Planet.hpp'
--- src/core/modules/Planet.hpp 2015-04-17 21:30:03 +0000
+++ src/core/modules/Planet.hpp 2015-07-28 19:18:20 +0000
@@ -172,6 +172,8 @@
172 //! Get the radius of the planet in AU.172 //! Get the radius of the planet in AU.
173 //! @return the radius of the planet in astronomical units.173 //! @return the radius of the planet in astronomical units.
174 double getRadius(void) const {return radius;}174 double getRadius(void) const {return radius;}
175 //! Get the value (1-f) for oblateness f.
176 double getOneMinusOblateness(void) const {return oneMinusOblateness;}
175 //! Get duration of sidereal day177 //! Get duration of sidereal day
176 double getSiderealDay(void) const {return re.period;}178 double getSiderealDay(void) const {return re.period;}
177 //! Get duration of sidereal year179 //! Get duration of sidereal year
@@ -219,6 +221,8 @@
219 float _obliquity, float _ascendingNode,221 float _obliquity, float _ascendingNode,
220 float _precessionRate, double _siderealPeriod);222 float _precessionRate, double _siderealPeriod);
221 double getRotAscendingnode(void) const {return re.ascendingNode;}223 double getRotAscendingnode(void) const {return re.ascendingNode;}
224 // return angle between axis and normal of ecliptic plane (or, for a moon, equatorial/reference plane defined by parent).
225 // TODO: decide if this is always angle between axis and J2000 ecliptic, or should be axis//current ecliptic!
222 double getRotObliquity(double JDay) const;226 double getRotObliquity(double JDay) const;
223227
224 //! Get the Planet position in the parent Planet ecliptic coordinate in AU228 //! Get the Planet position in the parent Planet ecliptic coordinate in AU
@@ -321,8 +325,10 @@
321 Vec3f color; // exclusively used for drawing the planet halo325 Vec3f color; // exclusively used for drawing the planet halo
322326
323 float albedo; // Planet albedo. Used for magnitude computation (but formula dubious!)327 float albedo; // Planet albedo. Used for magnitude computation (but formula dubious!)
324 Mat4d rotLocalToParent;328 Mat4d rotLocalToParent; // GZ2015: was undocumented.
325 float axisRotation; // Rotation angle of the Planet on it's axis329 // Apparently this is the axis orientation with respect to the parent body. For planets, this is axis orientation w.r.t. VSOP87A/J2000 ecliptical system.
330 float axisRotation; // Rotation angle of the Planet on its axis.
331 // For Earth, this should be Greenwich Mean Sidereal Time GMST.
326 StelTextureSP texMap; // Planet map texture332 StelTextureSP texMap; // Planet map texture
327 StelTextureSP normalMap; // Planet normal map texture333 StelTextureSP normalMap; // Planet normal map texture
328334
@@ -333,7 +339,7 @@
333 double lastJD; // caches JD of last positional computation339 double lastJD; // caches JD of last positional computation
334 // The callback for the calculation of the equatorial rect heliocentric position at time JD.340 // The callback for the calculation of the equatorial rect heliocentric position at time JD.
335 posFuncType coordFunc;341 posFuncType coordFunc;
336 void* userDataPtr;342 void* userDataPtr; // this is always used with an Orbit object.
337343
338 OsculatingFunctType *const osculatingFunc;344 OsculatingFunctType *const osculatingFunc;
339 QSharedPointer<Planet> parent; // Planet parent i.e. sun for earth345 QSharedPointer<Planet> parent; // Planet parent i.e. sun for earth
340346
=== modified file 'src/core/modules/SolarSystem.cpp'
--- src/core/modules/SolarSystem.cpp 2015-07-05 19:48:33 +0000
+++ src/core/modules/SolarSystem.cpp 2015-07-28 19:18:20 +0000
@@ -1691,6 +1691,10 @@
1691 systemPlanets.clear();1691 systemPlanets.clear();
1692 // Memory leak? What's the proper way of cleaning shared pointers?1692 // Memory leak? What's the proper way of cleaning shared pointers?
16931693
1694 // Also delete Comet textures (loaded in loadPlanets()
1695 Comet::tailTexture.clear();
1696 Comet::comaTexture.clear();
1697
1694 // Re-load the ssystem.ini file1698 // Re-load the ssystem.ini file
1695 loadPlanets(); 1699 loadPlanets();
1696 computePositions(StelUtils::getJDFromSystem());1700 computePositions(StelUtils::getJDFromSystem());
16971701
=== modified file 'src/core/planetsephems/elp82b.h'
--- src/core/planetsephems/elp82b.h 2010-04-15 12:28:34 +0000
+++ src/core/planetsephems/elp82b.h 2015-07-28 19:18:20 +0000
@@ -82,7 +82,7 @@
82 82
8383
84#ifdef __cplusplus84#ifdef __cplusplus
85};85}
86#endif86#endif
8787
88#endif88#endif
8989
=== modified file 'src/core/planetsephems/gust86.c'
--- src/core/planetsephems/gust86.c 2010-04-15 12:28:34 +0000
+++ src/core/planetsephems/gust86.c 2015-07-28 19:18:20 +0000
@@ -438,7 +438,7 @@
438static double gust86_jd0 = -1e100;438static double gust86_jd0 = -1e100;
439static double gust86_elem[GUST86_DIM];439static double gust86_elem[GUST86_DIM];
440440
441void GetGust86Coor(double jd,int body,double *xyz) {441void GetGust86Coor(const double jd,const int body,double *xyz) {
442 GetGust86OsculatingCoor(jd,jd,body,xyz);442 GetGust86OsculatingCoor(jd,jd,body,xyz);
443}443}
444444
445445
=== modified file 'src/core/planetsephems/gust86.h'
--- src/core/planetsephems/gust86.h 2013-06-02 03:39:47 +0000
+++ src/core/planetsephems/gust86.h 2015-07-28 19:18:20 +0000
@@ -59,7 +59,7 @@
59#define GUST86_TITANIA 359#define GUST86_TITANIA 3
60#define GUST86_OBERON 460#define GUST86_OBERON 4
6161
62void GetGust86Coor(double jd,int body,double *xyz);62void GetGust86Coor(const double jd, const int body, double *xyz);
63 /* Return the rectangular coordinates of the given satellite63 /* Return the rectangular coordinates of the given satellite
64 and the given julian date jd expressed in dynamical time (TAI+32.184s).64 and the given julian date jd expressed in dynamical time (TAI+32.184s).
65 The origin of the xyz-coordinates is the center of the planet.65 The origin of the xyz-coordinates is the center of the planet.
@@ -88,8 +88,8 @@
88 ICRF <-> VSOP87 must be done with the matrix given above.88 ICRF <-> VSOP87 must be done with the matrix given above.
89 */89 */
90 90
91void GetGust86OsculatingCoor(const double jd0, const double jd, const int body,double *xyz);91void GetGust86OsculatingCoor(const double jd0, const double jd, const int body, double *xyz);
92 /* The oculating orbit of epoch jd0, evatuated at jd, is returned.92 /* The oculating orbit of epoch jd0, evaluated at jd, is returned.
93 */93 */
9494
95#ifdef __cplusplus95#ifdef __cplusplus
9696
=== added file 'src/core/planetsephems/precession.c'
--- src/core/planetsephems/precession.c 1970-01-01 00:00:00 +0000
+++ src/core/planetsephems/precession.c 2015-07-28 19:18:20 +0000
@@ -0,0 +1,260 @@
1/*
2Copyright (C) 2015 Georg Zotti
3
4This program is free software; you can redistribute it and/or modify
5it under the terms of the GNU Library General Public License as published by
6the Free Software Foundation; either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program; if not, write to the Free Software
16Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
17*/
18
19/*
20 * Precession solution following methods from:
21 * J. Vondrak, N. Capitaine, P. Wallace
22 * New precession expressions, valid for long time intervals
23 * Astronomy&Astrophysics 534, A22 (2011)
24 * DOI: 10.1051/0004-6361/201117274
25 * The data are only applicable for a time range of 200.000 years around J2000.
26 * This is by far enough for Stellarium as of 2015, but just to make sure I added a few asserts.
27 */
28
29#include <math.h>
30#include <assert.h>
31
32/* Interval threshold (days) for re-computing these values. with 1, compute only 1/day: */
33#define PRECESSION_EPOCH_THRESHOLD 1.0
34
35/* cache results for retrieval if recomputation is not required */
36
37static double c_psi_A=0.0, c_omega_A=0.0, c_chi_A=0.0, /*c_p_A=0.0, */ c_epsilon_A=0.0,
38 c_Y_A=0.0, c_X_A=0.0, c_Q_A=0.0, c_P_A=0.0,
39 c_lastJDE=-1e100;
40
41static const double arcSec2Rad=M_PI*2.0/(360.0*3600.0);
42
43static const double PQvals[8][5]=
44{ // 1/Pn P_A:Cn Q_A:Cn P_A:Sn Q_A:Sn
45 { 1.0/ 708.15, -5486.751211, -684.661560, 667.666730, -5523.863691 },
46 { 1.0/2309.00, -17.127623, 2446.283880, -2354.886252, -549.747450 },
47 { 1.0/1620.00, -617.517403, 399.671049, -428.152441, -310.998056 },
48 { 1.0/ 492.20, 413.442940, -356.652376, 376.202861, 421.535876 },
49 { 1.0/1183.00, 78.614193, -186.387003, 184.778874, -36.776172 },
50 { 1.0/ 622.00, -180.732815, -316.800070, 335.321713, -145.278396 },
51 { 1.0/ 882.00, -87.676083, 198.296071, -185.138669, -34.744450 },
52 { 1.0/ 547.00, 46.140315, 101.135679, -120.972830, 22.885731 }};
53
54static const double XYvals[14][5]=
55{ // 1/Pn Xa:Cn Ya:Cn Xa:Sn Ya:Sn
56 { 1.0/ 256.75, -819.940624, 75004.344875, 81491.287984, 1558.515853 },
57 { 1.0/ 708.15, -8444.676815, 624.033993, 787.163481, 7774.939698 },
58 { 1.0/ 274.20, 2600.009459, 1251.136893, 1251.296102, -2219.534038 },
59 { 1.0/ 241.45, 2755.175630, -1102.212834, -1257.950837, -2523.969396 },
60 { 1.0/2309.00, -167.659835, -2660.664980, -2966.799730, 247.850422 },
61 { 1.0/ 492.20, 871.855056, 699.291817, 639.744522, -846.485643 },
62 { 1.0/ 396.10, 44.769698, 153.167220, 131.600209, -1393.124055 },
63 { 1.0/ 288.90, -512.313065, -950.865637, -445.040117, 368.526116 },
64 { 1.0/ 231.10, -819.415595, 499.754645, 584.522874, 749.045012 },
65 { 1.0/1610.00, -538.071099, -145.188210, -89.756563, 444.704518 },
66 { 1.0/ 620.00, -189.793622, 558.116553, 524.429630, 235.934465 },
67 { 1.0/ 157.87, -402.922932, -23.923029, -13.549067, 374.049623 },
68 { 1.0/ 220.30, 179.516345, -165.405086, -210.157124, -171.330180 },
69 { 1.0/1200.00, -9.814756, 9.344131, -44.919798, -22.899655 }};
70
71
72static const double precVals[18][7]=
73{ // 1/Pn psi_A:Cn om_A:Cn chi_A:Cn psi_A:Sn om_A:Sn chi_A:Sn
74
75 { 1.0/402.90, -22206.325946, 1267.727824, -13765.924050, -3243.236469, -8571.476251, -2206.967126 },
76 { 1.0/256.75, 12236.649447, 1702.324248, 13511.858383, -3969.723769, 5309.796459, -4186.752711 },
77 { 1.0/292.00, -1589.008343, -2970.553839, -1455.229106, 7099.207893, -610.393953, 6737.949677 },
78 { 1.0/537.22, 2482.103195, 693.790312, 1054.394467, -1903.696711, 923.201931, -856.922846 },
79 { 1.0/241.45, 150.322920, -14.724451, 0.0 , 146.435014, 3.759055, 0.0 },
80 { 1.0/375.22, -13.632066, -516.649401, -112.300144, 1300.630106, -40.691114, 957.149088 },
81 { 1.0/157.87, 389.437420, -356.794454, 202.769908, 1727.498039, 80.437484, 1709.440735 },
82 { 1.0/274.20, 2031.433792, -129.552058, 1936.050095, 299.854055, 807.300668, 154.425505 },
83 { 1.0/203.00, 363.748303, 256.129314, 0.0 , -1217.125982, 83.712326, 0.0 },
84 { 1.0/440.00, -896.747562, 190.266114, -655.484214, -471.367487, -368.654854, -243.520976 },
85 { 1.0/170.72, -926.995700, 95.103991, -891.898637, -441.682145, -191.881064, -406.539008 },
86 { 1.0/713.37, 37.070667, -332.907067, 0.0 , -86.169171, -4.263770, 0.0 },
87 { 1.0/313.00, -597.682468, 131.337633, 0.0 , -308.320429, -270.353691, 0.0 },
88 { 1.0/128.38, 66.282812, 82.731919, -333.322021, -422.815629, 11.602861, -446.656435 },
89 { 1.0/202.00, 0.0 , 0.0 , 327.517465, 0.0 , 0.0 , -1049.071786 },
90 { 1.0/315.00, 0.0 , 0.0 , -494.780332, 0.0 , 0.0 , -301.504189 },
91 { 1.0/136.32, 0.0 , 0.0 , 585.492621, 0.0 , 0.0 , 41.348740 },
92 { 1.0/490.00, 0.0 , 0.0 , 110.512834, 0.0 , 0.0 , 142.525186 }};
93
94static const double p_epsVals[10][5]=
95{ // 1/Pn p_A:Cn eps_A:Cn p_A:Sn eps_A:Sn
96 { 1.0/ 409.90, -6908.287473, 753.872780, -2845.175469, -1704.720302},
97 { 1.0/ 396.15, -3198.706291, -247.805823, 449.844989, -862.308358},
98 { 1.0/ 537.22, 1453.674527, 379.471484, -1255.915323, 447.832178},
99 { 1.0/ 402.90, -857.748557, -53.880558, 886.736783, -889.571909},
100 { 1.0/ 417.15, 1173.231614, -90.109153, 418.887514, 190.402846},
101 { 1.0/ 288.92, -156.981465, -353.600190, 997.912441, -56.564991},
102 { 1.0/4043.00, 371.836550, -63.115353, -240.979710, -296.222622},
103 { 1.0/ 306.00, -216.619040, -28.248187, 76.541307, -75.859952},
104 { 1.0/ 277.00, 193.691479, 17.703387, -36.788069, 67.473503},
105 { 1.0/ 203.00, 11.891524, 38.911307, -170.964086, 3.014055}};
106
107// compute angles for the series we are in fact using.
108// jde: date JD_TT
109//
110void getPrecessionAnglesVondrak(const double jde, double *epsilon_A, double *chi_A, double *omega_A, double *psi_A)
111{
112 if (fabs(jde-c_lastJDE) > PRECESSION_EPOCH_THRESHOLD)
113 {
114 double T=(jde-2451545.0)* (1.0/36525.0); // Julian centuries from J2000.0
115 assert(fabs(T)<=2000); // MAKES SURE YOU NEVER OVERSTRETCH THIS!
116 double T2pi= T*(2.0*M_PI); // Julian centuries from J2000.0, premultiplied by 2Pi
117 // these are actually small greek letters in the papers.
118 double Psi_A=0.0;
119 double Omega_A=0.0;
120 double Chi_A=0.0;
121 double Epsilon_A=0.0;
122 //double p_A=0.0; // currently unused. The data don't disturb.
123 int i;
124 for (i=0; i<18; ++i)
125 {
126 double invP=precVals[i][0];
127 double sin2piT_P, cos2piT_P;
128#ifdef _GNU_SOURCE
129 sincos(T2pi*invP, &sin2piT_P, &cos2piT_P);
130#else
131 double phase=T2pi*invP;
132 sin2piT_P= sin(phase);
133 cos2piT_P= cos(phase);
134#endif
135 Psi_A += precVals[i][1]*cos2piT_P + precVals[i][4]*sin2piT_P;
136 Omega_A += precVals[i][2]*cos2piT_P + precVals[i][5]*sin2piT_P;
137 Chi_A += precVals[i][3]*cos2piT_P + precVals[i][6]*sin2piT_P;
138 }
139
140 for (i=0; i<10; ++i)
141 {
142 double invP=p_epsVals[i][0];
143 double sin2piT_P, cos2piT_P;
144#ifdef _GNU_SOURCE
145 sincos(T2pi*invP, &sin2piT_P, &cos2piT_P);
146#else
147 double phase=T2pi*invP;
148 sin2piT_P= sin(phase);
149 cos2piT_P= cos(phase);
150#endif
151 //p_A += p_epsVals[i][1]*cos2piT_P + p_epsVals[i][3]*sin2piT_P;
152 Epsilon_A += p_epsVals[i][2]*cos2piT_P + p_epsVals[i][4]*sin2piT_P;
153 }
154
155 Psi_A += (( 289.e-9*T - 0.00740913)*T + 5042.7980307)*T + 8473.343527;
156 Omega_A += (( 151.e-9*T + 0.00000146)*T - 0.4436568)*T + 84283.175915;
157 Chi_A += (( -61.e-9*T + 0.00001472)*T + 0.0790159)*T - 19.657270;
158 //p_A += ((271.e-9*T - 0.00710733)*T + 5043.0520035)*T + 8134.017132;
159 Epsilon_A += ((-110.e-9*T - 0.00004039)*T + 0.3624445)*T + 84028.206305;
160 c_psi_A = arcSec2Rad*Psi_A;
161 c_omega_A = arcSec2Rad*Omega_A;
162 c_chi_A = arcSec2Rad*Chi_A;
163 // c_p_A = arcSec2Rad*p_A;
164 c_epsilon_A = arcSec2Rad*Epsilon_A;
165 }
166 *psi_A = c_psi_A;
167 *omega_A = c_omega_A;
168 *chi_A = c_chi_A;
169 *epsilon_A = c_epsilon_A;
170}
171
172void getPrecessionAnglesVondrakPQXYe(const double jde, double *vP_A, double *vQ_A, double *vX_A, double *vY_A, double *vepsilon_A)
173{
174 if (fabs(jde-c_lastJDE) > PRECESSION_EPOCH_THRESHOLD)
175 {
176 double T=(jde-2451545.0)* (1.0/36525.0);
177 assert(fabs(T)<=2000); // MAKES SURE YOU NEVER OVERSTRETCH THIS!
178 double T2pi= T*(2.0*M_PI); // Julian centuries from J2000.0, premultiplied by 2Pi
179 // these are actually small greek letters in the papers.
180 double P_A=0.0;
181 double Q_A=0.0;
182 double X_A=0.0;
183 double Y_A=0.0;
184 double Epsilon_A=0.0;
185 int i;
186 for (i=0; i<8; ++i)
187 {
188 double invP=PQvals[i][0];
189 double sin2piT_P, cos2piT_P;
190#ifdef _GNU_SOURCE
191 sincos(T2pi*invP, &sin2piT_P, &cos2piT_P);
192#else
193 double phase=T2pi*invP;
194 sin2piT_P= sin(phase);
195 cos2piT_P= cos(phase);
196#endif
197 P_A += PQvals[i][1]*cos2piT_P + PQvals[i][3]*sin2piT_P;
198 Q_A += PQvals[i][2]*cos2piT_P + PQvals[i][4]*sin2piT_P;
199 }
200 for (i=0; i<14; ++i)
201 {
202 double invP=XYvals[i][0];
203 double sin2piT_P, cos2piT_P;
204#ifdef _GNU_SOURCE
205 sincos(T2pi*invP, &sin2piT_P, &cos2piT_P);
206#else
207 double phase=T2pi*invP;
208 sin2piT_P= sin(phase);
209 cos2piT_P= cos(phase);
210#endif
211 X_A += XYvals[i][1]*cos2piT_P + XYvals[i][3]*sin2piT_P;
212 Y_A += XYvals[i][2]*cos2piT_P + XYvals[i][4]*sin2piT_P;
213 }
214 for (i=0; i<10; ++i)
215 {
216 double invP=p_epsVals[i][0];
217 double sin2piT_P, cos2piT_P;
218#ifdef _GNU_SOURCE
219 sincos(T2pi*invP, &sin2piT_P, &cos2piT_P);
220#else
221 double phase=T2pi*invP;
222 sin2piT_P= sin(phase);
223 cos2piT_P= cos(phase);
224#endif
225 //p_A += p_epsVals[i][1]*cos2piT_P + p_epsVals[i][3]*sin2piT_P;
226 Epsilon_A += p_epsVals[i][2]*cos2piT_P + p_epsVals[i][4]*sin2piT_P;
227 }
228
229 // Now the polynomial terms in T. Horner's scheme is best again.
230 P_A += (( 110.e-9*T - 0.00028913)*T - 0.1189000)*T + 5851.607687;
231 Q_A += ((-437.e-9*T - 0.00000020)*T + 1.1689818)*T - 1600.886300;
232 X_A += ((-152.e-9*T - 0.00037173)*T + 0.4252841)*T + 5453.282155;
233 Y_A += ((+231.e-9*T - 0.00018725)*T - 0.7675452)*T - 73750.930350;
234 Epsilon_A += (( 110.e-9*T - 0.00004039)*T + 0.3624445)*T + 84028.206305;
235 c_P_A = arcSec2Rad*P_A;
236 c_Q_A = arcSec2Rad*Q_A;
237 c_X_A = arcSec2Rad*X_A;
238 c_Y_A = arcSec2Rad*Y_A;
239 c_epsilon_A = arcSec2Rad*Epsilon_A;
240 }
241 *vP_A = c_P_A;
242 *vQ_A = c_Q_A;
243 *vX_A = c_X_A;
244 *vY_A = c_Y_A;
245 *vepsilon_A = c_epsilon_A;
246
247}
248
249//! Just return (presumably precomputed) ecliptic obliquity.
250double getPrecessionAngleVondrakEpsilon(const double jde)
251{
252 double epsilon_A, dummy_chi_A, dummy_omega_A, dummy_psi_A;
253 getPrecessionAnglesVondrak(jde, &epsilon_A, &dummy_chi_A, &dummy_omega_A, &dummy_psi_A);
254 return epsilon_A;
255}
256//! Just return (presumably precomputed) ecliptic obliquity.
257double getPrecessionAngleVondrakCurrentEpsilonA(void)
258{
259 return c_epsilon_A;
260}
0261
=== added file 'src/core/planetsephems/precession.h'
--- src/core/planetsephems/precession.h 1970-01-01 00:00:00 +0000
+++ src/core/planetsephems/precession.h 2015-07-28 19:18:20 +0000
@@ -0,0 +1,59 @@
1/*
2Copyright (C) 2015 Georg Zotti
3
4This program is free software; you can redistribute it and/or modify
5it under the terms of the GNU Library General Public License as published by
6the Free Software Foundation; either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program; if not, write to the Free Software
16Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
17*/
18#ifndef _PRECESSION_H_
19#define _PRECESSION_H_
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25//! Precession modelled from:
26//! J. Vondrák, N. Capitaine, and P. Wallace: New precession expressions, valid for long time intervals
27//! A&A (Astronomy&Astrophysics) 534, A22 (2011)
28//! DOI: http://dx.doi.org/10.1051/0004-6361/201117274
29//! This paper describes a precession model valid for +/-200.000 years from J2000.0 and consistent with P03 precession accepted as IAU2006 Precession.
30//! Some better understanding of the angles can be found in:
31//! + 1994AJ____108__711W J.G.Williams: Contributions to the Earth's Obliquity Rate, Precession and Nutation (Angles of eq. (35))
32//! + A&A 459, 981–985 (2006) DOI: 10.1051/0004-6361:20065897: Wallace&Capitaine: Precession-nutation procedures consistent with IAU 2006 resolutions
33//!
34//! The angles computed therein are used to rotate the planet Earth's axis, and also to rotate an "Ecliptic of Date", i.e. the current orbital plane of Earth.
35//! Currently this is without Nutation.
36//! Return values are in radians
37void getPrecessionAnglesVondrak(const double jde, double *epsilon_A, double *chi_A, double *omega_A, double *psi_A);
38
39//! Alternative solution, the one also implemented in the paper,
40//! combining matrix P from P_A, Q_A, X_A, Y_A and, for the ecliptic of date, rotate back by epsilon_A.
41//! Return values are in radians.
42//! This solution is currently unused, it seems easier to use the Capitaine sequence above.
43void getPrecessionAnglesVondrakPQXYe(const double jde, double *vP_A, double *vQ_A, double *vX_A, double *vY_A, double *vepsilon_A);
44
45//! Return ecliptic obliquity. [radians]
46double getPrecessionAngleVondrakEpsilon(const double jde);
47
48//! Just return (previously computed) ecliptic obliquity. [radians]
49double getPrecessionAngleVondrakCurrentEpsilonA(void);
50
51//! TODO: To complete the task of correct&accurate precession-nutation handling, find IAU-2000A Nutation and how this fits in here.
52//! E.g. A&A 459, 981–985 (2006) P. T. Wallace and N. Capitaine: Precession-nutation procedures consistent with IAU 2006 resolutions. DOI: 10.1051/0004-6361:20065897
53
54
55#ifdef __cplusplus
56}
57#endif
58
59#endif
060
=== modified file 'src/core/planetsephems/sidereal_time.c'
--- src/core/planetsephems/sidereal_time.c 2014-02-05 16:51:48 +0000
+++ src/core/planetsephems/sidereal_time.c 2015-07-28 19:18:20 +0000
@@ -18,6 +18,8 @@
18*/18*/
1919
20#include <math.h>20#include <math.h>
21#include <assert.h>
22#include "precession.h"
2123
22#ifndef M_PI24#ifndef M_PI
23#define M_PI 3.1415926535897932384625#define M_PI 3.14159265358979323846
@@ -44,7 +46,7 @@
44#define LN_NUTATION_EPOCH_THRESHOLD 0.146#define LN_NUTATION_EPOCH_THRESHOLD 0.1
4547
4648
47/* Nutation is a period oscillation of the Earths rotational axis around it's mean position.*/49/* Nutation is a periodic oscillation of the Earth's rotational axis around its mean position.*/
4850
49/*51/*
50 Contains Nutation in longitude, obliquity and ecliptic obliquity.52 Contains Nutation in longitude, obliquity and ecliptic obliquity.
@@ -52,9 +54,9 @@
52*/54*/
53struct ln_nutation55struct ln_nutation
54{56{
55 double longitude; /*!< Nutation in longitude */57 double deltaPsi; /*!< DeltaPsi, Nutation in longitude */
56 double obliquity; /*!< Nutation in obliquity */58 double deltaEps; /*!< DeltaEps, Nutation in obliquity */
57 double ecliptic; /*!< Obliquity of the ecliptic */59 double ecliptic; /*!< epsilon, Mean Obliquity of the ecliptic */
58};60};
5961
60struct nutation_arguments62struct nutation_arguments
@@ -215,6 +217,8 @@
215* Meeus, Astr. Alg. (1st ed., 1994), Chapter 21 pg 131-134 Using Table 21A */217* Meeus, Astr. Alg. (1st ed., 1994), Chapter 21 pg 131-134 Using Table 21A */
216/* GZ: Changed: ecliptic obliquity used to be constant J2000.0. 218/* GZ: Changed: ecliptic obliquity used to be constant J2000.0.
217 * If you don't compute this, you may as well forget about nutation!219 * If you don't compute this, you may as well forget about nutation!
220 * 2015: Laskar's 1986 formula replaced by Vondrak 2011. c_ecliptic is now epsilon_A, Vondrak's obliquity of date.
221 * TODO: replace this whole function with Nutation IAU2000A or compatible version.
218 */222 */
219void get_nutation (double JD, struct ln_nutation * nutation)223void get_nutation (double JD, struct ln_nutation * nutation)
220{224{
@@ -245,7 +249,7 @@
245 F = 93.2719100 + 483202.017538 * T - 0.0036825 * T2 + T3 / 327270.0;249 F = 93.2719100 + 483202.017538 * T - 0.0036825 * T2 + T3 / 327270.0;
246 O = 125.04452 - 1934.136261 * T + 0.0020708 * T2 + T3 / 450000.0;250 O = 125.04452 - 1934.136261 * T + 0.0020708 * T2 + T3 / 450000.0;
247251
248 / * GZotti: Laskar's formula, only valid for J2000+/-10000 years! */252 / * GZotti: Laskar's formula (1986), only valid for J2000+/-10000 years! */
249 if (fabs(T)<100) 253 if (fabs(T)<100)
250 {254 {
251 double U=T/100.0; 255 double U=T/100.0;
@@ -322,25 +326,32 @@
322 }326 }
323327
324 /* return results */328 /* return results */
325 nutation->longitude = c_longitude;329 nutation->deltaPsi = c_longitude;
326 nutation->obliquity = c_obliquity;330 nutation->deltaEps = c_obliquity;
327 nutation->ecliptic = c_ecliptic;331 nutation->ecliptic = c_ecliptic;
328}332}
329333
330/* Calculate the mean sidereal time at the meridian of Greenwich of a given date.334/* Calculate the mean sidereal time at the meridian of Greenwich (GMST) of a given date.
331 * returns apparent sidereal time (degree).335 * returns mean sidereal time (degrees).
332 * Formula 11.1, 11.4 pg 83 */336 * Formula 11.1, 11.4 pg 83
337 * MAKE SURE argument JD is UT, not TT!
338 */
333double get_mean_sidereal_time (double JD)339double get_mean_sidereal_time (double JD)
334{340{
335 double sidereal;341 double sidereal;
336 double T;342 double T, T1;
337 343
338 T = (JD - 2451545.0) / 36525.0;344
345 T1 = (JD - 2451545.0);
346 T= T1 * (1.0/ 36525.0);
339 347
340 /* calc mean angle */348 /* calc mean angle */
341 sidereal = 280.46061837 + (360.98564736629 * (JD - 2451545.0)) + (0.000387933 * T * T) - (T * T * T / 38710000.0);349 //sidereal = 280.46061837 + (360.98564736629 * (JD - 2451545.0)) + (0.000387933 * T * T) - (T * T * T / 38710000.0);
342 350
343 /* add a convenient multiple of 360 degrees */351 sidereal = range_degrees(T1*360.98564736629); // Number gets large, better bring that to interval soon.
352 sidereal += (-1.0/38710000.0 * T + 0.000387933)*T*T+280.46061837;
353
354 /* add again a convenient multiple of 360 degrees */
344 sidereal = range_degrees (sidereal);355 sidereal = range_degrees (sidereal);
345356
346 return sidereal;357 return sidereal;
@@ -348,13 +359,15 @@
348359
349360
350/* Calculate the apparent sidereal time at the meridian of Greenwich of a given date.361/* Calculate the apparent sidereal time at the meridian of Greenwich of a given date.
351 * returns apparent sidereal time (degree).362 * returns apparent sidereal time (degrees).
352 * Formula 11.1, 11.4 pg 83 */363 * Formula 11.1, 11.4 pg 83 */
353double get_apparent_sidereal_time (double JD)364double get_apparent_sidereal_time (double JD)
354{365{
355 double correction, sidereal;366 double correction, sidereal;
356 struct ln_nutation nutation;367 struct ln_nutation nutation;
357 368
369 // GZ For now this is forbidden!
370 //assert(0);
358 /* get the mean sidereal time */371 /* get the mean sidereal time */
359 sidereal = get_mean_sidereal_time (JD);372 sidereal = get_mean_sidereal_time (JD);
360 373
@@ -363,23 +376,25 @@
363 get_nutation (JD, &nutation);376 get_nutation (JD, &nutation);
364 377
365 /* GZ: This was the only place where this was used. I added the summation here. */378 /* GZ: This was the only place where this was used. I added the summation here. */
366 correction = (nutation.longitude * cos ((nutation.ecliptic+nutation.obliquity)*M_PI/180.));379 correction = (nutation.deltaPsi * cos ((nutation.ecliptic+nutation.deltaEps)*M_PI/180.));
367380
368 sidereal += correction;381 sidereal += correction;
369 382
370 return (sidereal);383 return (sidereal);
371}384}
372385
386// return value in degrees
373double get_mean_ecliptical_obliquity(double JDE)387double get_mean_ecliptical_obliquity(double JDE)
374{388{
375 struct ln_nutation nutation;389// struct ln_nutation nutation;
376 get_nutation(JDE, &nutation);390// get_nutation(JDE, &nutation);
377 return nutation.ecliptic;391// return nutation.ecliptic;
392 return getPrecessionAngleVondrakEpsilon(JDE)*180.0/M_PI;
378}393}
379394
380double get_nutation_longitude(double JDE)395double get_nutation_longitude(double JDE)
381{396{
382 struct ln_nutation nutation;397 struct ln_nutation nutation;
383 get_nutation(JDE, &nutation);398 get_nutation(JDE, &nutation);
384 return nutation.longitude;399 return nutation.deltaPsi;
385}400}
386401
=== modified file 'src/core/planetsephems/vsop87.h'
--- src/core/planetsephems/vsop87.h 2013-06-02 03:39:47 +0000
+++ src/core/planetsephems/vsop87.h 2015-07-28 19:18:20 +0000
@@ -69,7 +69,7 @@
69 */69 */
7070
71void GetVsop87OsculatingCoor(const double jd0,const double jd, const int body,double *xyz);71void GetVsop87OsculatingCoor(const double jd0,const double jd, const int body,double *xyz);
72 /* The oculating orbit of epoch jd0, evatuated at jd, is returned.72 /* The oculating orbit of epoch jd0, evaluated at jd, is returned.
73 */73 */
7474
75#ifdef __cplusplus75#ifdef __cplusplus
7676
=== modified file 'src/gui/ConfigurationDialog.cpp'
--- src/gui/ConfigurationDialog.cpp 2015-07-08 13:31:50 +0000
+++ src/gui/ConfigurationDialog.cpp 2015-07-28 19:18:20 +0000
@@ -563,13 +563,16 @@
563 // view dialog / markings tab settings563 // view dialog / markings tab settings
564 conf->setValue("viewing/flag_azimuthal_grid", glmgr->getFlagAzimuthalGrid());564 conf->setValue("viewing/flag_azimuthal_grid", glmgr->getFlagAzimuthalGrid());
565 conf->setValue("viewing/flag_equatorial_grid", glmgr->getFlagEquatorGrid());565 conf->setValue("viewing/flag_equatorial_grid", glmgr->getFlagEquatorGrid());
566 conf->setValue("viewing/flag_equatorial_J2000_grid", glmgr->getFlagEquatorJ2000Grid());
566 conf->setValue("viewing/flag_equator_line", glmgr->getFlagEquatorLine());567 conf->setValue("viewing/flag_equator_line", glmgr->getFlagEquatorLine());
568 conf->setValue("viewing/flag_equator_J2000_line", glmgr->getFlagEquatorJ2000Line());
567 conf->setValue("viewing/flag_ecliptic_line", glmgr->getFlagEclipticLine());569 conf->setValue("viewing/flag_ecliptic_line", glmgr->getFlagEclipticLine());
570 conf->setValue("viewing/flag_ecliptic_J2000_line", glmgr->getFlagEclipticJ2000Line());
571 conf->setValue("viewing/flag_ecliptic_grid", glmgr->getFlagEclipticGrid());
568 conf->setValue("viewing/flag_ecliptic_J2000_grid", glmgr->getFlagEclipticJ2000Grid());572 conf->setValue("viewing/flag_ecliptic_J2000_grid", glmgr->getFlagEclipticJ2000Grid());
569 conf->setValue("viewing/flag_meridian_line", glmgr->getFlagMeridianLine());573 conf->setValue("viewing/flag_meridian_line", glmgr->getFlagMeridianLine());
570 conf->setValue("viewing/flag_longitude_line", glmgr->getFlagLongitudeLine());574 conf->setValue("viewing/flag_longitude_line", glmgr->getFlagLongitudeLine());
571 conf->setValue("viewing/flag_horizon_line", glmgr->getFlagHorizonLine());575 conf->setValue("viewing/flag_horizon_line", glmgr->getFlagHorizonLine());
572 conf->setValue("viewing/flag_equatorial_J2000_grid", glmgr->getFlagEquatorJ2000Grid());
573 conf->setValue("viewing/flag_galactic_grid", glmgr->getFlagGalacticGrid());576 conf->setValue("viewing/flag_galactic_grid", glmgr->getFlagGalacticGrid());
574 conf->setValue("viewing/flag_galactic_equator_line", glmgr->getFlagGalacticEquatorLine());577 conf->setValue("viewing/flag_galactic_equator_line", glmgr->getFlagGalacticEquatorLine());
575 conf->setValue("viewing/flag_cardinal_points", lmgr->getFlagCardinalsPoints());578 conf->setValue("viewing/flag_cardinal_points", lmgr->getFlagCardinalsPoints());
576579
=== modified file 'src/gui/LocationDialog.cpp'
--- src/gui/LocationDialog.cpp 2014-11-25 13:02:40 +0000
+++ src/gui/LocationDialog.cpp 2015-07-28 19:18:20 +0000
@@ -340,7 +340,7 @@
340 else340 else
341 loc.planetName = ui->planetNameComboBox->itemData(index).toString();341 loc.planetName = ui->planetNameComboBox->itemData(index).toString();
342 loc.name = ui->cityNameLineEdit->text();342 loc.name = ui->cityNameLineEdit->text();
343 loc.latitude = ui->latitudeSpinBox->valueDegrees();343 loc.latitude = qMin(90.0, qMax(-90.0, ui->latitudeSpinBox->valueDegrees()));
344 loc.longitude = ui->longitudeSpinBox->valueDegrees();344 loc.longitude = ui->longitudeSpinBox->valueDegrees();
345 loc.altitude = ui->altitudeSpinBox->value();345 loc.altitude = ui->altitudeSpinBox->value();
346 index = ui->countryNameComboBox->currentIndex();346 index = ui->countryNameComboBox->currentIndex();
347347
=== modified file 'src/gui/ViewDialog.cpp'
--- src/gui/ViewDialog.cpp 2015-07-10 09:38:01 +0000
+++ src/gui/ViewDialog.cpp 2015-07-28 19:18:20 +0000
@@ -271,7 +271,9 @@
271271
272 // Grid and lines272 // Grid and lines
273 connectCheckBox(ui->showEquatorLineCheckBox, "actionShow_Equator_Line");273 connectCheckBox(ui->showEquatorLineCheckBox, "actionShow_Equator_Line");
274 connectCheckBox(ui->showEclipticLineCheckBox, "actionShow_Ecliptic_Line");274 connectCheckBox(ui->showEquatorJ2000LineCheckBox, "actionShow_Equator_J2000_Line");
275 connectCheckBox(ui->showEclipticLineJ2000CheckBox, "actionShow_Ecliptic_J2000_Line");
276 connectCheckBox(ui->showEclipticLineOfDateCheckBox, "actionShow_Ecliptic_Line");
275 connectCheckBox(ui->showMeridianLineCheckBox, "actionShow_Meridian_Line");277 connectCheckBox(ui->showMeridianLineCheckBox, "actionShow_Meridian_Line");
276 connectCheckBox(ui->showLongitudeLineCheckBox, "actionShow_Longitude_Line");278 connectCheckBox(ui->showLongitudeLineCheckBox, "actionShow_Longitude_Line");
277 connectCheckBox(ui->showHorizonLineCheckBox, "actionShow_Horizon_Line");279 connectCheckBox(ui->showHorizonLineCheckBox, "actionShow_Horizon_Line");
@@ -281,7 +283,9 @@
281 connectCheckBox(ui->showAzimuthalGridCheckBox, "actionShow_Azimuthal_Grid");283 connectCheckBox(ui->showAzimuthalGridCheckBox, "actionShow_Azimuthal_Grid");
282 connectCheckBox(ui->showEquatorialJ2000GridCheckBox, "actionShow_Equatorial_J2000_Grid");284 connectCheckBox(ui->showEquatorialJ2000GridCheckBox, "actionShow_Equatorial_J2000_Grid");
283 connectCheckBox(ui->showEclipticGridJ2000CheckBox, "actionShow_Ecliptic_J2000_Grid");285 connectCheckBox(ui->showEclipticGridJ2000CheckBox, "actionShow_Ecliptic_J2000_Grid");
286 connectCheckBox(ui->showEclipticGridOfDateCheckBox, "actionShow_Ecliptic_Grid");
284 connectCheckBox(ui->showCardinalPointsCheckBox, "actionShow_Cardinal_Points");287 connectCheckBox(ui->showCardinalPointsCheckBox, "actionShow_Cardinal_Points");
288 connectCheckBox(ui->showPrecessionCirclesCheckBox, "actionShow_Precession_Circles");
285289
286 // Constellations290 // Constellations
287 ConstellationMgr* cmgr = GETSTELMODULE(ConstellationMgr);291 ConstellationMgr* cmgr = GETSTELMODULE(ConstellationMgr);
288292
=== modified file 'src/gui/viewDialog.ui'
--- src/gui/viewDialog.ui 2015-07-10 09:38:01 +0000
+++ src/gui/viewDialog.ui 2015-07-28 19:18:20 +0000
@@ -1453,27 +1453,49 @@
1453 <layout class="QVBoxLayout" name="verticalLayout_13">1453 <layout class="QVBoxLayout" name="verticalLayout_13">
1454 <item>1454 <item>
1455 <widget class="QCheckBox" name="showEquatorialJ2000GridCheckBox">1455 <widget class="QCheckBox" name="showEquatorialJ2000GridCheckBox">
1456 <property name="toolTip">
1457 <string>Equatorial coordinates of J2000.0.</string>
1458 </property>
1456 <property name="text">1459 <property name="text">
1457 <string>Equatorial grid (on J2000)</string>1460 <string>Equatorial grid (J2000)</string>
1458 </property>1461 </property>
1459 </widget>1462 </widget>
1460 </item>1463 </item>
1461 <item>1464 <item>
1462 <widget class="QCheckBox" name="showEquatorialGridCheckBox">1465 <widget class="QCheckBox" name="showEquatorialGridCheckBox">
1466 <property name="toolTip">
1467 <string>Equatorial coordinates of current date and planet.</string>
1468 </property>
1463 <property name="text">1469 <property name="text">
1464 <string>Equatorial grid (on date)</string>1470 <string>Equatorial grid (of date)</string>
1465 </property>1471 </property>
1466 </widget>1472 </widget>
1467 </item>1473 </item>
1468 <item>1474 <item>
1469 <widget class="QCheckBox" name="showEclipticGridJ2000CheckBox">1475 <widget class="QCheckBox" name="showEclipticGridJ2000CheckBox">
1470 <property name="text">1476 <property name="toolTip">
1471 <string>Ecliptic grid (on J2000)</string>1477 <string>Ecliptical coordinates for J2000.0.</string>
1478 </property>
1479 <property name="text">
1480 <string>Ecliptic grid (J2000)</string>
1481 </property>
1482 </widget>
1483 </item>
1484 <item>
1485 <widget class="QCheckBox" name="showEclipticGridOfDateCheckBox">
1486 <property name="toolTip">
1487 <string>Ecliptical coordinates for current date. Displayed on Earth only.</string>
1488 </property>
1489 <property name="text">
1490 <string>Ecliptic grid (of date)</string>
1472 </property>1491 </property>
1473 </widget>1492 </widget>
1474 </item>1493 </item>
1475 <item>1494 <item>
1476 <widget class="QCheckBox" name="showAzimuthalGridCheckBox">1495 <widget class="QCheckBox" name="showAzimuthalGridCheckBox">
1496 <property name="toolTip">
1497 <string>Altitudes and azimuth (counted from North towards East).</string>
1498 </property>
1477 <property name="text">1499 <property name="text">
1478 <string>Azimuthal grid</string>1500 <string>Azimuthal grid</string>
1479 </property>1501 </property>
@@ -1481,6 +1503,9 @@
1481 </item>1503 </item>
1482 <item>1504 <item>
1483 <widget class="QCheckBox" name="showGalacticGridCheckBox">1505 <widget class="QCheckBox" name="showGalacticGridCheckBox">
1506 <property name="toolTip">
1507 <string>Galactic Coordinates, System II (IAU 1958).</string>
1508 </property>
1484 <property name="text">1509 <property name="text">
1485 <string>Galactic grid</string>1510 <string>Galactic grid</string>
1486 </property>1511 </property>
@@ -1488,49 +1513,72 @@
1488 </item>1513 </item>
1489 <item>1514 <item>
1490 <widget class="QCheckBox" name="showCardinalPointsCheckBox">1515 <widget class="QCheckBox" name="showCardinalPointsCheckBox">
1516 <property name="toolTip">
1517 <string>Labels for the Cardinal directions.</string>
1518 </property>
1491 <property name="text">1519 <property name="text">
1492 <string>Cardinal points</string>1520 <string>Cardinal points</string>
1493 </property>1521 </property>
1494 </widget>1522 </widget>
1495 </item>1523 </item>
1524 <item>
1525 <widget class="QCheckBox" name="showPrecessionCirclesCheckBox">
1526 <property name="toolTip">
1527 <string>Instantaneous circles of earth's axis on its motion around ecliptical poles. Displayed on Earth only.</string>
1528 </property>
1529 <property name="text">
1530 <string>Precession circles</string>
1531 </property>
1532 </widget>
1533 </item>
1496 </layout>1534 </layout>
1497 </item>1535 </item>
1498 <item>1536 <item>
1499 <layout class="QVBoxLayout" name="verticalLayout_15">1537 <layout class="QVBoxLayout" name="verticalLayout_15">
1500 <item>1538 <item>
1539 <widget class="QCheckBox" name="showEquatorJ2000LineCheckBox">
1540 <property name="toolTip">
1541 <string>Show celestial equator of J2000.0.</string>
1542 </property>
1543 <property name="text">
1544 <string>Equator (J2000)</string>
1545 </property>
1546 </widget>
1547 </item>
1548 <item>
1501 <widget class="QCheckBox" name="showEquatorLineCheckBox">1549 <widget class="QCheckBox" name="showEquatorLineCheckBox">
1502 <property name="toolTip">1550 <property name="toolTip">
1503 <string>Show equator line</string>1551 <string>Show celestial equator of current planet and date.</string>
1504 </property>1552 </property>
1505 <property name="text">1553 <property name="text">
1506 <string>Equator</string>1554 <string>Equator (of date)</string>
1507 </property>1555 </property>
1508 </widget>1556 </widget>
1509 </item>1557 </item>
1510 <item>1558 <item>
1511 <widget class="QCheckBox" name="showMeridianLineCheckBox">1559 <widget class="QCheckBox" name="showEclipticLineJ2000CheckBox">
1512 <property name="toolTip">1560 <property name="toolTip">
1513 <string>Show meridian line</string>1561 <string>Show ecliptic line of J2000.0 (VSOP87A fundamental plane).</string>
1514 </property>1562 </property>
1515 <property name="text">1563 <property name="text">
1516 <string>Meridian</string>1564 <string>Ecliptic (J2000)</string>
1517 </property>1565 </property>
1518 </widget>1566 </widget>
1519 </item>1567 </item>
1520 <item>1568 <item>
1521 <widget class="QCheckBox" name="showEclipticLineCheckBox">1569 <widget class="QCheckBox" name="showEclipticLineOfDateCheckBox">
1522 <property name="toolTip">1570 <property name="toolTip">
1523 <string>Show ecliptic line</string>1571 <string>Show ecliptic line of current date.</string>
1524 </property>1572 </property>
1525 <property name="text">1573 <property name="text">
1526 <string>Ecliptic</string>1574 <string>Ecliptic (of date)</string>
1527 </property>1575 </property>
1528 </widget>1576 </widget>
1529 </item>1577 </item>
1530 <item>1578 <item>
1531 <widget class="QCheckBox" name="showHorizonLineCheckBox">1579 <widget class="QCheckBox" name="showHorizonLineCheckBox">
1532 <property name="toolTip">1580 <property name="toolTip">
1533 <string>Show horizon line</string>1581 <string>Show horizon line.</string>
1534 </property>1582 </property>
1535 <property name="text">1583 <property name="text">
1536 <string>Horizon</string>1584 <string>Horizon</string>
@@ -1540,7 +1588,7 @@
1540 <item>1588 <item>
1541 <widget class="QCheckBox" name="showGalacticEquatorLineCheckBox">1589 <widget class="QCheckBox" name="showGalacticEquatorLineCheckBox">
1542 <property name="toolTip">1590 <property name="toolTip">
1543 <string>Show Galactic equator line</string>1591 <string>Show Galactic equator line.</string>
1544 </property>1592 </property>
1545 <property name="text">1593 <property name="text">
1546 <string>Galactic equator</string>1594 <string>Galactic equator</string>
@@ -1548,6 +1596,16 @@
1548 </widget>1596 </widget>
1549 </item>1597 </item>
1550 <item>1598 <item>
1599 <widget class="QCheckBox" name="showMeridianLineCheckBox">
1600 <property name="toolTip">
1601 <string>Show meridian line.</string>
1602 </property>
1603 <property name="text">
1604 <string>Meridian</string>
1605 </property>
1606 </widget>
1607 </item>
1608 <item>
1551 <widget class="QCheckBox" name="showLongitudeLineCheckBox">1609 <widget class="QCheckBox" name="showLongitudeLineCheckBox">
1552 <property name="toolTip">1610 <property name="toolTip">
1553 <string>Opposition/conjunction longitude line - the line of ecliptic longitude which passes through both ecliptic poles, the Sun and opposition point.</string>1611 <string>Opposition/conjunction longitude line - the line of ecliptic longitude which passes through both ecliptic poles, the Sun and opposition point.</string>
@@ -2219,8 +2277,7 @@
2219 <tabstop>showAzimuthalGridCheckBox</tabstop>2277 <tabstop>showAzimuthalGridCheckBox</tabstop>
2220 <tabstop>showGalacticGridCheckBox</tabstop>2278 <tabstop>showGalacticGridCheckBox</tabstop>
2221 <tabstop>showEquatorLineCheckBox</tabstop>2279 <tabstop>showEquatorLineCheckBox</tabstop>
2222 <tabstop>showMeridianLineCheckBox</tabstop>2280 <tabstop>showEclipticLineOfDateCheckBox</tabstop>
2223 <tabstop>showEclipticLineCheckBox</tabstop>
2224 <tabstop>showHorizonLineCheckBox</tabstop>2281 <tabstop>showHorizonLineCheckBox</tabstop>
2225 <tabstop>showGalacticEquatorLineCheckBox</tabstop>2282 <tabstop>showGalacticEquatorLineCheckBox</tabstop>
2226 <tabstop>showConstellationLinesCheckBox</tabstop>2283 <tabstop>showConstellationLinesCheckBox</tabstop>
22272284
=== added file 'src/tests/testPrecession.cpp'
--- src/tests/testPrecession.cpp 1970-01-01 00:00:00 +0000
+++ src/tests/testPrecession.cpp 2015-07-28 19:18:20 +0000
@@ -0,0 +1,121 @@
1/*
2 * Stellarium
3 * Copyright (C) 2015 Georg Zotti
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
18 */
19
20#include <QObject>
21#include <QtDebug>
22#include <QVariantList>
23#include <QtTest>
24
25#include "tests/testPrecession.hpp"
26#include "StelUtils.hpp"
27#include "VecMath.hpp"
28
29QTEST_MAIN(TestPrecession)
30
31static const double arcSec2Rad=M_PI*2.0/(360.0*3600.0);
32static const double eps0=84381.406*arcSec2Rad;
33
34void TestPrecession::initTestCase()
35{
36}
37
38// example data found in Vondrak et al. 2011: New Precession Expressions, Valid for Long Time Intervals. A&A534, A22.
39// Section A.5
40// pecl = ( +0.00041724785764001342 -0.40495491104576162693 +0.91433656053126552350 )
41// = ( P_A -Q_A*C-Z*S -Q_A*S+Z*C )
42// pequ = ( -0.29437643797369031532 -0.11719098023370257855 +0.94847708824082091796 )
43// = ( X Y sqrt(1-x^2-y^2) || 0 )
44// This provides only the axes formulation. But the final Precession matrix should then be used as reference
45// comparable to the matrix that can be reached via the Capitaine parametrisation that we are using.
46
47void TestPrecession::testPrecessionAnglesVondrak()
48{
49 const double S=sin(eps0);
50 const double C=cos(eps0);
51 double Z, W;
52 double JulianDay=1219339.078000; // TT
53 double epsilon_A, chi_A, omega_A, psi_A;
54 double P_A, Q_A, X_A, Y_A;
55 double VEC2, VEC3, VEQ3;
56
57 // get angles for Capitaine parameterisation
58 getPrecessionAnglesVondrak(JulianDay, &epsilon_A, &chi_A, &omega_A, &psi_A);
59 // Get reference angles. We have to call this twice with different dates to avoid returning the cached (zero) angles.
60 getPrecessionAnglesVondrakPQXYe(-1234.567, &P_A, &Q_A, &X_A, &Y_A, &epsilon_A);
61 getPrecessionAnglesVondrakPQXYe(JulianDay, &P_A, &Q_A, &X_A, &Y_A, &epsilon_A);
62 Z=sqrt(qMax(1.0-P_A*P_A-Q_A*Q_A, 0.0));
63 W=X_A*X_A+Y_A*Y_A;
64 VEC2=-Q_A*C -Z*S;
65 VEC3=-Q_A*S +Z*C;
66 VEQ3=(W<1.0 ? sqrt(1.0-W) : 0.0);
67
68 QVERIFY2(fabs(P_A -0.00041724785764001342)<=0.000001, QString("JD %1: Pecl,x: %2 Difference: %3").arg(JulianDay).arg(P_A ).arg(P_A -0.00041724785764001342).toUtf8());
69 QVERIFY2(fabs(VEC2+0.40495491104576162693)<=0.000001, QString("JD %1: Pecl,y: %2 Difference: %3").arg(JulianDay).arg(VEC2).arg(VEC2+0.40495491104576162693).toUtf8());
70 QVERIFY2(fabs(VEC3-0.91433656053126552350)<=0.000001, QString("JD %1: Pecl,z: %2 Difference: %3").arg(JulianDay).arg(VEC3).arg(VEC3-0.91433656053126552350).toUtf8());
71 QVERIFY2(fabs(X_A +0.29437643797369031532)<=0.000001, QString("JD %1: Pequ,x: %2 Difference: %3").arg(JulianDay).arg(X_A ).arg(X_A +0.29437643797369031532).toUtf8());
72 QVERIFY2(fabs(Y_A +0.11719098023370257855)<=0.000001, QString("JD %1: Pequ,y: %2 Difference: %3").arg(JulianDay).arg(Y_A ).arg(Y_A +0.11719098023370257855).toUtf8());
73 QVERIFY2(fabs(VEQ3-0.94847708824082091796)<=0.000001, QString("JD %1: Pequ,z: %2 Difference: %3").arg(JulianDay).arg(VEQ3).arg(VEQ3-0.94847708824082091796).toUtf8());
74 // the same, to be seen ...
75// qDebug() << QString("JD %1: Pecl,x: %2 Difference: %3").arg(JulianDay, 8, 'f', 5).arg(P_A , 15, 'f', 12).arg(P_A -0.00041724785764001342, 15, 'f', 12);
76// qDebug() << QString("JD %1: Pecl,y: %2 Difference: %3").arg(JulianDay, 8, 'f', 5).arg(VEC2, 15, 'f', 12).arg(VEC2+0.40495491104576162693, 15, 'f', 12);
77// qDebug() << QString("JD %1: Pecl,z: %2 Difference: %3").arg(JulianDay, 8, 'f', 5).arg(VEC3, 15, 'f', 12).arg(VEC3-0.91433656053126552350, 15, 'f', 12);
78// qDebug() << QString("JD %1: Pequ,x: %2 Difference: %3").arg(JulianDay, 8, 'f', 5).arg(X_A , 15, 'f', 12).arg(X_A +0.29437643797369031532, 15, 'f', 12);
79// qDebug() << QString("JD %1: Pequ,y: %2 Difference: %3").arg(JulianDay, 8, 'f', 5).arg(Y_A , 15, 'f', 12).arg(Y_A +0.11719098023370257855, 15, 'f', 12);
80// qDebug() << QString("JD %1: Pequ,z: %2 Difference: %3").arg(JulianDay, 8, 'f', 5).arg(VEQ3, 15, 'f', 12).arg(VEQ3-0.94847708824082091796, 15, 'f', 12);
81
82
83 Vec3d PECL(P_A, VEC2, VEC3);
84 Vec3d PEQR(X_A, Y_A, VEQ3);
85 Vec3d EQX=PEQR^PECL;
86 EQX.normalize();
87 Vec3d V=PEQR^EQX;
88 Mat3d RP(EQX[0], EQX[1], EQX[2], V[0], V[1], V[2], PEQR[0], PEQR[1], PEQR[2]); // result from paper, section A.3
89 // Now we create the (hopefully) same rotation matrix from the Capitaine angles.
90 // Mat4d Rrot=Mat4d::zrotation(chi_A) * Mat4d::xrotation(-omega_A) * Mat4d::zrotation(-psi_A) * Mat4d::xrotation(eps0);
91
92 // Uh-oh - it seems the A&A paper has the matrix operations in the other direction.
93 // So the matrix to be compared must be composed in reverse.
94 Mat4d RRot=Mat4d::xrotation(eps0)*Mat4d::zrotation(-psi_A) * Mat4d::xrotation(-omega_A) * Mat4d::zrotation(chi_A);
95
96 //qDebug() << "RP : " << RP.toString(15, 'f', 12);
97 //qDebug() << "RcapTr : " << RRot.upper3x3().toString(15, 'f', 12);
98
99 Mat4d RP4(EQX[0], EQX[1], EQX[2], 0, V[0], V[1], V[2], 0, PEQR[0], PEQR[1], PEQR[2], 0, 0, 0, 0, 1);
100 //QMatrix4x4 matDiff=((RRot-RP4)).convertToQMatrix();
101 //qDebug() << matDiff;
102 Mat3d matDiff3x3=(RRot-RP4).upper3x3();
103 double max=0.0;
104 for (int i=0; i<9; ++i)
105 {
106 if (fabs(matDiff3x3[i]) > max)
107 max=fabs(matDiff3x3[i]);
108 }
109 //qDebug() << "largest value in difference of matrices:" << max;
110 QVERIFY2(max<2e-5, QString("Some values in the precession matrices differ by too much.").toUtf8());
111
112 double angleRef=RP.angle()*180.0/M_PI;
113 double angleCap=RRot.upper3x3().angle()*180.0/M_PI;
114 //qDebug() << "Rotation angle of reference matrix:" << angleRef;
115 //qDebug() << "Rotation angle of Capitaine matrix:" << angleCap;
116 //qDebug() << "Difference (arcseconds):" << (angleCap-angleRef)*3600.0;
117 // according to Fig12 in the paper, a few arcseconds of difference between PQXY and Capitaine parametrisation are allowed.
118 QVERIFY2((angleCap-angleRef)*3600.0<6.0, QString("Angle between rotation matrices too different!").toUtf8());
119
120 //TODO: Add more dates and verify this angle difference is limited to what we can see in Fig.12
121}
0122
=== added file 'src/tests/testPrecession.hpp'
--- src/tests/testPrecession.hpp 1970-01-01 00:00:00 +0000
+++ src/tests/testPrecession.hpp 2015-07-28 19:18:20 +0000
@@ -0,0 +1,35 @@
1/*
2 * Stellarium
3 * Copyright (C) 2015 Georg Zotti
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
18 */
19
20#ifndef _TESTPRECESSION_HPP_
21#define _TESTPRECESSION_HPP_
22
23#include <QObject>
24#include <QtTest>
25#include "precession.h"
26
27class TestPrecession : public QObject
28{
29 Q_OBJECT
30private slots:
31 void initTestCase();
32 void testPrecessionAnglesVondrak();
33};
34
35#endif // _TESTPRECESSION_HPP_