RefractionExtinction.hpp | RefractionExtinction.hpp | |||
---|---|---|---|---|

skipping to change at line 17 | skipping to change at line 17 | |||

* as published by the Free Software Foundation; either version 2 | * as published by the Free Software Foundation; either version 2 | |||

* of the License, or (at your option) any later version. | * of the License, or (at your option) any later version. | |||

* | * | |||

* This program is distributed in the hope that it will be useful, | * This program is distributed in the hope that it will be useful, | |||

* but WITHOUT ANY WARRANTY; without even the implied warranty of | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||

* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||

* GNU General Public License for more details. | * GNU General Public License for more details. | |||

* | * | |||

* You should have received a copy of the GNU General Public License | * You should have received a copy of the GNU General Public License | |||

* along with this program; if not, write to the Free Software | * along with this program; if not, write to the Free Software | |||

* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, U SA. | * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. | |||

* | * | |||

* Refraction and extinction computations. | * Refraction and extinction computations. | |||

* Implementation: 2010-03-23 GZ=Georg Zotti, Georg.Zotti@univie.ac.at | * Implementation: 2010-03-23 GZ=Georg Zotti, Georg.Zotti@univie.ac.at | |||

* 2010-12 FC split into 2 classes, implemented Refraction */ | * 2010-12 FC split into 2 classes, implemented Refraction */ | |||

#ifndef _REFRACTIONEXTINCTION_HPP_ | #ifndef _REFRACTIONEXTINCTION_HPP_ | |||

#define _REFRACTIONEXTINCTION_HPP_ | #define _REFRACTIONEXTINCTION_HPP_ | |||

// USABILITY: added 3 more flags/switches in GUI: | // USABILITY: added 3 more flags/switches in GUI: | |||

// Temperature [C] [influences refraction] | // Temperature [C] [influences refraction] | |||

// Pressure [mbar] [influences refraction] | // Pressure [mbar] [influences refraction] | |||

// extinction Coeff. k=0...(0.01)...1, [if k=0, no ext. effect] | // extinction Coeff. k=0...(0.01)...1, [if k=0, no ext. effect] | |||

// SUGGESTION: Allow Temperature/Pressure/ex.Coeff./LightPollution set in t he landscape files | // SUGGESTION: Allow Temperature/Pressure/ex.Coeff./LightPollution set in t he landscape files | |||

#include "VecMath.hpp" | #include "VecMath.hpp" | |||

#include "StelProjector.hpp" | #include "StelProjector.hpp" | |||

//! @class RefractionExtinction | //! @class Extinction | |||

//! This class performs refraction and extinction computations, following l | //! This class performs extinction computations, following literature from | |||

iterature from atmospheric optics and astronomy. | atmospheric optics and astronomy. | |||

//! Airmass computations are limited to meaningful altitudes, | //! Airmass computations are limited to meaningful altitudes. | |||

//! and refraction solutions can only be aproximate, given the turbulent, u | ||||

npredictable real atmosphere. | ||||

//! The solution provided here will [hopefully!] result in a visible "zone of avoidance" near the horizon down to altitude -2, | //! The solution provided here will [hopefully!] result in a visible "zone of avoidance" near the horizon down to altitude -2, | |||

//! and will show stars in their full brightness at their geometrical posit | //! and may show stars in their full brightness below -2 degrees. | |||

ions below -5 degrees. | //! Typical horizons do not go down below -1, so all natural sites should b | |||

//! Of course, plotting stars below the horizon could be coupled to setting | e covered. | |||

of horizon foreground, | ||||

//! it's another usability issue. Typical horizons do not go down below -1, | ||||

so strange effects between -2 and -5 should be covered. | ||||

//! Note that forward/backward are no absolute reverse operations! | //! Note that forward/backward are no absolute reverse operations! | |||

//! All the computations should be in effect | //! All the computations should be in effect | |||

//! (1) only if atmosphere effects are true | //! (1) only if atmosphere effects are true | |||

