Stellarium 0.11.4
Home · All Namespaces · All Classes · Functions · Coding Style · Scripting · Plugins · File Structure

core/RefractionExtinction.hpp

00001 /*
00002  * Stellarium
00003  * Copyright (C) 2010 Fabien Chereau
00004  *
00005  * This program is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * as published by the Free Software Foundation; either version 2
00008  * of the License, or (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA  02110-1335, USA.
00018  *
00019  * Refraction and extinction computations.
00020  * Implementation: 2010-03-23 GZ=Georg Zotti, Georg.Zotti@univie.ac.at
00021  * 2010-12 FC split into 2 classes, implemented Refraction */
00022 
00023 #ifndef _REFRACTIONEXTINCTION_HPP_
00024 #define _REFRACTIONEXTINCTION_HPP_
00025 // USABILITY: added 3 more flags/switches in GUI:
00026 // Temperature [C] [influences refraction]
00027 // Pressure [mbar]  [influences refraction]
00028 // extinction Coeff. k=0...(0.01)...1, [if k=0, no ext. effect]
00029 // SUGGESTION: Allow Temperature/Pressure/ex.Coeff./LightPollution set in the landscape files
00030 
00031 #include "VecMath.hpp"
00032 #include "StelProjector.hpp"
00033 
00045 class Extinction
00046 {
00047 public:
00048     Extinction();
00053     void forward(const Vec3d *altAzPos, float *mag, const int num=1) const;
00054     void forward(const Vec3f *altAzPos, float *mag, const int num=1) const;
00055     void forward(const double *sinAlt,  float *mag, const int num) const;
00056     void forward(const float  *sinAlt,  float *mag, const int num) const;
00057     void forward(const double *sinAlt,  float *mag) const;
00058     void forward(const float  *sinAlt,  float *mag) const;
00059 
00063     void backward(const Vec3d *altAzPos, float *mag, const int num=1) const;
00064     void backward(const Vec3f *altAzPos, float *mag, const int num=1) const;
00065     void backward(const double *sinAlt,  float *mag, const int num=1) const;
00066     void backward(const float  *sinAlt,  float *mag, const int num=1) const;
00067 
00070     void setExtinctionCoefficient(float k) { ext_coeff=k; }
00071     float getExtinctionCoefficient() const {return ext_coeff;}
00072 
00073 private:
00081     float airmass(const float cosZ, const bool apparent_z=true) const;
00082 
00084     float ext_coeff;
00087     static float SUBHORIZONTAL_AIRMASS;
00088 };
00089 
00099 
00100 class Refraction: public StelProjector::ModelViewTranform
00101 {
00102 public:
00103     Refraction();
00104 
00108     void forward(Vec3d& altAzPos) const;
00109 
00113     void backward(Vec3d& altAzPos) const;
00114 
00118     void forward(Vec3f& altAzPos) const;
00119 
00123     void backward(Vec3f& altAzPos) const;
00124 
00125     void combine(const Mat4d& m)
00126     {
00127         setPreTransfoMat(preTransfoMat*m);
00128     }
00129 
00130     Mat4d getApproximateLinearTransfo() const {return postTransfoMat*preTransfoMat;}
00131 
00132     StelProjector::ModelViewTranformP clone() const {Refraction* refr = new Refraction(); *refr=*this; return StelProjector::ModelViewTranformP(refr);}
00133 
00135     void setPressure(float p_mbar);
00136     float getPressure() const {return pressure;}
00137 
00139     void setTemperature(float t_C);
00140     float getTemperature() const {return temperature;}
00141 
00143     void setPreTransfoMat(const Mat4d& m);
00144     void setPostTransfoMat(const Mat4d& m);
00145 
00146 private:
00148     void updatePrecomputed();
00149 
00152     float pressure;
00154     float temperature;
00156     float press_temp_corr_Saemundson;
00158     float press_temp_corr_Bennett;
00159 
00161     static const double MIN_GEO_ALTITUDE_DEG;
00162     static const double MIN_GEO_ALTITUDE_RAD;
00163     static const double MIN_GEO_ALTITUDE_SIN;
00164     static const double MIN_APP_ALTITUDE_DEG;
00165     static const double MIN_APP_ALTITUDE_RAD;
00166     static const double MIN_APP_ALTITUDE_SIN;
00167     static const float MIN_GEO_ALTITUDE_DEG_F;
00168     static const float MIN_GEO_ALTITUDE_RAD_F;
00169     static const float MIN_GEO_ALTITUDE_SIN_F;
00170     static const float MIN_APP_ALTITUDE_DEG_F;
00171     static const float MIN_APP_ALTITUDE_RAD_F;
00172     static const float MIN_APP_ALTITUDE_SIN_F;
00173     static const double TRANSITION_WIDTH_GEO_DEG;
00174     static const double TRANSITION_WIDTH_GEO_DEG_F;
00175     static const double TRANSITION_WIDTH_APP_DEG;
00176     static const double TRANSITION_WIDTH_APP_DEG_F;
00177 
00179     Mat4d preTransfoMat;
00180     Mat4d invertPreTransfoMat;
00181     Mat4f preTransfoMatf;
00182     Mat4f invertPreTransfoMatf;
00183 
00185     Mat4d postTransfoMat;
00186     Mat4d invertPostTransfoMat;
00187     Mat4f postTransfoMatf;
00188     Mat4f invertPostTransfoMatf;
00189 };
00190 
00191 #endif  // _REFRACTIONEXTINCTION_HPP_
Generated on Sat Aug 25 22:13:29 2012 for Stellarium by  doxygen 1.6.3