Merge lp:~georg-zotti/stellarium/extinction into lp:stellarium
- extinction
- Merge into trunk
Status: | Merged |
---|---|
Merged at revision: | 5101 |
Proposed branch: | lp:~georg-zotti/stellarium/extinction |
Merge into: | lp:stellarium |
Diff against target: |
1234 lines (+444/-174) 29 files modified
CHANGES-FROM-TRUNK.txt (+34/-28) data/default_config.ini (+1/-0) plugins/Quasars/src/Quasar.cpp (+34/-10) plugins/Quasars/src/Quasar.hpp (+1/-1) plugins/Satellites/src/Satellite.cpp (+10/-2) plugins/Satellites/src/Satellite.hpp (+1/-1) plugins/Supernovae/src/Supernova.cpp (+19/-5) plugins/Supernovae/src/Supernova.hpp (+1/-1) src/core/RefractionExtinction.cpp (+16/-3) src/core/RefractionExtinction.hpp (+29/-22) src/core/StelObject.cpp (+24/-13) src/core/StelObject.hpp (+1/-1) src/core/StelSkyDrawer.cpp (+14/-4) src/core/modules/Comet.cpp (+18/-4) src/core/modules/Comet.hpp (+1/-1) src/core/modules/Constellation.cpp (+1/-1) src/core/modules/ConstellationMgr.hpp (+1/-1) src/core/modules/LandscapeMgr.cpp (+1/-1) src/core/modules/MinorPlanet.cpp (+21/-6) src/core/modules/MinorPlanet.hpp (+1/-1) src/core/modules/Nebula.cpp (+23/-4) src/core/modules/Nebula.hpp (+1/-1) src/core/modules/Planet.cpp (+115/-28) src/core/modules/Planet.hpp (+1/-1) src/core/modules/StarMgr.cpp (+8/-3) src/core/modules/StarMgr.hpp (+1/-1) src/core/modules/StarWrapper.cpp (+18/-6) src/core/modules/StarWrapper.hpp (+10/-3) src/core/modules/ZoneArray.cpp (+38/-21) |
To merge this branch: | bzr merge lp:~georg-zotti/stellarium/extinction |
Related bugs: | |
Related blueprints: |
Atmospheric extinction (completion)
(Medium)
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
gzotti | Needs Resubmitting | ||
Alexander Wolf | Approve | ||
Bogdan Marinov | Needs Fixing | ||
Review via email: mp+86985@code.launchpad.net |
Commit message
Extinction for point-like objects
Description of the change
Extinction (reduced symbol size) and textual info on reduced magnitudes work for all (?) point-like and planetary objects.
I don't know how to process Milky Way and the nebulous images, help welcome!
Extinction introduces a new entry in config.ini:
[astro]
[edited to follow Bogdan's suggestion]
If true, objects lower than -2 degrees are extincted with 42 airmasses (just below horizontal... ;-), if false, 0, i.e., they are bright again below the horizon.
Bogdan Marinov (daggerstab) wrote : | # |
Also, for consistency, it should be something like "astro/
Alexander Wolf (alexwolf) wrote : | # |
Work looks is very good!
gzotti (georg-zotti) wrote : | # |
@Alex: OK, I was not aware of the default_config.ini. Quasars is done.
@Bogdan: OK, name changed
I hope it's all done now for the point sources.
Note that I also implemented 2 more sets of planetary magnitude computation (I forgot that already...), including the missing Saturn's rings magnitude contribution which was marked TODO. For Stellarium, I think the classical naked-eye "visual" magnitudes are preferrable over instrumental "V" magnitudes. Whichever solution you choose, please do not delete the other implementations.
Yours, Georg.
gzotti (georg-zotti) wrote : | # |
Oops, we crossed...
The last changes are small, mostly docfixes and cosmetics.
Preview Diff
1 | === modified file 'CHANGES-FROM-TRUNK.txt' | |||
2 | --- CHANGES-FROM-TRUNK.txt 2010-12-07 15:22:03 +0000 | |||
3 | +++ CHANGES-FROM-TRUNK.txt 2011-12-29 12:15:27 +0000 | |||
4 | @@ -1,35 +1,44 @@ | |||
6 | 1 | REFRACTION branch: | 1 | EXTINCTION branch: |
7 | 2 | 2 | ||
9 | 3 | Introduces changes necessary for refraction and extinction effects. | 3 | Introduces changes necessary for extinction effects. |
10 | 4 | 4 | ||
11 | 5 | Status: Partial solution, needs help. | 5 | Status: Partial solution, needs help. |
12 | 6 | 6 | ||
13 | 7 | Contributor: Georg.Zotti@univie.ac.at | 7 | Contributor: Georg.Zotti@univie.ac.at |
14 | 8 | All changes are donated to the Stellarium project for distribution under opensource licenses like GNU. | 8 | All changes are donated to the Stellarium project for distribution under opensource licenses like GNU. |
15 | 9 | 9 | ||
39 | 10 | COMPUTING: core/RefractionExtinction. DONE | 10 | |
40 | 11 | STARS: core/modules/ZoneArray::draw | 11 | |
41 | 12 | BUG: stars appear to have a problem after magnitude loss. | 12 | |
42 | 13 | +SELECT-MARK: StarMgr.cpp::drawPointer(). DONE | 13 | 2011-Oct: A new attempt in Extinction: |
43 | 14 | CLICK-IDENTIFY: core/StelObjectMgr::cleverFind(core, x, y) DONE | 14 | ========================================= |
44 | 15 | INFOSTRING: core/StelObject.cpp::getPositionInfoString(core, flags) DONE | 15 | |
45 | 16 | new core/StelObject.cpp::getSideralPosRefr(core) DONE | 16 | StelObject and derived classes: getVMagnitude() has new optional arg: withExtinction. |
46 | 17 | DEEPSKY: NebulaMgr::draw(). Influences symbols and labels only. | 17 | This should be set to true only for determining magnitude for drawing (draw()) and also for textual info (getInfoString()), |
47 | 18 | +DSO TEXTURES: ---TODO. May require a vertex shader program, beyond my knowledge. | 18 | not e.g. for selection (getSelectPriority()). |
48 | 19 | +SELECT-MARK: NebulaMgr::drawPointer(). DONE | 19 | It will also only change the result if atmosphere rendering is ON. |
49 | 20 | +MILKY WAY: Should become dimmer in low sky. May require a vertex shader program, beyond my knowledge. | 20 | |
50 | 21 | PLANETS: ---TODO. Involves StelPainter, 3D spheres, full matrices. | 21 | StelSkyDrawer::drawPointSource |
51 | 22 | May require a vertex shader program, beyond my knowledge, sorry. | 22 | StelObject::getVMagnitude |
52 | 23 | +SELECT-MARK: SolarSystem::drawPointer. DONE | 23 | Satellite::getVMagnitude, ::getInfoString |
53 | 24 | RA-DEC+GAL.GRIDS: core/GridLinesMgr. TODO OR LEAVE-AS-IS | 24 | Supernova::getVMagnitude, ::getInfoString |
54 | 25 | Requires changes in StelPainter's arc drawing methods. | 25 | Quasar::getVMagnitude, ::getInfoString |
55 | 26 | Currently this seems not viable and will not be changed. | 26 | Satellite::getVMagnitude |
56 | 27 | SATELLITES: Not required, practically unobservable on horizon, orbital parameters unsure, etc. | 27 | Planet::getVMagnitude, ::getInfoString |
57 | 28 | Should be easy, however. | 28 | Comet::getVMagnitude, ::getInfoString |
58 | 29 | CONSTELLATIONS: Large-scale items. Vertices could be refracted. Extinction would be a nice effect. | 29 | MinorPlanet::getVMagnitude, ::getInfoString |
59 | 30 | Not urgent, later. | 30 | Nebula::getVMagnitude, ::getInfoString |
60 | 31 | METEORS NOT NECESSARY. | 31 | StarWrapper::getInfoString |
61 | 32 | OTHER? ??? | 32 | |
62 | 33 | I currently have no solution for extended objects! Therefore ... | ||
63 | 34 | |||
64 | 35 | TODO: Milky Way, Nebula figures, Constellations?? | ||
65 | 36 | |||
66 | 37 | |||
67 | 38 | |||
68 | 39 | ================================================================================ | ||
69 | 40 | |||
70 | 41 | TODO, but maybe in yet another branch: See implementation in abandoned refraction branch! | ||
71 | 33 | 42 | ||
72 | 34 | CHANGES IN LANDSCAPE HANDLING: | 43 | CHANGES IN LANDSCAPE HANDLING: |
73 | 35 | 1) Moved config.ini:[stars].init_bortle_scale to [landscape] section | 44 | 1) Moved config.ini:[stars].init_bortle_scale to [landscape] section |
74 | @@ -43,9 +52,6 @@ | |||
75 | 43 | LandscapeMgr forwards those settings to the respective recipients. | 52 | LandscapeMgr forwards those settings to the respective recipients. |
76 | 44 | TODO: make GUI aware of changed values (how?). | 53 | TODO: make GUI aware of changed values (how?). |
77 | 45 | 54 | ||
78 | 46 | GUI changes: ViewDialog.ui | ||
79 | 47 | added 3 DoubleSpinBoxes for temperature, pressure, extinction coefficient into atmosphereGroupBox | ||
80 | 48 | ViewDialog.cpp: TODO: when switching landscapes, new data only load partially into GUI. No idea why! | ||
81 | 49 | 55 | ||
82 | 50 | CHANGES IN ASTR.COMPUTATIONS | 56 | CHANGES IN ASTR.COMPUTATIONS |
83 | 51 | planetsephems/sideral_time.[hc]: added get_mean_ecliptical_obliquity(double JDE), | 57 | planetsephems/sideral_time.[hc]: added get_mean_ecliptical_obliquity(double JDE), |
84 | 52 | 58 | ||
85 | === modified file 'data/default_config.ini' | |||
86 | --- data/default_config.ini 2011-12-18 20:43:39 +0000 | |||
87 | +++ data/default_config.ini 2011-12-29 12:15:27 +0000 | |||
88 | @@ -221,6 +221,7 @@ | |||
89 | 221 | flag_nebula_name = false | 221 | flag_nebula_name = false |
90 | 222 | flag_nebula_long_name = false | 222 | flag_nebula_long_name = false |
91 | 223 | flag_nebula_display_no_texture = false | 223 | flag_nebula_display_no_texture = false |
92 | 224 | flag_extinction_below_horizon = true | ||
93 | 224 | max_mag_nebula_name = 8 | 225 | max_mag_nebula_name = 8 |
94 | 225 | nebula_scale = 1 | 226 | nebula_scale = 1 |
95 | 226 | flag_milky_way = true | 227 | flag_milky_way = true |
96 | 227 | 228 | ||
97 | === modified file 'plugins/Quasars/src/Quasar.cpp' | |||
98 | --- plugins/Quasars/src/Quasar.cpp 2011-12-18 15:37:49 +0000 | |||
99 | +++ plugins/Quasars/src/Quasar.cpp 2011-12-29 12:15:27 +0000 | |||
100 | @@ -75,31 +75,47 @@ | |||
101 | 75 | float Quasar::getSelectPriority(const StelCore* core) const | 75 | float Quasar::getSelectPriority(const StelCore* core) const |
102 | 76 | { | 76 | { |
103 | 77 | //Same as StarWrapper::getSelectPriority() | 77 | //Same as StarWrapper::getSelectPriority() |
105 | 78 | return getVMagnitude(core); | 78 | return getVMagnitude(core, false); |
106 | 79 | } | 79 | } |
107 | 80 | 80 | ||
108 | 81 | QString Quasar::getInfoString(const StelCore* core, const InfoStringGroup& flags) const | 81 | QString Quasar::getInfoString(const StelCore* core, const InfoStringGroup& flags) const |
109 | 82 | { | 82 | { |
110 | 83 | QString str; | 83 | QString str; |
111 | 84 | QTextStream oss(&str); | 84 | QTextStream oss(&str); |
113 | 85 | double mag = getVMagnitude(core); | 85 | double mag = getVMagnitude(core, false); |
114 | 86 | 86 | ||
115 | 87 | if (flags&Name) | 87 | if (flags&Name) |
116 | 88 | { | 88 | { |
117 | 89 | oss << "<h2>" << designation << "</h2>"; | 89 | oss << "<h2>" << designation << "</h2>"; |
118 | 90 | } | 90 | } |
119 | 91 | |||
120 | 92 | if (flags&Magnitude && mag <= core->getSkyDrawer()->getLimitMagnitude()) | 91 | if (flags&Magnitude && mag <= core->getSkyDrawer()->getLimitMagnitude()) |
121 | 93 | { | 92 | { |
123 | 94 | if (bV!=0) | 93 | if (core->getSkyDrawer()->getFlagHasAtmosphere()) |
124 | 94 | { | ||
125 | 95 | if (bV!=0) | ||
126 | 95 | { | 96 | { |
128 | 96 | oss << q_("Magnitude: <b>%1</b> (B-V: %2)").arg(mag, 0, 'f', 2).arg(bV, 0, 'f', 2) << "<br>"; | 97 | oss << q_("Magnitude: <b>%1</b> (extincted to: <b>%2</b>. B-V: <b>%3</b>)").arg(QString::number(mag, 'f', 2), |
129 | 98 | QString::number(getVMagnitude(core, true), 'f', 2), | ||
130 | 99 | QString::number(bV, 'f', 2)) << "<br>"; | ||
131 | 97 | } | 100 | } |
132 | 98 | else | 101 | else |
133 | 99 | { | 102 | { |
135 | 100 | oss << q_("Magnitude: <b>%1</b>").arg(mag, 0, 'f', 2) << "<br>"; | 103 | oss << q_("Magnitude: <b>%1</b> (extincted to: <b>%2</b>)").arg(QString::number(mag, 'f', 2), |
136 | 104 | QString::number(getVMagnitude(core, true), 'f', 2)) << "<br>"; | ||
137 | 101 | } | 105 | } |
139 | 102 | if (AMagnitude!=0) | 106 | } |
140 | 107 | else | ||
141 | 108 | { | ||
142 | 109 | if (bV!=0) | ||
143 | 110 | { | ||
144 | 111 | oss << q_("Magnitude: <b>%1</b> (B-V: <b>%2</b>)").arg(mag, 0, 'f', 2).arg(bV, 0, 'f', 2) << "<br>"; | ||
145 | 112 | } | ||
146 | 113 | else | ||
147 | 114 | { | ||
148 | 115 | oss << q_("Magnitude: <b>%1</b>").arg(mag, 0, 'f', 2) << "<br>"; | ||
149 | 116 | } | ||
150 | 117 | } | ||
151 | 118 | if (AMagnitude!=0) | ||
152 | 103 | { | 119 | { |
153 | 104 | oss << q_("Absolute Magnitude: %1").arg(AMagnitude, 0, 'f', 2) << "<br>"; | 120 | oss << q_("Absolute Magnitude: %1").arg(AMagnitude, 0, 'f', 2) << "<br>"; |
154 | 105 | } | 121 | } |
155 | @@ -126,9 +142,17 @@ | |||
156 | 126 | return StelApp::getInstance().getVisionModeNight() ? Vec3f(0.6, 0.0, 0.0) : Vec3f(1.0, 1.0, 1.0); | 142 | return StelApp::getInstance().getVisionModeNight() ? Vec3f(0.6, 0.0, 0.0) : Vec3f(1.0, 1.0, 1.0); |
157 | 127 | } | 143 | } |
158 | 128 | 144 | ||
160 | 129 | float Quasar::getVMagnitude(const StelCore* core) const | 145 | float Quasar::getVMagnitude(const StelCore* core, bool withExtinction) const |
161 | 130 | { | 146 | { |
163 | 131 | return VMagnitude; | 147 | float extinctionMag=0.0; // track magnitude loss |
164 | 148 | if (withExtinction && core->getSkyDrawer()->getFlagHasAtmosphere()) | ||
165 | 149 | { | ||
166 | 150 | Vec3d altAz=getAltAzPosApparent(core); | ||
167 | 151 | altAz.normalize(); | ||
168 | 152 | core->getSkyDrawer()->getExtinction().forward(&altAz[2], &extinctionMag); | ||
169 | 153 | } | ||
170 | 154 | |||
171 | 155 | return VMagnitude + extinctionMag; | ||
172 | 132 | } | 156 | } |
173 | 133 | 157 | ||
174 | 134 | double Quasar::getAngularSize(const StelCore*) const | 158 | double Quasar::getAngularSize(const StelCore*) const |
175 | @@ -150,7 +174,7 @@ | |||
176 | 150 | double mag; | 174 | double mag; |
177 | 151 | 175 | ||
178 | 152 | StelUtils::spheToRect(qRA, qDE, XYZ); | 176 | StelUtils::spheToRect(qRA, qDE, XYZ); |
180 | 153 | mag = getVMagnitude(core); | 177 | mag = getVMagnitude(core, true); |
181 | 154 | 178 | ||
182 | 155 | if (mag <= sd->getLimitMagnitude()) | 179 | if (mag <= sd->getLimitMagnitude()) |
183 | 156 | { | 180 | { |
184 | 157 | 181 | ||
185 | === modified file 'plugins/Quasars/src/Quasar.hpp' | |||
186 | --- plugins/Quasars/src/Quasar.hpp 2011-12-11 12:51:25 +0000 | |||
187 | +++ plugins/Quasars/src/Quasar.hpp 2011-12-29 12:15:27 +0000 | |||
188 | @@ -65,7 +65,7 @@ | |||
189 | 65 | { | 65 | { |
190 | 66 | return XYZ; | 66 | return XYZ; |
191 | 67 | } | 67 | } |
193 | 68 | virtual float getVMagnitude(const StelCore* core) const; | 68 | virtual float getVMagnitude(const StelCore* core, bool withExtinction=false) const; |
194 | 69 | virtual double getAngularSize(const StelCore* core) const; | 69 | virtual double getAngularSize(const StelCore* core) const; |
195 | 70 | virtual QString getNameI18n(void) const | 70 | virtual QString getNameI18n(void) const |
196 | 71 | { | 71 | { |
197 | 72 | 72 | ||
198 | === modified file 'plugins/Satellites/src/Satellite.cpp' | |||
199 | --- plugins/Satellites/src/Satellite.cpp 2011-12-17 07:51:42 +0000 | |||
200 | +++ plugins/Satellites/src/Satellite.cpp 2011-12-29 12:15:27 +0000 | |||
201 | @@ -326,9 +326,17 @@ | |||
202 | 326 | return StelApp::getInstance().getVisionModeNight() ? Vec3f(0.6, 0.0, 0.0) : hintColor; | 326 | return StelApp::getInstance().getVisionModeNight() ? Vec3f(0.6, 0.0, 0.0) : hintColor; |
203 | 327 | } | 327 | } |
204 | 328 | 328 | ||
206 | 329 | float Satellite::getVMagnitude(const StelCore*) const | 329 | float Satellite::getVMagnitude(const StelCore* core, bool withExtinction) const |
207 | 330 | { | 330 | { |
209 | 331 | return 5.0; | 331 | float extinctionMag=0.0; // track magnitude loss |
210 | 332 | if (withExtinction && core->getSkyDrawer()->getFlagHasAtmosphere()) | ||
211 | 333 | { | ||
212 | 334 | Vec3d altAz=getAltAzPosApparent(core); | ||
213 | 335 | altAz.normalize(); | ||
214 | 336 | core->getSkyDrawer()->getExtinction().forward(&altAz[2], &extinctionMag); | ||
215 | 337 | } | ||
216 | 338 | |||
217 | 339 | return 5.0 + extinctionMag; | ||
218 | 332 | } | 340 | } |
219 | 333 | 341 | ||
220 | 334 | double Satellite::getAngularSize(const StelCore*) const | 342 | double Satellite::getAngularSize(const StelCore*) const |
221 | 335 | 343 | ||
222 | === modified file 'plugins/Satellites/src/Satellite.hpp' | |||
223 | --- plugins/Satellites/src/Satellite.hpp 2011-12-14 10:31:15 +0000 | |||
224 | +++ plugins/Satellites/src/Satellite.hpp 2011-12-29 12:15:27 +0000 | |||
225 | @@ -84,7 +84,7 @@ | |||
226 | 84 | { | 84 | { |
227 | 85 | return XYZ; | 85 | return XYZ; |
228 | 86 | } | 86 | } |
230 | 87 | virtual float getVMagnitude(const StelCore* core=NULL) const; | 87 | virtual float getVMagnitude(const StelCore* core=NULL, bool withExtinction=false) const; |
231 | 88 | virtual double getAngularSize(const StelCore* core) const; | 88 | virtual double getAngularSize(const StelCore* core) const; |
232 | 89 | virtual QString getNameI18n(void) const | 89 | virtual QString getNameI18n(void) const |
233 | 90 | { | 90 | { |
234 | 91 | 91 | ||
235 | === modified file 'plugins/Supernovae/src/Supernova.cpp' | |||
236 | --- plugins/Supernovae/src/Supernova.cpp 2011-08-28 16:38:25 +0000 | |||
237 | +++ plugins/Supernovae/src/Supernova.cpp 2011-12-29 12:15:27 +0000 | |||
238 | @@ -77,14 +77,14 @@ | |||
239 | 77 | float Supernova::getSelectPriority(const StelCore* core) const | 77 | float Supernova::getSelectPriority(const StelCore* core) const |
240 | 78 | { | 78 | { |
241 | 79 | //Same as StarWrapper::getSelectPriority() | 79 | //Same as StarWrapper::getSelectPriority() |
243 | 80 | return getVMagnitude(core); | 80 | return getVMagnitude(core, false); |
244 | 81 | } | 81 | } |
245 | 82 | 82 | ||
246 | 83 | QString Supernova::getInfoString(const StelCore* core, const InfoStringGroup& flags) const | 83 | QString Supernova::getInfoString(const StelCore* core, const InfoStringGroup& flags) const |
247 | 84 | { | 84 | { |
248 | 85 | QString str; | 85 | QString str; |
249 | 86 | QTextStream oss(&str); | 86 | QTextStream oss(&str); |
251 | 87 | double mag = getVMagnitude(core); | 87 | double mag = getVMagnitude(core, false); |
252 | 88 | 88 | ||
253 | 89 | if (flags&Name) | 89 | if (flags&Name) |
254 | 90 | { | 90 | { |
255 | @@ -96,7 +96,13 @@ | |||
256 | 96 | } | 96 | } |
257 | 97 | 97 | ||
258 | 98 | if (flags&Magnitude && mag <= core->getSkyDrawer()->getLimitMagnitude()) | 98 | if (flags&Magnitude && mag <= core->getSkyDrawer()->getLimitMagnitude()) |
259 | 99 | { | ||
260 | 100 | if (core->getSkyDrawer()->getFlagHasAtmosphere()) | ||
261 | 101 | oss << q_("Magnitude: <b>%1</b> (extincted to: <b>%2</b>)").arg(QString::number(getVMagnitude(core, false), 'f', 2), | ||
262 | 102 | QString::number(getVMagnitude(core, true), 'f', 2)) << "<br>"; | ||
263 | 103 | else | ||
264 | 99 | oss << q_("Magnitude: <b>%1</b>").arg(mag, 0, 'f', 2) << "<br>"; | 104 | oss << q_("Magnitude: <b>%1</b>").arg(mag, 0, 'f', 2) << "<br>"; |
265 | 105 | } | ||
266 | 100 | 106 | ||
267 | 101 | // Ra/Dec etc. | 107 | // Ra/Dec etc. |
268 | 102 | oss << getPositionInfoString(core, flags); | 108 | oss << getPositionInfoString(core, flags); |
269 | @@ -117,8 +123,16 @@ | |||
270 | 117 | return StelApp::getInstance().getVisionModeNight() ? Vec3f(0.6, 0.0, 0.0) : Vec3f(1.0, 1.0, 1.0); | 123 | return StelApp::getInstance().getVisionModeNight() ? Vec3f(0.6, 0.0, 0.0) : Vec3f(1.0, 1.0, 1.0); |
271 | 118 | } | 124 | } |
272 | 119 | 125 | ||
274 | 120 | float Supernova::getVMagnitude(const StelCore* core) const | 126 | float Supernova::getVMagnitude(const StelCore* core, bool withExtinction) const |
275 | 121 | { | 127 | { |
276 | 128 | float extinctionMag=0.0; // track magnitude loss | ||
277 | 129 | if (withExtinction && core->getSkyDrawer()->getFlagHasAtmosphere()) | ||
278 | 130 | { | ||
279 | 131 | Vec3d altAz=getAltAzPosApparent(core); | ||
280 | 132 | altAz.normalize(); | ||
281 | 133 | core->getSkyDrawer()->getExtinction().forward(&altAz[2], &extinctionMag); | ||
282 | 134 | } | ||
283 | 135 | |||
284 | 122 | double vmag = 20; | 136 | double vmag = 20; |
285 | 123 | double currentJD = core->getJDay(); | 137 | double currentJD = core->getJDay(); |
286 | 124 | double deltaJD = std::abs(peakJD-currentJD); | 138 | double deltaJD = std::abs(peakJD-currentJD); |
287 | @@ -172,7 +186,7 @@ | |||
288 | 172 | if (vmag<maxMagnitude) | 186 | if (vmag<maxMagnitude) |
289 | 173 | vmag = maxMagnitude; | 187 | vmag = maxMagnitude; |
290 | 174 | 188 | ||
292 | 175 | return vmag; | 189 | return vmag + extinctionMag; |
293 | 176 | } | 190 | } |
294 | 177 | 191 | ||
295 | 178 | double Supernova::getAngularSize(const StelCore*) const | 192 | double Supernova::getAngularSize(const StelCore*) const |
296 | @@ -194,7 +208,7 @@ | |||
297 | 194 | double mag; | 208 | double mag; |
298 | 195 | 209 | ||
299 | 196 | StelUtils::spheToRect(snra, snde, XYZ); | 210 | StelUtils::spheToRect(snra, snde, XYZ); |
301 | 197 | mag = getVMagnitude(core); | 211 | mag = getVMagnitude(core, true); |
302 | 198 | 212 | ||
303 | 199 | if (mag <= sd->getLimitMagnitude()) | 213 | if (mag <= sd->getLimitMagnitude()) |
304 | 200 | { | 214 | { |
305 | 201 | 215 | ||
306 | === modified file 'plugins/Supernovae/src/Supernova.hpp' | |||
307 | --- plugins/Supernovae/src/Supernova.hpp 2011-07-25 17:29:18 +0000 | |||
308 | +++ plugins/Supernovae/src/Supernova.hpp 2011-12-29 12:15:27 +0000 | |||
309 | @@ -65,7 +65,7 @@ | |||
310 | 65 | { | 65 | { |
311 | 66 | return XYZ; | 66 | return XYZ; |
312 | 67 | } | 67 | } |
314 | 68 | virtual float getVMagnitude(const StelCore* core) const; | 68 | virtual float getVMagnitude(const StelCore* core, bool withExtinction=false) const; |
315 | 69 | virtual double getAngularSize(const StelCore* core) const; | 69 | virtual double getAngularSize(const StelCore* core) const; |
316 | 70 | virtual QString getNameI18n(void) const | 70 | virtual QString getNameI18n(void) const |
317 | 71 | { | 71 | { |
318 | 72 | 72 | ||
319 | === modified file 'src/core/RefractionExtinction.cpp' | |||
320 | --- src/core/RefractionExtinction.cpp 2011-06-10 11:31:13 +0000 | |||
321 | +++ src/core/RefractionExtinction.cpp 2011-12-29 12:15:27 +0000 | |||
322 | @@ -20,17 +20,21 @@ | |||
323 | 20 | * Principal implementation: 2010-03-23 GZ=Georg Zotti, Georg.Zotti@univie.ac.at | 20 | * Principal implementation: 2010-03-23 GZ=Georg Zotti, Georg.Zotti@univie.ac.at |
324 | 21 | */ | 21 | */ |
325 | 22 | 22 | ||
326 | 23 | #include <qsettings.h> | ||
327 | 24 | #include "StelApp.hpp" | ||
328 | 23 | #include "RefractionExtinction.hpp" | 25 | #include "RefractionExtinction.hpp" |
329 | 24 | 26 | ||
330 | 25 | 27 | ||
331 | 26 | // To be decided: The following should be either 0 or 40 (or 42? ;-) | 28 | // To be decided: The following should be either 0 or 40 (or 42? ;-) |
333 | 27 | const float Extinction::SUBHORIZONTAL_AIRMASS=0.0f; | 29 | float Extinction::SUBHORIZONTAL_AIRMASS=0.0f; |
334 | 28 | 30 | ||
335 | 29 | Extinction::Extinction() : ext_coeff(0.20f) | 31 | Extinction::Extinction() : ext_coeff(0.20f) |
336 | 30 | { | 32 | { |
337 | 33 | QSettings* conf = StelApp::getInstance().getSettings(); | ||
338 | 34 | SUBHORIZONTAL_AIRMASS = (conf->value("astro/flag_extinction_below_horizon", true).toBool()? 42.0f : 0.0f); | ||
339 | 31 | } | 35 | } |
340 | 32 | 36 | ||
342 | 33 | // altAzPos is the normalized star position vector AFTER REFRACTION, and its z component sin(altitude). | 37 | // altAzPos is the NORMALIZED (!!!) star position vector AFTER REFRACTION, and its z component sin(altitude). |
343 | 34 | void Extinction::forward(const Vec3d *altAzPos, float *mag, const int num) const | 38 | void Extinction::forward(const Vec3d *altAzPos, float *mag, const int num) const |
344 | 35 | { | 39 | { |
345 | 36 | for (int i=0; i<num; ++i) mag[i] += airmass(altAzPos[i][2], true) * ext_coeff; | 40 | for (int i=0; i<num; ++i) mag[i] += airmass(altAzPos[i][2], true) * ext_coeff; |
346 | @@ -48,6 +52,14 @@ | |||
347 | 48 | { | 52 | { |
348 | 49 | for (int i=0; i<num; ++i) mag[i] += airmass(sinAlt[i], true) * ext_coeff; | 53 | for (int i=0; i<num; ++i) mag[i] += airmass(sinAlt[i], true) * ext_coeff; |
349 | 50 | } | 54 | } |
350 | 55 | void Extinction::forward(const double *sinAlt, float *mag) const | ||
351 | 56 | { | ||
352 | 57 | *mag += airmass(*sinAlt, true) * ext_coeff; | ||
353 | 58 | } | ||
354 | 59 | void Extinction::forward(const float *sinAlt, float *mag) const | ||
355 | 60 | { | ||
356 | 61 | *mag += airmass(*sinAlt, true) * ext_coeff; | ||
357 | 62 | } | ||
358 | 51 | // from observed magnitude in apparent (observed) altitude to atmosphere-free mag, still in apparent, refracted altitude. | 63 | // from observed magnitude in apparent (observed) altitude to atmosphere-free mag, still in apparent, refracted altitude. |
359 | 52 | void Extinction::backward(const Vec3d *altAzPos, float *mag, const int num) const | 64 | void Extinction::backward(const Vec3d *altAzPos, float *mag, const int num) const |
360 | 53 | { | 65 | { |
361 | @@ -70,7 +82,7 @@ | |||
362 | 70 | // airmass computation for cosine of zenith angle z | 82 | // airmass computation for cosine of zenith angle z |
363 | 71 | float Extinction::airmass(const float cosZ, const bool apparent_z) const | 83 | float Extinction::airmass(const float cosZ, const bool apparent_z) const |
364 | 72 | { | 84 | { |
366 | 73 | if (cosZ<-0.035f) | 85 | if (cosZ<-0.035f) // about -2 degrees. Here, RozenbergZ>574 and climbs fast! |
367 | 74 | return Extinction::SUBHORIZONTAL_AIRMASS; // Safety: 0 or 40 for below -2 degrees. | 86 | return Extinction::SUBHORIZONTAL_AIRMASS; // Safety: 0 or 40 for below -2 degrees. |
368 | 75 | 87 | ||
369 | 76 | float X; | 88 | float X; |
370 | @@ -89,6 +101,7 @@ | |||
371 | 89 | return X; | 101 | return X; |
372 | 90 | } | 102 | } |
373 | 91 | 103 | ||
374 | 104 | /* ***************************************************************************************************** */ | ||
375 | 92 | 105 | ||
376 | 93 | // The following 4 are to be configured, the rest is derived. | 106 | // The following 4 are to be configured, the rest is derived. |
377 | 94 | // Recommendations: -4.9/-4.3/0.1/0.1: sharp but continuous transition, no effects below -5. | 107 | // Recommendations: -4.9/-4.3/0.1/0.1: sharp but continuous transition, no effects below -5. |
378 | 95 | 108 | ||
379 | === modified file 'src/core/RefractionExtinction.hpp' | |||
380 | --- src/core/RefractionExtinction.hpp 2011-06-10 11:31:13 +0000 | |||
381 | +++ src/core/RefractionExtinction.hpp 2011-12-29 12:15:27 +0000 | |||
382 | @@ -31,41 +31,39 @@ | |||
383 | 31 | #include "VecMath.hpp" | 31 | #include "VecMath.hpp" |
384 | 32 | #include "StelProjector.hpp" | 32 | #include "StelProjector.hpp" |
385 | 33 | 33 | ||
390 | 34 | //! @class RefractionExtinction | 34 | //! @class Extinction |
391 | 35 | //! This class performs refraction and extinction computations, following literature from atmospheric optics and astronomy. | 35 | //! This class performs extinction computations, following literature from atmospheric optics and astronomy. |
392 | 36 | //! Airmass computations are limited to meaningful altitudes, | 36 | //! Airmass computations are limited to meaningful altitudes. |
389 | 37 | //! and refraction solutions can only be aproximate, given the turbulent, unpredictable real atmosphere. | ||
393 | 38 | //! The solution provided here will [hopefully!] result in a visible "zone of avoidance" near the horizon down to altitude -2, | 37 | //! The solution provided here will [hopefully!] result in a visible "zone of avoidance" near the horizon down to altitude -2, |
397 | 39 | //! and will show stars in their full brightness at their geometrical positions below -5 degrees. | 38 | //! and may show stars in their full brightness below -2 degrees. |
398 | 40 | //! Of course, plotting stars below the horizon could be coupled to setting of horizon foreground, | 39 | //! Typical horizons do not go down below -1, so all natural sites should be covered. |
396 | 41 | //! it's another usability issue. Typical horizons do not go down below -1, so strange effects between -2 and -5 should be covered. | ||
399 | 42 | //! Note that forward/backward are no absolute reverse operations! | 40 | //! Note that forward/backward are no absolute reverse operations! |
400 | 43 | //! All the computations should be in effect | 41 | //! All the computations should be in effect |
401 | 44 | //! (1) only if atmosphere effects are true | 42 | //! (1) only if atmosphere effects are true |
404 | 45 | //! (2) only for celestial objects, never for landscape coordinates | 43 | //! (2) only for terrestrial locations, not on Moon/Mars/Saturn etc |
405 | 46 | //! (3) only for terrestrial locations, not on Moon/Mars/Saturn etc | 44 | //! config.ini:astro/flag_extinction_below_horizon=true|false controls if extinction kills objects below -2 degrees altitude by setting airmass to 42. |
406 | 47 | class Extinction | 45 | class Extinction |
407 | 48 | { | 46 | { |
408 | 49 | public: | 47 | public: |
409 | 50 | Extinction(); | 48 | Extinction(); |
410 | 51 | //! Compute extinction effect for arrays of size @param num position vectors and magnitudes. | 49 | //! Compute extinction effect for arrays of size @param num position vectors and magnitudes. |
412 | 52 | //! @param altAzPos are the normalized (apparent) star position vectors, and their z components sin(apparent_altitude). | 50 | //! @param altAzPos are the NORMALIZED (!!) (apparent) star position vectors, and their z components sin(apparent_altitude). |
413 | 53 | //! This call must therefore be done after application of Refraction, and only if atmospheric effects are on. | 51 | //! This call must therefore be done after application of Refraction, and only if atmospheric effects are on. |
414 | 54 | //! Note that forward/backward are no absolute reverse operations! | 52 | //! Note that forward/backward are no absolute reverse operations! |
418 | 55 | void forward(const Vec3d *altAzPos, float *mag, const int num) const; | 53 | void forward(const Vec3d *altAzPos, float *mag, const int num=1) const; |
419 | 56 | void forward(const Vec3f *altAzPos, float *mag, const int num) const; | 54 | void forward(const Vec3f *altAzPos, float *mag, const int num=1) const; |
417 | 57 | //! Convenience method for the same | ||
420 | 58 | void forward(const double *sinAlt, float *mag, const int num) const; | 55 | void forward(const double *sinAlt, float *mag, const int num) const; |
421 | 59 | void forward(const float *sinAlt, float *mag, const int num) const; | 56 | void forward(const float *sinAlt, float *mag, const int num) const; |
422 | 57 | void forward(const double *sinAlt, float *mag) const; | ||
423 | 58 | void forward(const float *sinAlt, float *mag) const; | ||
424 | 60 | 59 | ||
427 | 61 | //! Compute extinction effect for arrays of size @param size position vectors and magnitudes. | 60 | //! Compute inverse extinction effect for arrays of size @param num position vectors and magnitudes. |
428 | 62 | //! @param altAzPos are the normalized (apparent) star position vectors, and their z components sin(apparent_altitude). | 61 | //! @param altAzPos are the NORMALIZED (!!) (apparent) star position vectors, and their z components sin(apparent_altitude). |
429 | 63 | //! Note that forward/backward are no absolute reverse operations! | 62 | //! Note that forward/backward are no absolute reverse operations! |
435 | 64 | void backward(const Vec3d *altAzPos, float *mag, const int num) const; | 63 | void backward(const Vec3d *altAzPos, float *mag, const int num=1) const; |
436 | 65 | void backward(const Vec3f *altAzPos, float *mag, const int num) const; | 64 | void backward(const Vec3f *altAzPos, float *mag, const int num=1) const; |
437 | 66 | //! Convenience method for the same | 65 | void backward(const double *sinAlt, float *mag, const int num=1) const; |
438 | 67 | void backward(const double *sinAlt, float *mag, const int num) const; | 66 | void backward(const float *sinAlt, float *mag, const int num=1) const; |
434 | 68 | void backward(const float *sinAlt, float *mag, const int num) const; | ||
439 | 69 | 67 | ||
440 | 70 | //! Set visual extinction coefficient (mag/airmass), influences extinction computation. | 68 | //! Set visual extinction coefficient (mag/airmass), influences extinction computation. |
441 | 71 | //! @param k= 0.1 for highest mountains, 0.2 for very good lowland locations, 0.35 for typical lowland, 0.5 in humid climates. | 69 | //! @param k= 0.1 for highest mountains, 0.2 for very good lowland locations, 0.35 for typical lowland, 0.5 in humid climates. |
442 | @@ -84,11 +82,20 @@ | |||
443 | 84 | 82 | ||
444 | 85 | //! k, magnitudes/airmass, in [0.00, ... 1.00], (default 0.20). | 83 | //! k, magnitudes/airmass, in [0.00, ... 1.00], (default 0.20). |
445 | 86 | float ext_coeff; | 84 | float ext_coeff; |
447 | 87 | //! should be either 0.0 (stars visible in full brightness below horizon) or 40.0 (practically invisible) | 85 | //! should be either 0.0 (stars visible in full brightness below horizon) or 40.0 (or 42? ;-) practically invisible) |
448 | 88 | //! Maybe make this a user-configurable option? | 86 | //! Maybe make this a user-configurable option? |
450 | 89 | static const float SUBHORIZONTAL_AIRMASS; | 87 | static float SUBHORIZONTAL_AIRMASS; |
451 | 90 | }; | 88 | }; |
452 | 91 | 89 | ||
453 | 90 | //! @class Refraction | ||
454 | 91 | //! This class performs refraction computations, following literature from atmospheric optics and astronomy. | ||
455 | 92 | //! Refraction solutions can only be aproximate, given the turbulent, unpredictable real atmosphere. | ||
456 | 93 | //! Typical horizons do not go down below -1, so strange effects (distortion) between -2 and -5 should be covered. | ||
457 | 94 | //! Note that forward/backward are no absolute reverse operations! | ||
458 | 95 | //! All the computations should be in effect | ||
459 | 96 | //! (1) only if atmosphere effects are true | ||
460 | 97 | //! (2) only for celestial objects, never for landscape images | ||
461 | 98 | //! (3) only for terrestrial locations, not on Moon/Mars/Saturn etc | ||
462 | 92 | 99 | ||
463 | 93 | class Refraction: public StelProjector::ModelViewTranform | 100 | class Refraction: public StelProjector::ModelViewTranform |
464 | 94 | { | 101 | { |
465 | 95 | 102 | ||
466 | === modified file 'src/core/StelObject.cpp' | |||
467 | --- src/core/StelObject.cpp 2011-06-08 15:08:06 +0000 | |||
468 | +++ src/core/StelObject.cpp 2011-12-29 12:15:27 +0000 | |||
469 | @@ -71,6 +71,7 @@ | |||
470 | 71 | // Format the positional info string contain J2000/of date/altaz/hour angle positions for the object | 71 | // Format the positional info string contain J2000/of date/altaz/hour angle positions for the object |
471 | 72 | QString StelObject::getPositionInfoString(const StelCore *core, const InfoStringGroup& flags) const | 72 | QString StelObject::getPositionInfoString(const StelCore *core, const InfoStringGroup& flags) const |
472 | 73 | { | 73 | { |
473 | 74 | bool withAtmosphere=core->getSkyDrawer()->getFlagHasAtmosphere(); | ||
474 | 74 | QString res; | 75 | QString res; |
475 | 75 | if (flags&RaDecJ2000) | 76 | if (flags&RaDecJ2000) |
476 | 76 | { | 77 | { |
477 | @@ -88,13 +89,18 @@ | |||
478 | 88 | 89 | ||
479 | 89 | if (flags&HourAngle) | 90 | if (flags&HourAngle) |
480 | 90 | { | 91 | { |
488 | 91 | double dec_sideral, ra_sideral; | 92 | double dec_sidereal, ra_sidereal; |
489 | 92 | StelUtils::rectToSphe(&ra_sideral,&dec_sideral,getSideralPosGeometric(core)); | 93 | StelUtils::rectToSphe(&ra_sidereal,&dec_sidereal,getSideralPosGeometric(core)); |
490 | 93 | ra_sideral = 2.*M_PI-ra_sideral; | 94 | ra_sidereal = 2.*M_PI-ra_sidereal; |
491 | 94 | res += q_("Hour angle/DE: %1/%2").arg(StelUtils::radToHmsStr(ra_sideral), StelUtils::radToDmsStr(dec_sideral)) + " " + q_("(geometric)") + "<br>"; | 95 | if (withAtmosphere) |
492 | 95 | StelUtils::rectToSphe(&ra_sideral,&dec_sideral,getSideralPosApparent(core)); | 96 | { |
493 | 96 | ra_sideral = 2.*M_PI-ra_sideral; | 97 | res += q_("Hour angle/DE: %1/%2").arg(StelUtils::radToHmsStr(ra_sidereal), StelUtils::radToDmsStr(dec_sidereal)) + " " + q_("(geometric)") + "<br>"; |
494 | 97 | res += q_("Hour angle/DE: %1/%2").arg(StelUtils::radToHmsStr(ra_sideral), StelUtils::radToDmsStr(dec_sideral)) + " " + q_("(apparent)") + "<br>"; | 98 | StelUtils::rectToSphe(&ra_sidereal,&dec_sidereal,getSideralPosApparent(core)); |
495 | 99 | ra_sidereal = 2.*M_PI-ra_sidereal; | ||
496 | 100 | res += q_("Hour angle/DE: %1/%2").arg(StelUtils::radToHmsStr(ra_sidereal), StelUtils::radToDmsStr(dec_sidereal)) + " " + q_("(apparent)") + "<br>"; | ||
497 | 101 | } | ||
498 | 102 | else | ||
499 | 103 | res += q_("Hour angle/DE: %1/%2").arg(StelUtils::radToHmsStr(ra_sidereal), StelUtils::radToDmsStr(dec_sidereal)) + " " + "<br>"; | ||
500 | 98 | } | 104 | } |
501 | 99 | 105 | ||
502 | 100 | if (flags&AltAzi) | 106 | if (flags&AltAzi) |
503 | @@ -105,13 +111,18 @@ | |||
504 | 105 | az = 3.*M_PI - az; // N is zero, E is 90 degrees | 111 | az = 3.*M_PI - az; // N is zero, E is 90 degrees |
505 | 106 | if (az > M_PI*2) | 112 | if (az > M_PI*2) |
506 | 107 | az -= M_PI*2; | 113 | az -= M_PI*2; |
508 | 108 | res += q_("Az/Alt: %1/%2").arg(StelUtils::radToDmsStr(az), StelUtils::radToDmsStr(alt)) + " " + q_("(geometric)") + "<br>"; | 114 | if (withAtmosphere) |
509 | 115 | { | ||
510 | 116 | res += q_("Az/Alt: %1/%2").arg(StelUtils::radToDmsStr(az), StelUtils::radToDmsStr(alt)) + " " + q_("(geometric)") + "<br>"; | ||
511 | 109 | 117 | ||
517 | 110 | StelUtils::rectToSphe(&az,&alt,getAltAzPosApparent(core)); | 118 | StelUtils::rectToSphe(&az,&alt,getAltAzPosApparent(core)); |
518 | 111 | az = 3.*M_PI - az; // N is zero, E is 90 degrees | 119 | az = 3.*M_PI - az; // N is zero, E is 90 degrees |
519 | 112 | if (az > M_PI*2) | 120 | if (az > M_PI*2) |
520 | 113 | az -= M_PI*2; | 121 | az -= M_PI*2; |
521 | 114 | res += q_("Az/Alt: %1/%2").arg(StelUtils::radToDmsStr(az), StelUtils::radToDmsStr(alt)) + " " + q_("(apparent)") + "<br>"; | 122 | res += q_("Az/Alt: %1/%2").arg(StelUtils::radToDmsStr(az), StelUtils::radToDmsStr(alt)) + " " + q_("(apparent)") + "<br>"; |
522 | 123 | } | ||
523 | 124 | else | ||
524 | 125 | res += q_("Az/Alt: %1/%2").arg(StelUtils::radToDmsStr(az), StelUtils::radToDmsStr(alt)) + " " + "<br>"; | ||
525 | 115 | } | 126 | } |
526 | 116 | return res; | 127 | return res; |
527 | 117 | } | 128 | } |
528 | 118 | 129 | ||
529 | === modified file 'src/core/StelObject.hpp' | |||
530 | --- src/core/StelObject.hpp 2011-06-03 09:45:50 +0000 | |||
531 | +++ src/core/StelObject.hpp 2011-12-29 12:15:27 +0000 | |||
532 | @@ -120,7 +120,7 @@ | |||
533 | 120 | Vec3d getAltAzPosAuto(const StelCore* core) const; | 120 | Vec3d getAltAzPosAuto(const StelCore* core) const; |
534 | 121 | 121 | ||
535 | 122 | //! Return object's apparent V magnitude as seen from observer | 122 | //! Return object's apparent V magnitude as seen from observer |
537 | 123 | virtual float getVMagnitude(const StelCore*) const {return 99;} | 123 | virtual float getVMagnitude(const StelCore*, bool withExtinction=false) const {return 99;} |
538 | 124 | 124 | ||
539 | 125 | //! Return a priority value which is used to discriminate objects by priority | 125 | //! Return a priority value which is used to discriminate objects by priority |
540 | 126 | //! As for magnitudes, the lower is the higher priority | 126 | //! As for magnitudes, the lower is the higher priority |
541 | 127 | 127 | ||
542 | === modified file 'src/core/StelSkyDrawer.cpp' | |||
543 | --- src/core/StelSkyDrawer.cpp 2011-05-31 13:06:03 +0000 | |||
544 | +++ src/core/StelSkyDrawer.cpp 2011-12-29 12:15:27 +0000 | |||
545 | @@ -106,7 +106,7 @@ | |||
546 | 106 | ok = true; | 106 | ok = true; |
547 | 107 | } | 107 | } |
548 | 108 | 108 | ||
550 | 109 | //GZ: load 3 values from config for now. TODO: make adjustable with GUI! | 109 | //GZ: load 3 values from config. |
551 | 110 | setExtinctionCoefficient(conf->value("landscape/atmospheric_extinction_coefficient",0.2).toDouble(&ok)); | 110 | setExtinctionCoefficient(conf->value("landscape/atmospheric_extinction_coefficient",0.2).toDouble(&ok)); |
552 | 111 | if (!ok) | 111 | if (!ok) |
553 | 112 | { | 112 | { |
554 | @@ -242,6 +242,16 @@ | |||
555 | 242 | fov = minAdaptFov; | 242 | fov = minAdaptFov; |
556 | 243 | } | 243 | } |
557 | 244 | 244 | ||
558 | 245 | // GZ: Light pollution must take global atmosphere setting into acount! | ||
559 | 246 | // moved parts from setBortleScale() here | ||
560 | 247 | // These value have been calibrated by hand, looking at the faintest star in stellarium at around 40 deg FOV | ||
561 | 248 | // They should roughly match the scale described at http://en.wikipedia.org/wiki/Bortle_Dark-Sky_Scale | ||
562 | 249 | static const float bortleToInScale[9] = {2.45, 1.55, 1.0, 0.63, 0.40, 0.24, 0.23, 0.145, 0.09}; | ||
563 | 250 | if (getFlagHasAtmosphere()) | ||
564 | 251 | setInputScale(bortleToInScale[bortleScaleIndex-1]); | ||
565 | 252 | else | ||
566 | 253 | setInputScale(bortleToInScale[0]); | ||
567 | 254 | |||
568 | 245 | // This factor is fully arbitrary. It corresponds to the collecting area x exposure time of the instrument | 255 | // This factor is fully arbitrary. It corresponds to the collecting area x exposure time of the instrument |
569 | 246 | // It is based on a power law, so that it varies progressively with the FOV to smoothly switch from human | 256 | // It is based on a power law, so that it varies progressively with the FOV to smoothly switch from human |
570 | 247 | // vision to binocculares/telescope. Use a max of 0.7 because after that the atmosphere starts to glow too much! | 257 | // vision to binocculares/telescope. Use a max of 0.7 because after that the atmosphere starts to glow too much! |
571 | @@ -731,11 +741,11 @@ | |||
572 | 731 | } | 741 | } |
573 | 732 | 742 | ||
574 | 733 | bortleScaleIndex = bIndex; | 743 | bortleScaleIndex = bIndex; |
576 | 734 | 744 | // GZ: I moved this block to update() | |
577 | 735 | // These value have been calibrated by hand, looking at the faintest star in stellarium at around 40 deg FOV | 745 | // These value have been calibrated by hand, looking at the faintest star in stellarium at around 40 deg FOV |
578 | 736 | // They should roughly match the scale described at http://en.wikipedia.org/wiki/Bortle_Dark-Sky_Scale | 746 | // They should roughly match the scale described at http://en.wikipedia.org/wiki/Bortle_Dark-Sky_Scale |
581 | 737 | static const float bortleToInScale[9] = {2.45, 1.55, 1.0, 0.63, 0.40, 0.24, 0.23, 0.145, 0.09}; | 747 | // static const float bortleToInScale[9] = {2.45, 1.55, 1.0, 0.63, 0.40, 0.24, 0.23, 0.145, 0.09}; |
582 | 738 | setInputScale(bortleToInScale[bIndex-1]); | 748 | // setInputScale(bortleToInScale[bIndex-1]); |
583 | 739 | } | 749 | } |
584 | 740 | 750 | ||
585 | 741 | 751 | ||
586 | 742 | 752 | ||
587 | === modified file 'src/core/modules/Comet.cpp' | |||
588 | --- src/core/modules/Comet.cpp 2011-11-25 13:51:35 +0000 | |||
589 | +++ src/core/modules/Comet.cpp 2011-12-29 12:15:27 +0000 | |||
590 | @@ -115,7 +115,13 @@ | |||
591 | 115 | } | 115 | } |
592 | 116 | 116 | ||
593 | 117 | if (flags&Magnitude) | 117 | if (flags&Magnitude) |
595 | 118 | oss << q_("Magnitude: <b>%1</b>").arg(getVMagnitude(core), 0, 'f', 2) << "<br>"; | 118 | { |
596 | 119 | if (core->getSkyDrawer()->getFlagHasAtmosphere()) | ||
597 | 120 | oss << q_("Magnitude: <b>%1</b> (extincted to: <b>%2</b>)").arg(QString::number(getVMagnitude(core, false), 'f', 2), | ||
598 | 121 | QString::number(getVMagnitude(core, true), 'f', 2)) << "<br>"; | ||
599 | 122 | else | ||
600 | 123 | oss << q_("Magnitude: <b>%1</b>").arg(getVMagnitude(core, false), 0, 'f', 2) << "<br>"; | ||
601 | 124 | } | ||
602 | 119 | 125 | ||
603 | 120 | if (flags&AbsoluteMagnitude) | 126 | if (flags&AbsoluteMagnitude) |
604 | 121 | { | 127 | { |
605 | @@ -157,13 +163,21 @@ | |||
606 | 157 | return str; | 163 | return str; |
607 | 158 | } | 164 | } |
608 | 159 | 165 | ||
610 | 160 | float Comet::getVMagnitude(const StelCore* core) const | 166 | float Comet::getVMagnitude(const StelCore* core, bool withExtinction) const |
611 | 161 | { | 167 | { |
612 | 162 | //If the two parameter system is not used, | 168 | //If the two parameter system is not used, |
613 | 163 | //use the default radius/albedo mechanism | 169 | //use the default radius/albedo mechanism |
614 | 164 | if (slopeParameter < 0) | 170 | if (slopeParameter < 0) |
615 | 165 | { | 171 | { |
617 | 166 | return Planet::getVMagnitude(core); | 172 | return Planet::getVMagnitude(core, withExtinction); |
618 | 173 | } | ||
619 | 174 | |||
620 | 175 | float extinctionMag=0.0; // track magnitude loss | ||
621 | 176 | if (withExtinction && core->getSkyDrawer()->getFlagHasAtmosphere()) | ||
622 | 177 | { | ||
623 | 178 | Vec3d altAz=getAltAzPosApparent(core); | ||
624 | 179 | altAz.normalize(); | ||
625 | 180 | core->getSkyDrawer()->getExtinction().forward(&altAz[2], &extinctionMag); | ||
626 | 167 | } | 181 | } |
627 | 168 | 182 | ||
628 | 169 | //Calculate distances | 183 | //Calculate distances |
629 | @@ -178,5 +192,5 @@ | |||
630 | 178 | //http://www.ayton.id.au/gary/Science/Astronomy/Ast_comets.htm#Comet%20facts: | 192 | //http://www.ayton.id.au/gary/Science/Astronomy/Ast_comets.htm#Comet%20facts: |
631 | 179 | double apparentMagnitude = absoluteMagnitude + 5 * std::log10(observerCometDistance) + 2.5 * slopeParameter * std::log10(cometSunDistance); | 193 | double apparentMagnitude = absoluteMagnitude + 5 * std::log10(observerCometDistance) + 2.5 * slopeParameter * std::log10(cometSunDistance); |
632 | 180 | 194 | ||
634 | 181 | return apparentMagnitude; | 195 | return apparentMagnitude + extinctionMag; |
635 | 182 | } | 196 | } |
636 | 183 | 197 | ||
637 | === modified file 'src/core/modules/Comet.hpp' | |||
638 | --- src/core/modules/Comet.hpp 2011-06-12 15:30:54 +0000 | |||
639 | +++ src/core/modules/Comet.hpp 2011-12-29 12:15:27 +0000 | |||
640 | @@ -65,7 +65,7 @@ | |||
641 | 65 | //was not designed to handle different types of objects. | 65 | //was not designed to handle different types of objects. |
642 | 66 | //virtual QString getType() const {return "Comet";} | 66 | //virtual QString getType() const {return "Comet";} |
643 | 67 | //! \todo Find better sources for the g,k system | 67 | //! \todo Find better sources for the g,k system |
645 | 68 | virtual float getVMagnitude(const StelCore* core) const; | 68 | virtual float getVMagnitude(const StelCore* core, bool withExtinction=false) const; |
646 | 69 | 69 | ||
647 | 70 | //! \brief sets absolute magnitude and slope parameter. | 70 | //! \brief sets absolute magnitude and slope parameter. |
648 | 71 | //! These are the parameters in the IAU's two-parameter magnitude system | 71 | //! These are the parameters in the IAU's two-parameter magnitude system |
649 | 72 | 72 | ||
650 | === modified file 'src/core/modules/Constellation.cpp' | |||
651 | --- src/core/modules/Constellation.cpp 2011-05-31 13:06:03 +0000 | |||
652 | +++ src/core/modules/Constellation.cpp 2011-12-29 12:15:27 +0000 | |||
653 | @@ -220,7 +220,7 @@ | |||
654 | 220 | // so check all segment endpoints: | 220 | // so check all segment endpoints: |
655 | 221 | for (int i=2*numberOfSegments-1;i>=0;i--) | 221 | for (int i=2*numberOfSegments-1;i>=0;i--) |
656 | 222 | { | 222 | { |
658 | 223 | const float Mag = asterism[i]->getVMagnitude(0); | 223 | const float Mag = asterism[i]->getVMagnitude(0, false); |
659 | 224 | if (Mag < maxMag) | 224 | if (Mag < maxMag) |
660 | 225 | { | 225 | { |
661 | 226 | brightest = asterism[i]; | 226 | brightest = asterism[i]; |
662 | 227 | 227 | ||
663 | === modified file 'src/core/modules/ConstellationMgr.hpp' | |||
664 | --- src/core/modules/ConstellationMgr.hpp 2011-05-31 13:06:03 +0000 | |||
665 | +++ src/core/modules/ConstellationMgr.hpp 2011-12-29 12:15:27 +0000 | |||
666 | @@ -189,7 +189,7 @@ | |||
667 | 189 | //! the boundary separates. | 189 | //! the boundary separates. |
668 | 190 | //! @param conCatFile the path to the file which contains the constellation boundary data. | 190 | //! @param conCatFile the path to the file which contains the constellation boundary data. |
669 | 191 | bool loadBoundaries(const QString& conCatFile); | 191 | bool loadBoundaries(const QString& conCatFile); |
671 | 192 | //! Draw the constellation lines at the epoch given by the StelNavigator. | 192 | //! Draw the constellation lines at the epoch given by the StelCore. |
672 | 193 | void drawLines(StelPainter& sPainter, const StelCore* core) const; | 193 | void drawLines(StelPainter& sPainter, const StelCore* core) const; |
673 | 194 | //! Draw the constellation art. | 194 | //! Draw the constellation art. |
674 | 195 | void drawArt(StelPainter& sPainter) const; | 195 | void drawArt(StelPainter& sPainter) const; |
675 | 196 | 196 | ||
676 | === modified file 'src/core/modules/LandscapeMgr.cpp' | |||
677 | --- src/core/modules/LandscapeMgr.cpp 2011-09-29 07:14:01 +0000 | |||
678 | +++ src/core/modules/LandscapeMgr.cpp 2011-12-29 12:15:27 +0000 | |||
679 | @@ -239,7 +239,7 @@ | |||
680 | 239 | else | 239 | else |
681 | 240 | landscapeBrightness = (0.01 + 1.5*(sinSunAngleRad+0.1/1.5)); | 240 | landscapeBrightness = (0.01 + 1.5*(sinSunAngleRad+0.1/1.5)); |
682 | 241 | if (moonPos[2] > -0.1/1.5) | 241 | if (moonPos[2] > -0.1/1.5) |
684 | 242 | landscapeBrightness += qMax(0.2/-12.*ssystem->getMoon()->getVMagnitude(core),0.)*moonPos[2]; | 242 | landscapeBrightness += qMax(0.2/-12.*ssystem->getMoon()->getVMagnitude(core, true),0.)*moonPos[2]; |
685 | 243 | 243 | ||
686 | 244 | // TODO make this more generic for non-atmosphere planets | 244 | // TODO make this more generic for non-atmosphere planets |
687 | 245 | if(atmosphere->getFadeIntensity() == 1) | 245 | if(atmosphere->getFadeIntensity() == 1) |
688 | 246 | 246 | ||
689 | === modified file 'src/core/modules/MinorPlanet.cpp' | |||
690 | --- src/core/modules/MinorPlanet.cpp 2011-11-25 13:51:35 +0000 | |||
691 | +++ src/core/modules/MinorPlanet.cpp 2011-12-29 12:15:27 +0000 | |||
692 | @@ -190,7 +190,14 @@ | |||
693 | 190 | } | 190 | } |
694 | 191 | 191 | ||
695 | 192 | if (flags&Magnitude) | 192 | if (flags&Magnitude) |
697 | 193 | oss << q_("Magnitude: <b>%1</b>").arg(getVMagnitude(core), 0, 'f', 2) << "<br>"; | 193 | { |
698 | 194 | if (core->getSkyDrawer()->getFlagHasAtmosphere()) | ||
699 | 195 | oss << q_("Magnitude: <b>%1</b> (extincted to: <b>%2</b>)").arg(QString::number(getVMagnitude(core, false), 'f', 2), | ||
700 | 196 | QString::number(getVMagnitude(core, true), 'f', 2)) << "<br>"; | ||
701 | 197 | else | ||
702 | 198 | oss << q_("Magnitude: <b>%1</b>").arg(getVMagnitude(core, false), 0, 'f', 2) << "<br>"; | ||
703 | 199 | |||
704 | 200 | } | ||
705 | 194 | 201 | ||
706 | 195 | if (flags&AbsoluteMagnitude) | 202 | if (flags&AbsoluteMagnitude) |
707 | 196 | { | 203 | { |
708 | @@ -198,7 +205,7 @@ | |||
709 | 198 | //If the H-G system is not used, use the default radius/albedo mechanism | 205 | //If the H-G system is not used, use the default radius/albedo mechanism |
710 | 199 | if (slopeParameter < 0) | 206 | if (slopeParameter < 0) |
711 | 200 | { | 207 | { |
713 | 201 | oss << q_("Absolute Magnitude: %1").arg(getVMagnitude(core) - 5. * (std::log10(getJ2000EquatorialPos(core).length()*AU/PARSEC)-1.), 0, 'f', 2) << "<br>"; | 208 | oss << q_("Absolute Magnitude: %1").arg(getVMagnitude(core, false) - 5. * (std::log10(getJ2000EquatorialPos(core).length()*AU/PARSEC)-1.), 0, 'f', 2) << "<br>"; |
714 | 202 | } | 209 | } |
715 | 203 | else | 210 | else |
716 | 204 | { | 211 | { |
717 | @@ -241,17 +248,25 @@ | |||
718 | 241 | return str; | 248 | return str; |
719 | 242 | } | 249 | } |
720 | 243 | 250 | ||
722 | 244 | float MinorPlanet::getVMagnitude(const StelCore* core) const | 251 | float MinorPlanet::getVMagnitude(const StelCore* core, bool withExtinction) const |
723 | 245 | { | 252 | { |
724 | 253 | float extinctionMag=0.0; // track magnitude loss | ||
725 | 254 | if (withExtinction) | ||
726 | 255 | { | ||
727 | 256 | Vec3d altAz=getAltAzPosApparent(core); | ||
728 | 257 | altAz.normalize(); | ||
729 | 258 | core->getSkyDrawer()->getExtinction().forward(&altAz[2], &extinctionMag); | ||
730 | 259 | } | ||
731 | 260 | |||
732 | 246 | //If the H-G system is not used, use the default radius/albedo mechanism | 261 | //If the H-G system is not used, use the default radius/albedo mechanism |
733 | 247 | if (slopeParameter < 0) | 262 | if (slopeParameter < 0) |
734 | 248 | { | 263 | { |
736 | 249 | return Planet::getVMagnitude(core); | 264 | return Planet::getVMagnitude(core, withExtinction); |
737 | 250 | } | 265 | } |
738 | 251 | 266 | ||
739 | 252 | //Calculate phase angle | 267 | //Calculate phase angle |
740 | 253 | //(Code copied from Planet::getVMagnitude()) | 268 | //(Code copied from Planet::getVMagnitude()) |
742 | 254 | //(LOL, this is actually vector substraction + the cosine theorem :)) | 269 | //(LOL, this is actually vector subtraction + the cosine theorem :)) |
743 | 255 | const Vec3d& observerHelioPos = core->getObserverHeliocentricEclipticPos(); | 270 | const Vec3d& observerHelioPos = core->getObserverHeliocentricEclipticPos(); |
744 | 256 | const double observerRq = observerHelioPos.lengthSquared(); | 271 | const double observerRq = observerHelioPos.lengthSquared(); |
745 | 257 | const Vec3d& planetHelioPos = getHeliocentricEclipticPos(); | 272 | const Vec3d& planetHelioPos = getHeliocentricEclipticPos(); |
746 | @@ -270,7 +285,7 @@ | |||
747 | 270 | //TODO: See if you can "collapse" some calculations | 285 | //TODO: See if you can "collapse" some calculations |
748 | 271 | double apparentMagnitude = reducedMagnitude + 5 * std::log10(std::sqrt(planetRq * observerPlanetRq)); | 286 | double apparentMagnitude = reducedMagnitude + 5 * std::log10(std::sqrt(planetRq * observerPlanetRq)); |
749 | 272 | 287 | ||
751 | 273 | return apparentMagnitude; | 288 | return apparentMagnitude+extinctionMag; |
752 | 274 | } | 289 | } |
753 | 275 | 290 | ||
754 | 276 | void MinorPlanet::translateName(StelTranslator &translator) | 291 | void MinorPlanet::translateName(StelTranslator &translator) |
755 | 277 | 292 | ||
756 | === modified file 'src/core/modules/MinorPlanet.hpp' | |||
757 | --- src/core/modules/MinorPlanet.hpp 2011-06-12 15:30:54 +0000 | |||
758 | +++ src/core/modules/MinorPlanet.hpp 2011-12-29 12:15:27 +0000 | |||
759 | @@ -70,7 +70,7 @@ | |||
760 | 70 | //was not designed to handle different types of objects. | 70 | //was not designed to handle different types of objects. |
761 | 71 | // \todo Decide if this is going to be "MinorPlanet" or "Asteroid" | 71 | // \todo Decide if this is going to be "MinorPlanet" or "Asteroid" |
762 | 72 | //virtual QString getType() const {return "MinorPlanet";} | 72 | //virtual QString getType() const {return "MinorPlanet";} |
764 | 73 | virtual float getVMagnitude(const StelCore* core) const; | 73 | virtual float getVMagnitude(const StelCore* core, bool withExtinction=false) const; |
765 | 74 | //! sets the nameI18 property with the appropriate translation. | 74 | //! sets the nameI18 property with the appropriate translation. |
766 | 75 | //! Function overriden to handle the problem with name conflicts. | 75 | //! Function overriden to handle the problem with name conflicts. |
767 | 76 | virtual void translateName(StelTranslator& trans); | 76 | virtual void translateName(StelTranslator& trans); |
768 | 77 | 77 | ||
769 | === modified file 'src/core/modules/Nebula.cpp' | |||
770 | --- src/core/modules/Nebula.cpp 2011-05-31 13:06:03 +0000 | |||
771 | +++ src/core/modules/Nebula.cpp 2011-12-29 12:15:27 +0000 | |||
772 | @@ -96,8 +96,13 @@ | |||
773 | 96 | oss << q_("Type: <b>%1</b>").arg(getTypeString()) << "<br>"; | 96 | oss << q_("Type: <b>%1</b>").arg(getTypeString()) << "<br>"; |
774 | 97 | 97 | ||
775 | 98 | if (mag < 50 && flags&Magnitude) | 98 | if (mag < 50 && flags&Magnitude) |
778 | 99 | oss << q_("Magnitude: <b>%1</b>").arg(mag, 0, 'f', 2) << "<br>"; | 99 | { |
779 | 100 | 100 | if (core->getSkyDrawer()->getFlagHasAtmosphere()) | |
780 | 101 | oss << q_("Magnitude: <b>%1</b> (extincted to: <b>%2</b>)").arg(QString::number(getVMagnitude(core, false), 'f', 2), | ||
781 | 102 | QString::number(getVMagnitude(core, true), 'f', 2)) << "<br>"; | ||
782 | 103 | else | ||
783 | 104 | oss << q_("Magnitude: <b>%1</b>").arg(getVMagnitude(core, false), 0, 'f', 2) << "<br>"; | ||
784 | 105 | } | ||
785 | 101 | oss << getPositionInfoString(core, flags); | 106 | oss << getPositionInfoString(core, flags); |
786 | 102 | 107 | ||
787 | 103 | if (angularSize>0 && flags&Size) | 108 | if (angularSize>0 && flags&Size) |
788 | @@ -108,6 +113,20 @@ | |||
789 | 108 | return str; | 113 | return str; |
790 | 109 | } | 114 | } |
791 | 110 | 115 | ||
792 | 116 | float Nebula::getVMagnitude(const StelCore* core, bool withExtinction) const | ||
793 | 117 | { | ||
794 | 118 | float extinctionMag=0.0; // track magnitude loss | ||
795 | 119 | if (withExtinction && core->getSkyDrawer()->getFlagHasAtmosphere()) | ||
796 | 120 | { | ||
797 | 121 | Vec3d altAz=getAltAzPosApparent(core); | ||
798 | 122 | altAz.normalize(); | ||
799 | 123 | core->getSkyDrawer()->getExtinction().forward(&altAz[2], &extinctionMag); | ||
800 | 124 | } | ||
801 | 125 | |||
802 | 126 | return mag+extinctionMag; | ||
803 | 127 | } | ||
804 | 128 | |||
805 | 129 | |||
806 | 111 | float Nebula::getSelectPriority(const StelCore* core) const | 130 | float Nebula::getSelectPriority(const StelCore* core) const |
807 | 112 | { | 131 | { |
808 | 113 | if( ((NebulaMgr*)StelApp::getInstance().getModuleMgr().getModule("NebulaMgr"))->getFlagHints() ) | 132 | if( ((NebulaMgr*)StelApp::getInstance().getModuleMgr().getModule("NebulaMgr"))->getFlagHints() ) |
809 | @@ -117,8 +136,8 @@ | |||
810 | 117 | } | 136 | } |
811 | 118 | else | 137 | else |
812 | 119 | { | 138 | { |
815 | 120 | if (getVMagnitude(core)>20.f) return 20.f; | 139 | if (getVMagnitude(core, false)>20.f) return 20.f; |
816 | 121 | return getVMagnitude(core); | 140 | return getVMagnitude(core, false); |
817 | 122 | } | 141 | } |
818 | 123 | } | 142 | } |
819 | 124 | 143 | ||
820 | 125 | 144 | ||
821 | === modified file 'src/core/modules/Nebula.hpp' | |||
822 | --- src/core/modules/Nebula.hpp 2011-05-31 13:06:03 +0000 | |||
823 | +++ src/core/modules/Nebula.hpp 2011-12-29 12:15:27 +0000 | |||
824 | @@ -53,7 +53,7 @@ | |||
825 | 53 | virtual QString getType() const {return "Nebula";} | 53 | virtual QString getType() const {return "Nebula";} |
826 | 54 | virtual Vec3d getJ2000EquatorialPos(const StelCore*) const {return XYZ;} | 54 | virtual Vec3d getJ2000EquatorialPos(const StelCore*) const {return XYZ;} |
827 | 55 | virtual double getCloseViewFov(const StelCore* core = NULL) const; | 55 | virtual double getCloseViewFov(const StelCore* core = NULL) const; |
829 | 56 | virtual float getVMagnitude(const StelCore* core = NULL) const {Q_UNUSED(core); return mag;} | 56 | virtual float getVMagnitude(const StelCore* core, bool withExtinction=false) const; |
830 | 57 | virtual float getSelectPriority(const StelCore* core) const; | 57 | virtual float getSelectPriority(const StelCore* core) const; |
831 | 58 | virtual Vec3f getInfoColor() const; | 58 | virtual Vec3f getInfoColor() const; |
832 | 59 | virtual QString getNameI18n() const {return nameI18;} | 59 | virtual QString getNameI18n() const {return nameI18;} |
833 | 60 | 60 | ||
834 | === modified file 'src/core/modules/Planet.cpp' | |||
835 | --- src/core/modules/Planet.cpp 2011-11-25 13:51:35 +0000 | |||
836 | +++ src/core/modules/Planet.cpp 2011-12-29 12:15:27 +0000 | |||
837 | @@ -118,10 +118,15 @@ | |||
838 | 118 | } | 118 | } |
839 | 119 | 119 | ||
840 | 120 | if (flags&Magnitude) | 120 | if (flags&Magnitude) |
843 | 121 | oss << q_("Magnitude: <b>%1</b>").arg(getVMagnitude(core), 0, 'f', 2) << "<br>"; | 121 | { |
844 | 122 | 122 | if (core->getSkyDrawer()->getFlagHasAtmosphere()) | |
845 | 123 | oss << q_("Magnitude: <b>%1</b> (extincted to: <b>%2</b>)").arg(QString::number(getVMagnitude(core, false), 'f', 2), | ||
846 | 124 | QString::number(getVMagnitude(core, true), 'f', 2)) << "<br>"; | ||
847 | 125 | else | ||
848 | 126 | oss << q_("Magnitude: <b>%1</b>").arg(getVMagnitude(core, false), 0, 'f', 2) << "<br>"; | ||
849 | 127 | } | ||
850 | 123 | if (flags&AbsoluteMagnitude) | 128 | if (flags&AbsoluteMagnitude) |
852 | 124 | oss << q_("Absolute Magnitude: %1").arg(getVMagnitude(core)-5.*(std::log10(getJ2000EquatorialPos(core).length()*AU/PARSEC)-1.), 0, 'f', 2) << "<br>"; | 129 | oss << q_("Absolute Magnitude: %1").arg(getVMagnitude(core, false)-5.*(std::log10(getJ2000EquatorialPos(core).length()*AU/PARSEC)-1.), 0, 'f', 2) << "<br>"; |
853 | 125 | 130 | ||
854 | 126 | oss << getPositionInfoString(core, flags); | 131 | oss << getPositionInfoString(core, flags); |
855 | 127 | 132 | ||
856 | @@ -185,11 +190,11 @@ | |||
857 | 185 | if( ((SolarSystem*)StelApp::getInstance().getModuleMgr().getModule("SolarSystem"))->getFlagHints() ) | 190 | if( ((SolarSystem*)StelApp::getInstance().getModuleMgr().getModule("SolarSystem"))->getFlagHints() ) |
858 | 186 | { | 191 | { |
859 | 187 | // easy to select, especially pluto | 192 | // easy to select, especially pluto |
861 | 188 | return getVMagnitude(core)-15.f; | 193 | return getVMagnitude(core, false)-15.f; |
862 | 189 | } | 194 | } |
863 | 190 | else | 195 | else |
864 | 191 | { | 196 | { |
866 | 192 | return getVMagnitude(core) - 8.f; | 197 | return getVMagnitude(core, false) - 8.f; |
867 | 193 | } | 198 | } |
868 | 194 | } | 199 | } |
869 | 195 | 200 | ||
870 | @@ -478,13 +483,22 @@ | |||
871 | 478 | } | 483 | } |
872 | 479 | 484 | ||
873 | 480 | // Computation of the visual magnitude (V band) of the planet. | 485 | // Computation of the visual magnitude (V band) of the planet. |
875 | 481 | float Planet::getVMagnitude(const StelCore* core) const | 486 | float Planet::getVMagnitude(const StelCore* core, bool withExtinction) const |
876 | 482 | { | 487 | { |
877 | 488 | float extinctionMag=0.0; // track magnitude loss | ||
878 | 489 | if (withExtinction && core->getSkyDrawer()->getFlagHasAtmosphere()) | ||
879 | 490 | { | ||
880 | 491 | Vec3d altAz=getAltAzPosApparent(core); | ||
881 | 492 | altAz.normalize(); | ||
882 | 493 | core->getSkyDrawer()->getExtinction().forward(&altAz[2], &extinctionMag); | ||
883 | 494 | } | ||
884 | 495 | |||
885 | 496 | |||
886 | 483 | if (parent == 0) | 497 | if (parent == 0) |
887 | 484 | { | 498 | { |
888 | 485 | // sun, compute the apparent magnitude for the absolute mag (4.83) and observer's distance | 499 | // sun, compute the apparent magnitude for the absolute mag (4.83) and observer's distance |
889 | 486 | const double distParsec = std::sqrt(core->getObserverHeliocentricEclipticPos().lengthSquared())*AU/PARSEC; | 500 | const double distParsec = std::sqrt(core->getObserverHeliocentricEclipticPos().lengthSquared())*AU/PARSEC; |
891 | 487 | return 4.83 + 5.*(std::log10(distParsec)-1.); | 501 | return 4.83 + 5.*(std::log10(distParsec)-1.) + extinctionMag; |
892 | 488 | } | 502 | } |
893 | 489 | 503 | ||
894 | 490 | // Compute the angular phase | 504 | // Compute the angular phase |
895 | @@ -529,45 +543,118 @@ | |||
896 | 529 | } | 543 | } |
897 | 530 | 544 | ||
898 | 531 | // Use empirical formulae for main planets when seen from earth | 545 | // Use empirical formulae for main planets when seen from earth |
899 | 532 | // Algorithm provided by Pere Planesas (Observatorio Astronomico Nacional) | ||
900 | 533 | if (core->getCurrentLocation().planetName=="Earth") | 546 | if (core->getCurrentLocation().planetName=="Earth") |
901 | 534 | { | 547 | { |
903 | 535 | phase*=180./M_PI; | 548 | const double phaseDeg=phase*180./M_PI; |
904 | 536 | const double d = 5. * log10(sqrt(observerPlanetRq*planetRq)); | 549 | const double d = 5. * log10(sqrt(observerPlanetRq*planetRq)); |
906 | 537 | double f1 = phase/100.; | 550 | //double f1 = phaseDeg/100.; |
907 | 538 | 551 | ||
908 | 552 | /* | ||
909 | 553 | // Algorithm provided by Pere Planesas (Observatorio Astronomico Nacional) | ||
910 | 539 | if (englishName=="Mercury") | 554 | if (englishName=="Mercury") |
911 | 540 | { | 555 | { |
914 | 541 | if ( phase > 150. ) f1 = 1.5; | 556 | if ( phaseDeg > 150. ) f1 = 1.5; |
915 | 542 | return -0.36 + d + 3.8*f1 - 2.73*f1*f1 + 2*f1*f1*f1; | 557 | return -0.36 + d + 3.8*f1 - 2.73*f1*f1 + 2*f1*f1*f1 + extinctionMag; |
916 | 543 | } | 558 | } |
917 | 544 | if (englishName=="Venus") | 559 | if (englishName=="Venus") |
919 | 545 | return -4.29 + d + 0.09*f1 + 2.39*f1*f1 - 0.65*f1*f1*f1; | 560 | return -4.29 + d + 0.09*f1 + 2.39*f1*f1 - 0.65*f1*f1*f1 + extinctionMag; |
920 | 546 | if (englishName=="Mars") | 561 | if (englishName=="Mars") |
922 | 547 | return -1.52 + d + 0.016*phase; | 562 | return -1.52 + d + 0.016*phaseDeg + extinctionMag; |
923 | 548 | if (englishName=="Jupiter") | 563 | if (englishName=="Jupiter") |
925 | 549 | return -9.25 + d + 0.005*phase; | 564 | return -9.25 + d + 0.005*phaseDeg + extinctionMag; |
926 | 550 | if (englishName=="Saturn") | 565 | if (englishName=="Saturn") |
927 | 551 | { | 566 | { |
928 | 552 | // TODO re-add rings computation | 567 | // TODO re-add rings computation |
929 | 553 | // double rings = -2.6*sinx + 1.25*sinx*sinx; | 568 | // double rings = -2.6*sinx + 1.25*sinx*sinx; |
941 | 554 | return -8.88 + d + 0.044*phase;// + rings; | 569 | return -8.88 + d + 0.044*phaseDeg + extinctionMag;// + rings; |
942 | 555 | } | 570 | } |
943 | 556 | 571 | if (englishName=="Uranus") | |
944 | 557 | if (englishName=="Uranus") | 572 | return -7.19 + d + 0.0028*phaseDeg + extinctionMag; |
945 | 558 | return -7.19 + d + 0.0028*phase; | 573 | if (englishName=="Neptune") |
946 | 559 | if (englishName=="Neptune") | 574 | return -6.87 + d + extinctionMag; |
947 | 560 | return -6.87 + d; | 575 | if (englishName=="Pluto") |
948 | 561 | if (englishName=="Pluto") | 576 | return -1.01 + d + 0.041*phaseDeg + extinctionMag; |
949 | 562 | return -1.01 + d + 0.041*phase; | 577 | */ |
950 | 563 | 578 | // GZ: I prefer the values given by Meeus, Astronomical Algorithms (1992). | |
951 | 564 | phase/=180./M_PI; | 579 | // There are two solutions: |
952 | 580 | // (1) G. Müller, based on visual observations 1877-91. [Expl.Suppl.1961] | ||
953 | 581 | // (2) Astronomical Almanac 1984 and later. These give V (instrumental) magnitudes. | ||
954 | 582 | // The structure is almost identical, just the numbers are different! | ||
955 | 583 | // I activate (1) for now, because we want to simulate the eye's impression. (Esp. Venus!) | ||
956 | 584 | // (1) | ||
957 | 585 | if (englishName=="Mercury") | ||
958 | 586 | { | ||
959 | 587 | double ph50=phaseDeg-50.0; | ||
960 | 588 | return 1.16 + d + 0.02838*ph50 + 0.0001023*ph50*ph50 + extinctionMag; | ||
961 | 589 | } | ||
962 | 590 | if (englishName=="Venus") | ||
963 | 591 | return -4.0 + d + 0.01322*phaseDeg + 0.0000004247*phaseDeg*phaseDeg*phaseDeg + extinctionMag; | ||
964 | 592 | if (englishName=="Mars") | ||
965 | 593 | return -1.3 + d + 0.01486*phaseDeg + extinctionMag; | ||
966 | 594 | if (englishName=="Jupiter") | ||
967 | 595 | return -8.93 + d + extinctionMag; | ||
968 | 596 | if (englishName=="Saturn") | ||
969 | 597 | { | ||
970 | 598 | // TODO re-add rings computation | ||
971 | 599 | // GZ: implemented from Meeus, Astr.Alg.1992 | ||
972 | 600 | const double jd=core->getJDay(); | ||
973 | 601 | const double T=(jd-2451545.0)/36525.0; | ||
974 | 602 | const double i=((0.000004*T-0.012998)*T+28.075216)*M_PI/180.0; | ||
975 | 603 | const double Omega=((0.000412*T+1.394681)*T+169.508470)*M_PI/180.0; | ||
976 | 604 | static SolarSystem *ssystem=GETSTELMODULE(SolarSystem); | ||
977 | 605 | const Vec3d saturnEarth=getHeliocentricEclipticPos() - ssystem->getEarth()->getHeliocentricEclipticPos(); | ||
978 | 606 | double lambda=atan2(saturnEarth[1], saturnEarth[0]); | ||
979 | 607 | double beta=atan2(saturnEarth[2], sqrt(saturnEarth[0]*saturnEarth[0]+saturnEarth[1]*saturnEarth[1])); | ||
980 | 608 | const double sinB=sin(i)*cos(beta)*sin(lambda-Omega)-cos(i)*sin(beta); | ||
981 | 609 | double rings = -2.6*fabs(sinB) + 1.25*sinB*sinB; // sinx=sinB, saturnicentric latitude of earth. longish, see Meeus. | ||
982 | 610 | return -8.68 + d + 0.044*phaseDeg + rings + extinctionMag; | ||
983 | 611 | } | ||
984 | 612 | if (englishName=="Uranus") | ||
985 | 613 | return -6.85 + d + extinctionMag; | ||
986 | 614 | if (englishName=="Neptune") | ||
987 | 615 | return -7.05 + d + extinctionMag; | ||
988 | 616 | if (englishName=="Pluto") | ||
989 | 617 | return -1.0 + d + extinctionMag; | ||
990 | 618 | /* | ||
991 | 619 | // (2) | ||
992 | 620 | if (englishName=="Mercury") | ||
993 | 621 | return 0.42 + d + .038*phaseDeg - 0.000273*phaseDeg*phaseDeg + 0.000002*phaseDeg*phaseDeg*phaseDeg + extinctionMag; | ||
994 | 622 | if (englishName=="Venus") | ||
995 | 623 | return -4.40 + d + 0.0009*phaseDeg + 0.000239*phaseDeg*phaseDeg - 0.00000065*phaseDeg*phaseDeg*phaseDeg + extinctionMag; | ||
996 | 624 | if (englishName=="Mars") | ||
997 | 625 | return -1.52 + d + 0.016*phaseDeg + extinctionMag; | ||
998 | 626 | if (englishName=="Jupiter") | ||
999 | 627 | return -9.40 + d + 0.005*phaseDeg + extinctionMag; | ||
1000 | 628 | if (englishName=="Saturn") | ||
1001 | 629 | { | ||
1002 | 630 | // TODO re-add rings computation | ||
1003 | 631 | // GZ: implemented from Meeus, Astr.Alg.1992 | ||
1004 | 632 | const double jd=core->getJDay(); | ||
1005 | 633 | const double T=(jd-2451545.0)/36525.0; | ||
1006 | 634 | const double i=((0.000004*T-0.012998)*T+28.075216)*M_PI/180.0; | ||
1007 | 635 | const double Omega=((0.000412*T+1.394681)*T+169.508470)*M_PI/180.0; | ||
1008 | 636 | static SolarSystem *ssystem=GETSTELMODULE(SolarSystem); | ||
1009 | 637 | const Vec3d saturnEarth=getHeliocentricEclipticPos() - ssystem->getEarth()->getHeliocentricEclipticPos(); | ||
1010 | 638 | double lambda=atan2(saturnEarth[1], saturnEarth[0]); | ||
1011 | 639 | double beta=atan2(saturnEarth[2], sqrt(saturnEarth[0]*saturnEarth[0]+saturnEarth[1]*saturnEarth[1])); | ||
1012 | 640 | const double sinB=sin(i)*cos(beta)*sin(lambda-Omega)-cos(i)*sin(beta); | ||
1013 | 641 | double rings = -2.6*fabs(sinB) + 1.25*sinB*sinB; // sinx=sinB, saturnicentric latitude of earth. longish, see Meeus. | ||
1014 | 642 | return -8.88 + d + 0.044*phaseDeg + rings + extinctionMag; | ||
1015 | 643 | } | ||
1016 | 644 | if (englishName=="Uranus") | ||
1017 | 645 | return -7.19f + d + extinctionMag; | ||
1018 | 646 | if (englishName=="Neptune") | ||
1019 | 647 | return -6.87f + d + extinctionMag; | ||
1020 | 648 | if (englishName=="Pluto") | ||
1021 | 649 | return -1.00f + d + extinctionMag; | ||
1022 | 650 | */ | ||
1023 | 651 | // TODO: decide which set of formulae is best? | ||
1024 | 565 | } | 652 | } |
1025 | 566 | 653 | ||
1026 | 567 | // This formula seems to give wrong results | 654 | // This formula seems to give wrong results |
1027 | 568 | const double p = (1.0 - phase/M_PI) * cos_chi + std::sqrt(1.0 - cos_chi*cos_chi) / M_PI; | 655 | const double p = (1.0 - phase/M_PI) * cos_chi + std::sqrt(1.0 - cos_chi*cos_chi) / M_PI; |
1028 | 569 | double F = 2.0 * albedo * radius * radius * p / (3.0*observerPlanetRq*planetRq) * shadowFactor; | 656 | double F = 2.0 * albedo * radius * radius * p / (3.0*observerPlanetRq*planetRq) * shadowFactor; |
1030 | 570 | return -26.73 - 2.5 * std::log10(F); | 657 | return -26.73 - 2.5 * std::log10(F) + extinctionMag; |
1031 | 571 | } | 658 | } |
1032 | 572 | 659 | ||
1033 | 573 | double Planet::getAngularSize(const StelCore* core) const | 660 | double Planet::getAngularSize(const StelCore* core) const |
1034 | @@ -742,7 +829,7 @@ | |||
1035 | 742 | 829 | ||
1036 | 743 | StelPainter sPainter(core->getProjection(StelCore::FrameJ2000)); | 830 | StelPainter sPainter(core->getProjection(StelCore::FrameJ2000)); |
1037 | 744 | Vec3d tmp = getJ2000EquatorialPos(core); | 831 | Vec3d tmp = getJ2000EquatorialPos(core); |
1039 | 745 | core->getSkyDrawer()->postDrawSky3dModel(&sPainter, Vec3f(tmp[0], tmp[1], tmp[2]), surfArcMin2, getVMagnitude(core), color); | 832 | core->getSkyDrawer()->postDrawSky3dModel(&sPainter, Vec3f(tmp[0], tmp[1], tmp[2]), surfArcMin2, getVMagnitude(core, true), color); |
1040 | 746 | } | 833 | } |
1041 | 747 | 834 | ||
1042 | 748 | 835 | ||
1043 | 749 | 836 | ||
1044 | === modified file 'src/core/modules/Planet.hpp' | |||
1045 | --- src/core/modules/Planet.hpp 2011-05-31 15:56:59 +0000 | |||
1046 | +++ src/core/modules/Planet.hpp 2011-12-29 12:15:27 +0000 | |||
1047 | @@ -119,7 +119,7 @@ | |||
1048 | 119 | virtual double getCloseViewFov(const StelCore* core) const; | 119 | virtual double getCloseViewFov(const StelCore* core) const; |
1049 | 120 | virtual double getSatellitesFov(const StelCore* core) const; | 120 | virtual double getSatellitesFov(const StelCore* core) const; |
1050 | 121 | virtual double getParentSatellitesFov(const StelCore* core) const; | 121 | virtual double getParentSatellitesFov(const StelCore* core) const; |
1052 | 122 | virtual float getVMagnitude(const StelCore* core) const; | 122 | virtual float getVMagnitude(const StelCore* core, bool withExtinction=false) const; |
1053 | 123 | virtual float getSelectPriority(const StelCore* core) const; | 123 | virtual float getSelectPriority(const StelCore* core) const; |
1054 | 124 | virtual Vec3f getInfoColor(void) const; | 124 | virtual Vec3f getInfoColor(void) const; |
1055 | 125 | virtual QString getType(void) const {return "Planet";} | 125 | virtual QString getType(void) const {return "Planet";} |
1056 | 126 | 126 | ||
1057 | === modified file 'src/core/modules/StarMgr.cpp' | |||
1058 | --- src/core/modules/StarMgr.cpp 2011-10-28 07:57:30 +0000 | |||
1059 | +++ src/core/modules/StarMgr.cpp 2011-12-29 12:15:27 +0000 | |||
1060 | @@ -644,13 +644,18 @@ | |||
1061 | 644 | skyDrawer->preDrawPointSource(&sPainter); | 644 | skyDrawer->preDrawPointSource(&sPainter); |
1062 | 645 | 645 | ||
1063 | 646 | // draw all the stars of all the selected zones | 646 | // draw all the stars of all the selected zones |
1065 | 647 | float rcmag_table[2*256]; | 647 | // GZ: This table must be enlarged from 2x256 to many more entries. CORRELATE IN Zonearray.cpp! |
1066 | 648 | //float rcmag_table[2*256]; | ||
1067 | 649 | //float rcmag_table[2*16384]; | ||
1068 | 650 | float rcmag_table[2*4096]; | ||
1069 | 648 | 651 | ||
1070 | 649 | for (ZoneArrayMap::const_iterator it(zoneArrays.constBegin()); it!=zoneArrays.constEnd();++it) | 652 | for (ZoneArrayMap::const_iterator it(zoneArrays.constBegin()); it!=zoneArrays.constEnd();++it) |
1071 | 650 | { | 653 | { |
1072 | 651 | const float mag_min = 0.001f*it.value()->mag_min; | 654 | const float mag_min = 0.001f*it.value()->mag_min; |
1075 | 652 | const float k = (0.001f*it.value()->mag_range)/it.value()->mag_steps; | 655 | const float k = (0.001f*it.value()->mag_range)/it.value()->mag_steps; // MagStepIncrement |
1076 | 653 | for (int i=it.value()->mag_steps-1;i>=0;--i) | 656 | // GZ: add a huge number of entries to rcMag |
1077 | 657 | //for (int i=it.value()->mag_steps-1;i>=0;--i) | ||
1078 | 658 | for (int i=4096-1;i>=0;--i) | ||
1079 | 654 | { | 659 | { |
1080 | 655 | const float mag = mag_min+k*i; | 660 | const float mag = mag_min+k*i; |
1081 | 656 | if (skyDrawer->computeRCMag(mag,rcmag_table + 2*i)==false) | 661 | if (skyDrawer->computeRCMag(mag,rcmag_table + 2*i)==false) |
1082 | 657 | 662 | ||
1083 | === modified file 'src/core/modules/StarMgr.hpp' | |||
1084 | --- src/core/modules/StarMgr.hpp 2011-05-31 13:06:03 +0000 | |||
1085 | +++ src/core/modules/StarMgr.hpp 2011-12-29 12:15:27 +0000 | |||
1086 | @@ -82,7 +82,7 @@ | |||
1087 | 82 | virtual void init(); | 82 | virtual void init(); |
1088 | 83 | 83 | ||
1089 | 84 | //! Draw the stars and the star selection indicator if necessary. | 84 | //! Draw the stars and the star selection indicator if necessary. |
1091 | 85 | virtual void draw(StelCore* core); //! Draw all the stars | 85 | virtual void draw(StelCore* core); |
1092 | 86 | 86 | ||
1093 | 87 | //! Update any time-dependent features. | 87 | //! Update any time-dependent features. |
1094 | 88 | //! Includes fading in and out stars and labels when they are turned on and off. | 88 | //! Includes fading in and out stars and labels when they are turned on and off. |
1095 | 89 | 89 | ||
1096 | === modified file 'src/core/modules/StarWrapper.cpp' | |||
1097 | --- src/core/modules/StarWrapper.cpp 2011-05-31 13:06:03 +0000 | |||
1098 | +++ src/core/modules/StarWrapper.cpp 2011-12-29 12:15:27 +0000 | |||
1099 | @@ -48,9 +48,14 @@ | |||
1100 | 48 | QTextStream oss(&str); | 48 | QTextStream oss(&str); |
1101 | 49 | 49 | ||
1102 | 50 | if (flags&Magnitude) | 50 | if (flags&Magnitude) |
1106 | 51 | oss << q_("Magnitude: <b>%1</b> (B-V: %2)").arg(QString::number(getVMagnitude(core), 'f', 2), QString::number(getBV(), 'f', 2)) << "<br>"; | 51 | { |
1107 | 52 | 52 | oss << q_("Magnitude: <b>%1</b> (B-V: %2)").arg(QString::number(getVMagnitude(core, false), 'f', 2), QString::number(getBV(), 'f', 2)) << "<br>"; | |
1108 | 53 | oss << getPositionInfoString(core, flags); | 53 | if (core->getSkyDrawer()->getFlagHasAtmosphere()) |
1109 | 54 | { | ||
1110 | 55 | oss << q_("Apparent Magnitude: <b>%1</b> (by extinction)").arg(QString::number(getVMagnitude(core, true), 'f', 2)) << "<br>"; | ||
1111 | 56 | } | ||
1112 | 57 | } | ||
1113 | 58 | oss << getPositionInfoString(core, flags); | ||
1114 | 54 | 59 | ||
1115 | 55 | StelObject::postProcessInfoString(str, flags); | 60 | StelObject::postProcessInfoString(str, flags); |
1116 | 56 | 61 | ||
1117 | @@ -105,11 +110,18 @@ | |||
1118 | 105 | } | 110 | } |
1119 | 106 | 111 | ||
1120 | 107 | if (flags&Magnitude) | 112 | if (flags&Magnitude) |
1123 | 108 | oss << q_("Magnitude: <b>%1</b> (B-V: %2)").arg(QString::number(getVMagnitude(core), 'f', 2), | 113 | { |
1124 | 109 | QString::number(s->getBV(), 'f', 2)) << "<br>"; | 114 | if (core->getSkyDrawer()->getFlagHasAtmosphere()) |
1125 | 115 | oss << q_("Magnitude: <b>%1</b> (extincted to: <b>%2</b>. B-V: <b>%3</b>)").arg(QString::number(getVMagnitude(core, false), 'f', 2), | ||
1126 | 116 | QString::number(getVMagnitude(core, true), 'f', 2), | ||
1127 | 117 | QString::number(s->getBV(), 'f', 2)) << "<br>"; | ||
1128 | 118 | else | ||
1129 | 119 | oss << q_("Magnitude: <b>%1</b> (B-V: <b>%2</b>)").arg(QString::number(getVMagnitude(core, false), 'f', 2), | ||
1130 | 120 | QString::number(s->getBV(), 'f', 2)) << "<br>"; | ||
1131 | 121 | } | ||
1132 | 110 | 122 | ||
1133 | 111 | if ((flags&AbsoluteMagnitude) && s->plx && !isNan(s->plx) && !isInf(s->plx)) | 123 | if ((flags&AbsoluteMagnitude) && s->plx && !isNan(s->plx) && !isInf(s->plx)) |
1135 | 112 | oss << q_("Absolute Magnitude: %1").arg(getVMagnitude(core)+5.*(1.+std::log10(0.00001*s->plx)), 0, 'f', 2) << "<br>"; | 124 | oss << q_("Absolute Magnitude: %1").arg(getVMagnitude(core, false)+5.*(1.+std::log10(0.00001*s->plx)), 0, 'f', 2) << "<br>"; |
1136 | 113 | 125 | ||
1137 | 114 | oss << getPositionInfoString(core, flags); | 126 | oss << getPositionInfoString(core, flags); |
1138 | 115 | 127 | ||
1139 | 116 | 128 | ||
1140 | === modified file 'src/core/modules/StarWrapper.hpp' | |||
1141 | --- src/core/modules/StarWrapper.hpp 2011-05-31 13:06:03 +0000 | |||
1142 | +++ src/core/modules/StarWrapper.hpp 2011-12-29 12:15:27 +0000 | |||
1143 | @@ -85,11 +85,18 @@ | |||
1144 | 85 | { | 85 | { |
1145 | 86 | return StelApp::getInstance().getVisionModeNight() ? Vec3f(0.8, 0.2, 0.2) : StelSkyDrawer::indexToColor(s->bV); | 86 | return StelApp::getInstance().getVisionModeNight() ? Vec3f(0.8, 0.2, 0.2) : StelSkyDrawer::indexToColor(s->bV); |
1146 | 87 | } | 87 | } |
1148 | 88 | float getVMagnitude(const StelCore*) const | 88 | float getVMagnitude(const StelCore* core, bool withExtinction=false) const |
1149 | 89 | { | 89 | { |
1151 | 90 | return 0.001f*a->mag_min + s->mag*(0.001f*a->mag_range)/a->mag_steps; | 90 | float extinctionMag=0.0; // track magnitude loss |
1152 | 91 | if (withExtinction && core->getSkyDrawer()->getFlagHasAtmosphere()) | ||
1153 | 92 | { | ||
1154 | 93 | double alt=getAltAzPosApparent(core)[2]; | ||
1155 | 94 | core->getSkyDrawer()->getExtinction().forward(&alt, &extinctionMag); | ||
1156 | 95 | } | ||
1157 | 96 | |||
1158 | 97 | return 0.001f*a->mag_min + s->mag*(0.001f*a->mag_range)/a->mag_steps + extinctionMag; | ||
1159 | 91 | } | 98 | } |
1161 | 92 | float getSelectPriority(const StelCore* core) const {return getVMagnitude(core);} | 99 | float getSelectPriority(const StelCore* core) const {return getVMagnitude(core, false);} |
1162 | 93 | float getBV(void) const {return s->getBV();} | 100 | float getBV(void) const {return s->getBV();} |
1163 | 94 | QString getEnglishName(void) const {return QString();} | 101 | QString getEnglishName(void) const {return QString();} |
1164 | 95 | QString getNameI18n(void) const {return s->getNameI18n();} | 102 | QString getNameI18n(void) const {return s->getNameI18n();} |
1165 | 96 | 103 | ||
1166 | === modified file 'src/core/modules/ZoneArray.cpp' | |||
1167 | --- src/core/modules/ZoneArray.cpp 2011-06-23 11:26:56 +0000 | |||
1168 | +++ src/core/modules/ZoneArray.cpp 2011-12-29 12:15:27 +0000 | |||
1169 | @@ -476,27 +476,44 @@ | |||
1170 | 476 | void SpecialZoneArray<Star>::draw(StelPainter* sPainter, int index, bool is_inside, const float *rcmag_table, StelCore* core, unsigned int maxMagStarName, | 476 | void SpecialZoneArray<Star>::draw(StelPainter* sPainter, int index, bool is_inside, const float *rcmag_table, StelCore* core, unsigned int maxMagStarName, |
1171 | 477 | float names_brightness) const | 477 | float names_brightness) const |
1172 | 478 | { | 478 | { |
1194 | 479 | StelSkyDrawer* drawer = core->getSkyDrawer(); | 479 | StelSkyDrawer* drawer = core->getSkyDrawer(); |
1195 | 480 | SpecialZoneData<Star> *const z = getZones() + index; | 480 | SpecialZoneData<Star> *const z = getZones() + index; |
1196 | 481 | Vec3f vf; | 481 | Vec3f vf; |
1197 | 482 | const Star *const end = z->getStars() + z->size; | 482 | const Star *const end = z->getStars() + z->size; |
1198 | 483 | static const double d2000 = 2451545.0; | 483 | static const double d2000 = 2451545.0; |
1199 | 484 | const double movementFactor = (M_PI/180)*(0.0001/3600) * ((core->getJDay()-d2000)/365.25) / star_position_scale; | 484 | const double movementFactor = (M_PI/180)*(0.0001/3600) * ((core->getJDay()-d2000)/365.25) / star_position_scale; |
1200 | 485 | const float* tmpRcmag; | 485 | const float* tmpRcmag; // will point to precomputed rC in table |
1201 | 486 | for (const Star *s=z->getStars();s<end;++s) | 486 | // GZ, added for extinction |
1202 | 487 | { | 487 | Extinction extinction=core->getSkyDrawer()->getExtinction(); |
1203 | 488 | tmpRcmag = rcmag_table+2*s->mag; | 488 | const bool withExtinction=(drawer->getFlagHasAtmosphere() && extinction.getExtinctionCoefficient()>=0.01f); |
1204 | 489 | if (*tmpRcmag<=0.f) | 489 | const float k = (0.001f*mag_range)/mag_steps; // from StarMgr.cpp line 654 |
1205 | 490 | break; | 490 | |
1206 | 491 | s->getJ2000Pos(z,movementFactor, vf); | 491 | // go through all stars, which are sorted by magnitude (bright stars first) |
1207 | 492 | if (drawer->drawPointSource(sPainter, vf, tmpRcmag, s->bV, !is_inside) && s->hasName() && s->mag < maxMagStarName && s->hasComponentID()<=1) | 492 | for (const Star *s=z->getStars();s<end;++s) |
1208 | 493 | { | 493 | { |
1209 | 494 | const float offset = *tmpRcmag*0.7f; | 494 | tmpRcmag = rcmag_table+2*s->mag; |
1210 | 495 | const Vec3f& colorr = (StelApp::getInstance().getVisionModeNight() ? Vec3f(0.8f, 0.2f, 0.2f) : StelSkyDrawer::indexToColor(s->bV))*0.75f; | 495 | if (*tmpRcmag<=0.f) break; // no size for this and following (even dimmer, unextincted) stars? --> early exit |
1211 | 496 | sPainter->setColor(colorr[0], colorr[1], colorr[2],names_brightness); | 496 | s->getJ2000Pos(z,movementFactor, vf); |
1212 | 497 | sPainter->drawText(Vec3d(vf[0], vf[1], vf[2]), s->getNameI18n(), 0, offset, offset, false); | 497 | |
1213 | 498 | } | 498 | // GZ new: |
1214 | 499 | } | 499 | if (withExtinction) |
1215 | 500 | { | ||
1216 | 501 | //GZ: We must compute position first, then shift magnitude. | ||
1217 | 502 | Vec3d altAz=core->j2000ToAltAz(Vec3d(vf[0], vf[1], vf[2]), StelCore::RefractionOn); | ||
1218 | 503 | float extMagShift=0.0f; | ||
1219 | 504 | extinction.forward(&altAz, &extMagShift); | ||
1220 | 505 | int extMagShiftStep=qMin((int)floor(extMagShift/k), 4096-mag_steps); // this number muist be equal StarMgr.cpp line 649 | ||
1221 | 506 | tmpRcmag = rcmag_table+2*(s->mag+extMagShiftStep); | ||
1222 | 507 | } | ||
1223 | 508 | |||
1224 | 509 | if (drawer->drawPointSource(sPainter, vf, tmpRcmag, s->bV, !is_inside) && s->hasName() && s->mag < maxMagStarName && s->hasComponentID()<=1) | ||
1225 | 510 | { | ||
1226 | 511 | const float offset = *tmpRcmag*0.7f; | ||
1227 | 512 | const Vec3f& colorr = (StelApp::getInstance().getVisionModeNight() ? Vec3f(0.8f, 0.2f, 0.2f) : StelSkyDrawer::indexToColor(s->bV))*0.75f; | ||
1228 | 513 | sPainter->setColor(colorr[0], colorr[1], colorr[2],names_brightness); | ||
1229 | 514 | sPainter->drawText(Vec3d(vf[0], vf[1], vf[2]), s->getNameI18n(), 0, offset, offset, false); | ||
1230 | 515 | } | ||
1231 | 516 | } | ||
1232 | 500 | } | 517 | } |
1233 | 501 | 518 | ||
1234 | 502 | template<class Star> | 519 | template<class Star> |
You need add [astro] /subhorizontal_ extinction to default_config.ini and set some default setting value. Also we added new plugin with stellar objects - Quasars - I think you can copy code for this plugin from Supernovae plugin.