//! (2) only for celestial objects, never for landscape coordinates | //! (2) only for terrestrial locations, not on Moon/Mars/Saturn etc | |||

//! (3) only for terrestrial locations, not on Moon/Mars/Saturn etc | //! config.ini:astro/flag_extinction_below_horizon=true|false controls if e | |||

xtinction kills objects below -2 degrees altitude by setting airmass to 42. | ||||

class Extinction | class Extinction | |||

{ | { | |||

public: | public: | |||

Extinction(); | Extinction(); | |||

//! Compute extinction effect for arrays of size @param num position vectors and magnitudes. | //! Compute extinction effect for arrays of size @param num position vectors and magnitudes. | |||

//! @param altAzPos are the normalized (apparent) star position vect ors, and their z components sin(apparent_altitude). | //! @param altAzPos are the NORMALIZED (!!) (apparent) star position vectors, and their z components sin(apparent_altitude). | |||

//! This call must therefore be done after application of Refraction , and only if atmospheric effects are on. | //! This call must therefore be done after application of Refraction , and only if atmospheric effects are on. | |||

//! Note that forward/backward are no absolute reverse operations! | //! Note that forward/backward are no absolute reverse operations! | |||

void forward(const Vec3d *altAzPos, float *mag, const int num) const | void forward(const Vec3d *altAzPos, float *mag, const int num=1) con | |||

; | st; | |||

void forward(const Vec3f *altAzPos, float *mag, const int num) const | void forward(const Vec3f *altAzPos, float *mag, const int num=1) con | |||

; | st; | |||

//! Convenience method for the same | ||||

void forward(const double *sinAlt, float *mag, const int num) const ; | void forward(const double *sinAlt, float *mag, const int num) const ; | |||

void forward(const float *sinAlt, float *mag, const int num) const ; | void forward(const float *sinAlt, float *mag, const int num) const ; | |||

void forward(const double *sinAlt, float *mag) const; | ||||

void forward(const float *sinAlt, float *mag) const; | ||||

//! Compute extinction effect for arrays of size @param size positio | //! Compute inverse extinction effect for arrays of size @param num | |||

n vectors and magnitudes. | position vectors and magnitudes. | |||

//! @param altAzPos are the normalized (apparent) star position vect | //! @param altAzPos are the NORMALIZED (!!) (apparent) star position | |||

ors, and their z components sin(apparent_altitude). | vectors, and their z components sin(apparent_altitude). | |||

//! Note that forward/backward are no absolute reverse operations! | //! Note that forward/backward are no absolute reverse operations! | |||

void backward(const Vec3d *altAzPos, float *mag, const int num) cons | void backward(const Vec3d *altAzPos, float *mag, const int num=1) co | |||

t; | nst; | |||

void backward(const Vec3f *altAzPos, float *mag, const int num) cons | void backward(const Vec3f *altAzPos, float *mag, const int num=1) co | |||

t; | nst; | |||

//! Convenience method for the same | void backward(const double *sinAlt, float *mag, const int num=1) co | |||

void backward(const double *sinAlt, float *mag, const int num) cons | nst; | |||

t; | void backward(const float *sinAlt, float *mag, const int num=1) co | |||

void backward(const float *sinAlt, float *mag, const int num) cons | nst; | |||

t; | ||||

//! Set visual extinction coefficient (mag/airmass), influences exti nction computation. | //! Set visual extinction coefficient (mag/airmass), influences exti nction computation. | |||

//! @param k= 0.1 for highest mountains, 0.2 for very good lowland l ocations, 0.35 for typical lowland, 0.5 in humid climates. | //! @param k= 0.1 for highest mountains, 0.2 for very good lowland l ocations, 0.35 for typical lowland, 0.5 in humid climates. | |||

void setExtinctionCoefficient(float k) { ext_coeff=k; } | void setExtinctionCoefficient(float k) { ext_coeff=k; } | |||

float getExtinctionCoefficient() const {return ext_coeff;} | float getExtinctionCoefficient() const {return ext_coeff;} | |||

private: | private: | |||

//! airmass computation for @param cosZ = cosine of zenith angle z ( =sin(altitude)!). | //! airmass computation for @param cosZ = cosine of zenith angle z ( =sin(altitude)!). | |||

//! The default (@param apparent_z = true) is computing airmass from observed altitude, following Rozenberg (1966) [X(90)~40]. | //! The default (@param apparent_z = true) is computing airmass from observed altitude, following Rozenberg (1966) [X(90)~40]. | |||

//! if (@param apparent_z = false), we have geometrical altitude and compute airmass from that, | //! if (@param apparent_z = false), we have geometrical altitude and compute airmass from that, | |||

//! following Young: Air mass and refraction. Applied Optics 33(6), pp.1108-1110, 1994. [X(90)~32]. | //! following Young: Air mass and refraction. Applied Optics 33(6), pp.1108-1110, 1994. [X(90)~32]. | |||

//! A problem ist that refraction depends on air pressure and temper ature, but Young's formula assumes T=15C, p=1013.25mbar. | //! A problem ist that refraction depends on air pressure and temper ature, but Young's formula assumes T=15C, p=1013.25mbar. | |||

//! So, it seems better to compute refraction first, and then use th e Rozenberg formula here. | //! So, it seems better to compute refraction first, and then use th e Rozenberg formula here. | |||

//! Rozenberg is infinite at Z=92.17 deg, Young at Z=93.6 deg, so th is function RETURNS SUBHORIZONTAL_AIRMASS BELOW -2 DEGREES! | //! Rozenberg is infinite at Z=92.17 deg, Young at Z=93.6 deg, so th is function RETURNS SUBHORIZONTAL_AIRMASS BELOW -2 DEGREES! | |||

float airmass(const float cosZ, const bool apparent_z=true) const; | float airmass(const float cosZ, const bool apparent_z=true) const; | |||

//! k, magnitudes/airmass, in [0.00, ... 1.00], (default 0.20). | //! k, magnitudes/airmass, in [0.00, ... 1.00], (default 0.20). | |||

float ext_coeff; | float ext_coeff; | |||

//! should be either 0.0 (stars visible in full brightness below hor izon) or 40.0 (practically invisible) | //! should be either 0.0 (stars visible in full brightness below hor izon) or 40.0 (or 42? ;-) practically invisible) | |||

//! Maybe make this a user-configurable option? | //! Maybe make this a user-configurable option? | |||

static const float SUBHORIZONTAL_AIRMASS; | static float SUBHORIZONTAL_AIRMASS; | |||

}; | }; | |||

//! @class Refraction | ||||

//! This class performs refraction computations, following literature from | ||||

atmospheric optics and astronomy. | ||||

//! Refraction solutions can only be aproximate, given the turbulent, unpre | ||||

dictable real atmosphere. | ||||

//! Typical horizons do not go down below -1, so strange effects (distortio | ||||

n) between -2 and -5 should be covered. | ||||

//! Note that forward/backward are no absolute reverse operations! | ||||

//! All the computations should be in effect | ||||

//! (1) only if atmosphere effects are true | ||||

//! (2) only for celestial objects, never for landscape images | ||||

//! (3) only for terrestrial locations, not on Moon/Mars/Saturn etc | ||||

class Refraction: public StelProjector::ModelViewTranform | class Refraction: public StelProjector::ModelViewTranform | |||

{ | { | |||

public: | public: | |||

Refraction(); | Refraction(); | |||

//! Apply refraction. | //! Apply refraction. | |||

//! @param altAzPos is the geometrical star position vector, to be t ransformed into apparent position. | //! @param altAzPos is the geometrical star position vector, to be t ransformed into apparent position. | |||

//! Note that forward/backward are no absolute reverse operations! | //! Note that forward/backward are no absolute reverse operations! | |||

void forward(Vec3d& altAzPos) const; | void forward(Vec3d& altAzPos) const; | |||

End of changes. 12 change blocks. | ||||

36 lines changed or deleted | | 45 lines changed or added | ||

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |