├── src ├── Astree.rc ├── Astree.ico ├── Astree_fr.qm ├── lupdate.bat ├── Astree.qrc ├── Util │ ├── FileUtil.h │ ├── Properties.h │ └── FileUtil.cpp ├── Vector3D.h ├── DeviceIoZmx.h ├── DeviceScaling.h ├── GlassCatalogIo.h ├── Referential.h ├── DeviceIo.h ├── MaterialAir.h ├── ImageQuality.h ├── MaterialWater.h ├── MaterialUnknow.h ├── MaterialVacuum.h ├── Photon.h ├── DeviceOptimizerRandom.h ├── LightAutofocus.h ├── DeviceOptimizerAmoeba.h ├── DockCommentary.h ├── DialogMediumManager.h ├── DockImageQuality.h ├── AstreeDefines.h ├── GlassSellmeier.h ├── DialogScaleDevice.h ├── tests │ ├── test_newton.pro │ ├── test_perfect_surface.pro │ ├── test_scaling.pro │ ├── test_newton.cpp │ ├── test_perfect_surface.cpp │ └── test_scaling.cpp ├── ImageQuality.cpp ├── GlassExtended2.h ├── GlassManager.h ├── FrameSideView.h ├── main.cpp ├── DockOptimizer.h ├── DockLightProperties.h ├── MaterialUnknow.cpp ├── Astree.sln ├── MaterialWater.cpp ├── MaterialVacuum.cpp ├── FrameSideView.ui ├── DockScatterPlot.h ├── Glass.h ├── MaterialAir.cpp ├── DockCommentary.cpp ├── Photon.cpp ├── MyViewFrame.h ├── DockSurfacesData.h ├── GlassSellmeier.cpp ├── DockCommentary.ui ├── Light.h ├── Referential.cpp ├── DialogMediumManager.ui ├── GlassExtended2.cpp ├── MainWindow.h ├── Astree.pro ├── DeviceOptimizer.h ├── DialogScaleDevice.cpp ├── DeviceScaling.cpp ├── Astree_vs2017.iss ├── DeviceOptimizerRandom.cpp ├── Surface.h ├── DialogMediumManager.cpp ├── GlassManager.cpp ├── Glass.cpp ├── GlassCatalogIo.cpp ├── DockLightProperties.cpp ├── DockSurfacesData.ui ├── DockLightProperties.ui ├── DockImageQuality.cpp ├── DockImageQuality.ui ├── OpticalDevice.h ├── LightAutoFocus.cpp └── DockOptimizer.ui ├── README.md ├── .gitattributes ├── glass └── common_glass.agf ├── samples ├── others │ ├── simple_lens.astree │ ├── Newton_BK7_diagonals.astree │ ├── Mangin.astree │ └── two_mirror_optimizer.astree ├── telescopes │ ├── Newton_400.astree │ ├── Schwarzschild.astree │ ├── Newton_spherical_115.astree │ ├── PressmanCamichel_400.astree │ ├── Schmidt.astree │ ├── DallKirkam_400.astree │ ├── Cassegrain_400.astree │ ├── Maksutov.astree │ ├── RitcheyChretien_400.astree │ ├── Schwarzschild_aplanat.astree │ ├── Schmidt_field_flattener.astree │ ├── Gregory_400.astree │ ├── TMT.astree │ ├── Cassegrain__field_corrector.astree │ ├── PaulBacker_flat.astree │ ├── Gregory_3Reflexions_2mirrors.astree │ ├── PaulBacker.astree │ ├── EisenburgPearson.astree │ ├── Hougton_asymetric.astree │ ├── Houghton_flat.astree │ ├── Schmidt_meniscus_cassegrain.astree │ ├── Meniscus_Sphere_Corrector.astree │ ├── E-ELT.astree │ ├── LSST.astree │ ├── EdF_T2000_F3.4.astree │ ├── Edf_T400_F8.astree │ ├── Ross_hyperbolic_corrector.astree │ ├── WideField.astree │ ├── Honder_Riccardi.astree │ ├── EdF_T300_F5.astree │ └── EdF_T200_F2.5.astree ├── refractors │ ├── Fraunhofer_100_F10.astree │ └── Fraunhofer_155_F15.astree ├── eyepieces │ ├── Huygens.astree │ ├── Monocentric.astree │ ├── Ramsden.astree │ └── 2_lens_optim.astree └── afocal │ └── galillee.astree └── .gitignore /src/Astree.rc: -------------------------------------------------------------------------------- 1 | ASTREE ICON "Astree.ico" 2 | 3 | -------------------------------------------------------------------------------- /src/Astree.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probonopd/Astree/master/src/Astree.ico -------------------------------------------------------------------------------- /src/Astree_fr.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probonopd/Astree/master/src/Astree_fr.qm -------------------------------------------------------------------------------- /src/lupdate.bat: -------------------------------------------------------------------------------- 1 | C:\Qt\Qt5.8.0\5.8\mingw53_32\bin\lupdate.exe Astree.pro 2 | pause 3 | C:\Qt\Qt5.8.0\5.8\mingw53_32\bin\linguist.exe Astree_fr.ts 4 | -------------------------------------------------------------------------------- /src/Astree.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | Astree.ico 4 | Astree_fr.qm 5 | 6 | 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Astree 2 | Astree is a free open source, optical ray tracing and design software 3 | 4 | This software computes and shows the ray-tracing analysis of optical devices, having conical or polynomial surfaces,having reflections, transmissions, stops, analysis of the image quality. 5 | 6 | The code sources is GPL, using Qt, feel free to contribute! 7 | 8 | Windows binaries can be downloaded at: http://edeforas.free.fr 9 | 10 | -------------------------------------------------------------------------------- /src/Util/FileUtil.h: -------------------------------------------------------------------------------- 1 | #ifndef _FileUtil_ 2 | #define _FileUtil_ 3 | 4 | #include 5 | #include 6 | using namespace std; 7 | 8 | class FileUtil 9 | { 10 | public: 11 | static int file_size(char* sFileName); 12 | static bool file_delete(char* sFileName); 13 | static vector list(string sPath); 14 | static string get_executable_path(); 15 | static string get_path(string sFile); 16 | }; 17 | 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /src/Vector3D.h: -------------------------------------------------------------------------------- 1 | #ifndef Vector3D_ 2 | #define Vector3D_ 3 | 4 | #include 5 | 6 | namespace Vector3D 7 | { 8 | inline void normalize(double& x,double& y,double& z) 9 | { 10 | double dNorm2=x*x+y*y+z*z; 11 | 12 | if(dNorm2!=0.) 13 | { 14 | dNorm2=1./std::sqrt(dNorm2); 15 | x*=dNorm2; 16 | y*=dNorm2; 17 | z*=dNorm2; 18 | } 19 | } 20 | } 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /glass/common_glass.agf: -------------------------------------------------------------------------------- 1 | CC common glasses 2 | 3 | NM F2 2 4 | CD 1.34533359 9.97743871e-3 2.09073118e-1 4.70450767e-2 9.37357162e-1 1.11886764e2 5 | 6 | NM BK7 2 7 | CD 1.039612120E+00 6.000698670E-03 2.317923440E-01 2.001791440E-02 1.010469450E+00 1.035606530E+02 8 | 9 | NM SF10 2 10 | CD 1.62153902E+00 1.22241457E-02 2.56287842E-01 5.95736775E-02 1.64447552E+00 1.47468793E+02 11 | 12 | NM Silica 2 13 | CD 0.6961663 0.00467914825849 0.4079426 0.01351206307396 0.8974794 97.934002537921 14 | 15 | NM void 2 -------------------------------------------------------------------------------- /src/DeviceIoZmx.h: -------------------------------------------------------------------------------- 1 | // this file is covered by the General Public License version 2 or later 2 | // please see GPL.html for more details and licensing issues 3 | // copyright Etienne de Foras ( the author ) mailto: etienne.deforas@gmail.com 4 | 5 | #ifndef DeviceIoZmx_ 6 | #define DeviceIoZmx_ 7 | 8 | #include 9 | using namespace std; 10 | 11 | class OpticalDevice; 12 | 13 | class DeviceIoZmx 14 | { 15 | public: 16 | static OpticalDevice* import(string sFile); 17 | }; 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /src/DeviceScaling.h: -------------------------------------------------------------------------------- 1 | // this file is covered by the General Public License version 2 or later 2 | // please see GPL.html for more details and licensing issues 3 | // copyright Etienne de Foras ( the author ) mailto: etienne.deforas@gmail.com 4 | 5 | #ifndef DeviceScaling_ 6 | #define DeviceScaling_ 7 | 8 | class OpticalDevice; 9 | 10 | class DeviceScaling 11 | { 12 | public: 13 | bool scale(OpticalDevice* pDevice, double dRatio, bool bScaleDiameter=true, bool bScaleFocal=true); 14 | }; 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /src/GlassCatalogIo.h: -------------------------------------------------------------------------------- 1 | // this file is covered by the General Public License version 2 or later 2 | // please see GPL.html for more details and licensing issues 3 | // copyright Etienne de Foras ( the author ) mailto: etienne.deforas@gmail.com 4 | 5 | #ifndef GlassCatalogIO_ 6 | #define GlassCatalogIO_ 7 | 8 | #include 9 | using namespace std; 10 | 11 | class GlassManager; 12 | 13 | class GlassCatalogIO 14 | { 15 | public: 16 | static bool load(string sFile, GlassManager &pManager); 17 | }; 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /src/Referential.h: -------------------------------------------------------------------------------- 1 | #ifndef Referential_ 2 | #define Referential_ 3 | 4 | class Referential 5 | { 6 | public: 7 | Referential(); 8 | virtual ~Referential(); 9 | 10 | void setYawPitchRoll(double Yaw,double Pitch,double Roll); 11 | void setTranslation(double x,double y, double z); 12 | 13 | void transform(double& x,double& y,double& z) const; 14 | void unTransform(double& x,double& y,double& z) const; 15 | 16 | private: 17 | double _rotMat[9]; //rotation 18 | double _x,_y,_z; //translation 19 | }; 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /src/DeviceIo.h: -------------------------------------------------------------------------------- 1 | // this file is covered by the General Public License version 2 or later 2 | // please see GPL.html for more details and licensing issues 3 | // copyright Etienne de Foras ( the author ) mailto: etienne.deforas@gmail.com 4 | 5 | #ifndef DeviceIo_ 6 | #define DeviceIo_ 7 | 8 | #include 9 | using namespace std; 10 | 11 | class OpticalDevice; 12 | class Properties; 13 | 14 | class DeviceIo 15 | { 16 | public: 17 | static bool save(string sFile, OpticalDevice* pD); 18 | static OpticalDevice* load(string sFile); 19 | }; 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /src/MaterialAir.h: -------------------------------------------------------------------------------- 1 | // this file is covered by the General Public License version 2 or later 2 | // please see GPL.html for more details and licensing issues 3 | // copyright Etienne de Foras ( the author ) mailto: etienne.deforas@gmail.com 4 | 5 | #ifndef MaterialAir_ 6 | #define MaterialAir_ 7 | 8 | #include "Glass.h" 9 | 10 | class MaterialAir : public Glass 11 | { 12 | public: 13 | MaterialAir(); 14 | MaterialAir(const MaterialAir& m); 15 | 16 | virtual Glass* clone() const; 17 | 18 | protected: 19 | virtual double calc_index(double dLambda); 20 | }; 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /src/ImageQuality.h: -------------------------------------------------------------------------------- 1 | #ifndef ImageQuality_ 2 | #define ImageQuality_ 3 | 4 | #include 5 | using namespace std; 6 | 7 | class ImageQuality 8 | { 9 | public: 10 | ImageQuality(); 11 | 12 | void init(int iNbangles); 13 | int nb_angles() const; 14 | 15 | vector vdAngles; 16 | vector vdDist; 17 | vector vdVignetting; 18 | vector vdSpotSize; 19 | vector vdSpotvsAiry; 20 | 21 | double dFNumber; 22 | double dAirySize; 23 | bool isImageInfinite; 24 | 25 | private: 26 | int _iNbAngles; 27 | }; 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /src/MaterialWater.h: -------------------------------------------------------------------------------- 1 | // this file is covered by the General Public License version 2 or later 2 | // please see GPL.html for more details and licensing issues 3 | // copyright Etienne de Foras ( the author ) mailto: etienne.deforas@gmail.com 4 | 5 | #ifndef MaterialWater_ 6 | #define MaterialWater_ 7 | 8 | #include "Glass.h" 9 | 10 | class MaterialWater : public Glass 11 | { 12 | public: 13 | MaterialWater(); 14 | MaterialWater(const MaterialWater& m); 15 | 16 | virtual Glass* clone() const; 17 | 18 | protected: 19 | virtual double calc_index(double dLambda); 20 | }; 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /src/MaterialUnknow.h: -------------------------------------------------------------------------------- 1 | // this file is covered by the General Public License version 2 or later 2 | // please see GPL.html for more details and licensing issues 3 | // copyright Etienne de Foras ( the author ) mailto: etienne.deforas@gmail.com 4 | 5 | #ifndef MaterialUnknow_ 6 | #define MaterialUnknow_ 7 | 8 | #include "Glass.h" 9 | 10 | class MaterialUnknow : public Glass 11 | { 12 | public: 13 | MaterialUnknow(); 14 | MaterialUnknow(const MaterialUnknow& m); 15 | 16 | virtual Glass* clone() const; 17 | 18 | protected: 19 | virtual double calc_index(double dLambda); 20 | }; 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /src/MaterialVacuum.h: -------------------------------------------------------------------------------- 1 | // this file is covered by the General Public License version 2 or later 2 | // please see GPL.html for more details and licensing issues 3 | // copyright Etienne de Foras ( the author ) mailto: etienne.deforas@gmail.com 4 | 5 | #ifndef MaterialVacuum_ 6 | #define MaterialVacuum_ 7 | 8 | #include "Glass.h" 9 | 10 | class MaterialVacuum : public Glass 11 | { 12 | public: 13 | MaterialVacuum(); 14 | MaterialVacuum(const MaterialVacuum& m); 15 | 16 | virtual Glass* clone() const; 17 | 18 | protected: 19 | virtual double calc_index(double dLambda); 20 | }; 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /src/Photon.h: -------------------------------------------------------------------------------- 1 | // this file is covered by the General Public License version 2 or later 2 | // please see GPL.html for more details and licensing issues 3 | // copyright Etienne de Foras ( the author ) mailto: etienne.deforas@gmail.com 4 | 5 | #ifndef Photon_ 6 | #define Photon_ 7 | 8 | class Photon 9 | { 10 | public: 11 | Photon(); 12 | bool is_valid() const; 13 | void set_lambda(double dLambda); 14 | double lambda() const; 15 | double x,y,z; 16 | double dx,dy,dz; 17 | double anglex,angley; 18 | 19 | bool valid; 20 | 21 | private: 22 | double _lambda; 23 | }; 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /src/DeviceOptimizerRandom.h: -------------------------------------------------------------------------------- 1 | // this file is covered by the General Public License version 2 or later 2 | // please see GPL.html for more details and licensing issues 3 | // copyright Etienne de Foras ( the author ) mailto: etienne.deforas@gmail.com 4 | 5 | #ifndef DeviceOptimizerRandom_ 6 | #define DeviceOptimizerRandom_ 7 | 8 | #include "DeviceOptimizer.h" 9 | 10 | #define RANDOM_ITER_BY_AXIS 10 11 | 12 | class DeviceOptimizerRandom : public DeviceOptimizer 13 | { 14 | public: 15 | DeviceOptimizerRandom(); 16 | virtual ~DeviceOptimizerRandom(); 17 | 18 | OptimizerResult optimize(); 19 | }; 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /src/LightAutofocus.h: -------------------------------------------------------------------------------- 1 | // this file is covered by the General Public License version 2 or later 2 | // please see GPL.html for more details and licensing issues 3 | // copyright Etienne de Foras ( the author ) mailto: etienne.deforas@gmail.com 4 | 5 | #ifndef LightAutofocus_ 6 | #define LightAutofocus_ 7 | 8 | class Light; 9 | 10 | class LightAutofocus 11 | { 12 | public: 13 | LightAutofocus(); 14 | double autofocus(const Light& l); 15 | 16 | void get_center(double& xCenter,double& yCenter) const; 17 | 18 | private: 19 | double compute_spot_size(const Light& l,double z); 20 | 21 | double _xCenter,_yCenter; 22 | }; 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /src/DeviceOptimizerAmoeba.h: -------------------------------------------------------------------------------- 1 | // this file is covered by the General Public License version 2 or later 2 | // please see GPL.html for more details and licensing issues 3 | // copyright Etienne de Foras ( the author ) mailto: etienne.deforas@gmail.com 4 | 5 | #ifndef DeviceOptimizerAmoeba_ 6 | #define DeviceOptimizerAmoeba_ 7 | 8 | #include "DeviceOptimizer.h" 9 | 10 | #include 11 | #include 12 | using namespace std; 13 | 14 | #define AMOEBA_MAX_ITER 500 15 | 16 | class DeviceOptimizerAmoeba : public DeviceOptimizer 17 | { 18 | public: 19 | DeviceOptimizerAmoeba(); 20 | virtual ~DeviceOptimizerAmoeba(); 21 | 22 | virtual OptimizerResult optimize(); 23 | }; 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /samples/others/simple_lens.astree: -------------------------------------------------------------------------------- 1 | 0.diameter=90 2 | 0.radius_curvature=100 3 | 0.type=BK7 4 | 0.z=-200 5 | 1.diameter=90 6 | 1.radius_curvature=-300 7 | 1.type=Air 8 | 1.z=-180 9 | 2.diameter=62.28436473 10 | 2.diameter.auto=1 11 | 2.radius_curvature=inf 12 | 2.type=image 13 | 2.z=-55.16888393 14 | 2.z.autofocus=1 15 | device.note=Simple unoptimized lens, show chromatism, spherical abberations and field curvature 16 | device.relative_convention=0 17 | image.autocurvature=0 18 | image.autofocus=1 19 | light.colors=Red.Yellow.Green.Blue. 20 | light.half_field_of_view=10 21 | light.nbsteps=3 22 | note=Simple unoptimized lens, show chromatism, spherical abberations and field curvature 23 | parameter.showLightOffAxis=100 24 | -------------------------------------------------------------------------------- /samples/telescopes/Newton_400.astree: -------------------------------------------------------------------------------- 1 | 0.conic=-1 2 | 0.diameter=400 3 | 0.radius_curvature=-4800 4 | 0.thick=-2400 5 | 0.type=reflect 6 | 1.diameter=32.00014299 7 | 1.diameter.auto=1 8 | 1.radius_curvature=1200.008131 9 | 1.thick=0 10 | 1.type=image 11 | 1.z.autofocus=1 12 | device.note=Simple parabolic newton 13 | device.note= 14 | device.note=Image field is curved 15 | device.note= 16 | device.note=All image parameteres are automatic 17 | device.relative_convention=1 18 | image.autocurvature=1 19 | image.autofocus=1 20 | light.colors=YellowBlack. 21 | light.half_field_of_view=0.38 22 | light.nbsteps=3 23 | note=Simple parabolic newton 24 | note= 25 | note=Image field is curved 26 | note= 27 | note=All image parameteres are automatic 28 | -------------------------------------------------------------------------------- /src/DockCommentary.h: -------------------------------------------------------------------------------- 1 | #ifndef DOCKCOMMENTARY_H 2 | #define DOCKCOMMENTARY_H 3 | 4 | #include 5 | 6 | class OpticalDevice; 7 | namespace Ui { 8 | class DockComment; 9 | } 10 | 11 | class DockCommentary : public QDockWidget { 12 | Q_OBJECT 13 | public: 14 | DockCommentary(QWidget *parent = 0); 15 | ~DockCommentary(); 16 | 17 | void device_changed(OpticalDevice* pDevice,int iReason); 18 | 19 | signals: 20 | void device_changed(void* pSender); 21 | 22 | protected: 23 | void changeEvent(QEvent *e); 24 | 25 | private: 26 | Ui::DockComment *ui; 27 | OpticalDevice* _pDevice; 28 | bool _bBlockSignals; 29 | private slots: 30 | void on_textEdit_textChanged(); 31 | }; 32 | 33 | #endif // DOCKCOMMENTARY_H 34 | -------------------------------------------------------------------------------- /src/DialogMediumManager.h: -------------------------------------------------------------------------------- 1 | #ifndef DIALOGMEDIUMMANAGER_H 2 | #define DIALOGMEDIUMMANAGER_H 3 | 4 | #include 5 | using namespace std; 6 | 7 | #include 8 | 9 | namespace Ui { 10 | class DialogMediumManager; 11 | } 12 | 13 | class DialogMediumManager : public QDialog 14 | { 15 | Q_OBJECT 16 | 17 | public: 18 | explicit DialogMediumManager(QWidget *parent = 0,string sGlass=""); 19 | ~DialogMediumManager(); 20 | 21 | string selected_glass() const; 22 | 23 | private slots: 24 | void on_btnSelect_clicked(); 25 | 26 | void on_btnCancel_clicked(); 27 | 28 | void on_btnOk_clicked(); 29 | 30 | private: 31 | Ui::DialogMediumManager *ui; 32 | string _sSelectedGlass; 33 | }; 34 | 35 | #endif // DIALOGMEDIUMMANAGER_H 36 | -------------------------------------------------------------------------------- /samples/telescopes/Schwarzschild.astree: -------------------------------------------------------------------------------- 1 | 0.diameter=200 2 | 0.radius_curvature=765.5 3 | 0.type=reflect 4 | 0.z=-0 5 | 1.diameter=969.2640052 6 | 1.diameter.auto=1 7 | 1.inner_diameter=400 8 | 1.radius_curvature=2001.6 9 | 1.type=reflect 10 | 1.z=-1235.9 11 | 2.diameter=64.90102112 12 | 2.diameter.auto=1 13 | 2.radius_curvature=-626 14 | 2.type=image 15 | 2.z=1386.00333 16 | 2.z.autofocus=1 17 | device.convention=absolute 18 | half_field_of_view=3 19 | light.colors=YellowBlack. 20 | light.nbsteps=3 21 | note=From the book Handbook of Optics 22 | note=Optical Society of America 23 | note= 24 | note=Diameter is scaled to 200mm 25 | note= 26 | note=All surfaces are spherical 27 | note= 28 | note=Secondary is much larger than primary! 29 | note= 30 | note=Image field is curved 31 | -------------------------------------------------------------------------------- /src/DockImageQuality.h: -------------------------------------------------------------------------------- 1 | #ifndef DOCKIMAGEQUALITY_H 2 | #define DOCKIMAGEQUALITY_H 3 | 4 | #include 5 | 6 | class OpticalDevice; 7 | 8 | namespace Ui { 9 | class DockImageQuality; 10 | } 11 | 12 | class DockImageQuality : public QDockWidget 13 | { 14 | Q_OBJECT 15 | 16 | public: 17 | explicit DockImageQuality(QWidget *parent = 0); 18 | ~DockImageQuality(); 19 | 20 | void device_changed(OpticalDevice *pDevice, int iReason); 21 | 22 | private slots: 23 | void on_tableWidget_currentCellChanged(int currentRow, int currentColumn, int previousRow, int previousColumn); 24 | 25 | private: 26 | Ui::DockImageQuality *ui; 27 | OpticalDevice* _pDevice; 28 | 29 | bool _bBlockSignals; 30 | }; 31 | 32 | #endif // DOCKIMAGEQUALITY_H 33 | -------------------------------------------------------------------------------- /src/AstreeDefines.h: -------------------------------------------------------------------------------- 1 | // this file is covered by the General Public License version 2 or later 2 | // please see GPL.html for more details and licensing issues 3 | // copyright Etienne de Foras ( the author ) mailto: etienne.deforas@gmail.com 4 | 5 | #ifndef AstreeDefines_ 6 | #define AstreeDefines_ 7 | 8 | #define ASTREE_VERSION "1.23" 9 | 10 | #define SIDEVIEW_NB_POINTS_SURFACE 41 11 | #define SIDEVIEW_NB_POINTS_LIGHT 17 12 | #define NB_POINTS_SCATTER_PLOT 71 13 | 14 | //device changed reasons 15 | #define NEW_OPTICAL_DEVICE 1 16 | #define OPTICAL_DEVICE_SAVED 2 17 | #define OPTICAL_DEVICE_CHANGED 3 18 | #define COMMENT_CHANGED 4 19 | #define USER_INTERFACE_CHANGED 5 20 | #define LIGHT_OFF_AXIS_CHANGED 6 21 | #define OPTIMIZER_CHANGED 6 22 | #define CHANGE_GLASS 7 //launch glass manager 23 | #endif 24 | -------------------------------------------------------------------------------- /samples/telescopes/Newton_spherical_115.astree: -------------------------------------------------------------------------------- 1 | 0.diameter=115 2 | 0.radius_curvature=-1800 3 | 0.type=reflect 4 | 0.z=-0 5 | 1.diameter=31.49731033 6 | 1.diameter.auto=1 7 | 1.radius_curvature=361.1619611 8 | 1.type=image 9 | 1.z=-899.6548796 10 | 1.z.autofocus=1 11 | device.note=This sample show how spherical mirrors can be used in small commercial Newton telescopes, with a diameter under 115 mm. 12 | device.note= 13 | device.note=Image field is curved 14 | device.relative_convention=0 15 | image.autocurvature=1 16 | image.autofocus=1 17 | light.colors=YellowBlack. 18 | light.half_field_of_view=1 19 | light.nbsteps=3 20 | note=This sample show how spherical mirrors can be used in small commercial Newton telescopes, with a diameter under 115 mm. 21 | note= 22 | note=Image field is curved 23 | parameter.showLightOffAxis=0 24 | -------------------------------------------------------------------------------- /src/GlassSellmeier.h: -------------------------------------------------------------------------------- 1 | // this file is covered by the General Public License version 2 or later 2 | // please see GPL.html for more details and licensing issues 3 | // copyright Etienne de Foras ( the author ) mailto: etienne.deforas@gmail.com 4 | 5 | #ifndef GlassSellmeier_ 6 | #define GlassSellmeier_ 7 | 8 | #include "Glass.h" 9 | 10 | class GlassSellmeier : public Glass 11 | { 12 | public: 13 | GlassSellmeier(); 14 | GlassSellmeier(const GlassSellmeier& m); 15 | virtual Glass* clone() const; 16 | 17 | void set_coefs(double dB1,double dB2,double dB3,double dC1,double dC2,double dC3); 18 | 19 | protected: 20 | virtual double calc_index(double dLambdaMicrons); 21 | 22 | private: 23 | double _dB1; 24 | double _dB2; 25 | double _dB3; 26 | double _dC1; 27 | double _dC2; 28 | double _dC3; 29 | }; 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /src/DialogScaleDevice.h: -------------------------------------------------------------------------------- 1 | #ifndef DIALOGSCALEDEVICE_H 2 | #define DIALOGSCALEDEVICE_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class DialogScaleDevice; 8 | } 9 | 10 | class DialogScaleDevice : public QDialog 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | explicit DialogScaleDevice(QWidget *parent = 0); 16 | ~DialogScaleDevice(); 17 | 18 | double get_scale(); 19 | bool get_scale_diameter(); 20 | bool get_scale_focal(); 21 | 22 | private slots: 23 | void on_pushButton_clicked(); 24 | 25 | void on_pushButton_2_clicked(); 26 | 27 | void on_rbFactor_clicked(); 28 | 29 | void on_rbPercentage_clicked(); 30 | 31 | void on_rbSizeChange_clicked(); 32 | 33 | private: 34 | Ui::DialogScaleDevice *ui; 35 | 36 | double _dScale; 37 | bool _bScaleDiameter; 38 | bool _bScaleFocal; 39 | }; 40 | 41 | #endif // DIALOGSCALEDEVICE_H 42 | -------------------------------------------------------------------------------- /samples/others/Newton_BK7_diagonals.astree: -------------------------------------------------------------------------------- 1 | 0.conic=-1 2 | 0.diameter=200 3 | 0.radius_curvature=-2400 4 | 0.thick=-700 5 | 0.type=reflect 6 | 1.diameter=100 7 | 1.radius_curvature=inf 8 | 1.thick=-40 9 | 1.type=BK7 10 | 2.diameter=100 11 | 2.radius_curvature=inf 12 | 2.thick=-473.6989228 13 | 2.type=Air 14 | 3.diameter=32 15 | 3.radius_curvature=inf 16 | 3.thick=0 17 | 3.type=image 18 | 3.z.autofocus=1 19 | device.convention=relative 20 | device.note=This sample show how a perfect telescope can be altered using prismatic secondaries, or right angles prismatic devices 21 | device.relative_convention=1 22 | half_field_of_view=0.5 23 | image.autocurvature=0 24 | image.autofocus=1 25 | light.colors=Red.Yellow.Green.Blue. 26 | light.half_field_of_view=0.5 27 | light.nbsteps=3 28 | note=This sample show how a perfect telescope can be altered using prismatic secondaries, or right angles prismatic devices 29 | -------------------------------------------------------------------------------- /samples/telescopes/PressmanCamichel_400.astree: -------------------------------------------------------------------------------- 1 | 0.diameter=400 2 | 0.inner_diameter=60 3 | 0.radius_curvature=-2385.093168 4 | 0.thick=-802.2857143 5 | 0.type=reflect 6 | 1.conic=7.720264319 7 | 1.diameter=138.2131172 8 | 1.diameter.auto=1 9 | 1.radius_curvature=-1248.89441 10 | 1.thick=1040.638224 11 | 1.type=reflect 12 | 2.diameter=31.8711391 13 | 2.diameter.auto=1 14 | 2.radius_curvature=inf 15 | 2.thick=0 16 | 2.type=image 17 | 2.z.autofocus=1 18 | device.note=primary is spherical 19 | device.note= 20 | device.note=Off axis images are bad 21 | device.note= 22 | device.note=secondary is strongly aspheric 23 | device.relative_convention=1 24 | image.autocurvature=0 25 | image.autofocus=1 26 | light.colors=YellowBlack. 27 | light.half_field_of_view=0.28 28 | light.nbsteps=3 29 | note=primary is spherical 30 | note= 31 | note=Off axis images are bad 32 | note= 33 | note=secondary is strongly aspheric 34 | -------------------------------------------------------------------------------- /src/tests/test_newton.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = app 2 | CONFIG += console c++11 3 | CONFIG -= app_bundle 4 | CONFIG -= qt 5 | 6 | SOURCES += \ 7 | test_newton.cpp \ 8 | ..\OpticalDevice.cpp \ 9 | ..\ImageQuality.cpp \ 10 | ..\Surface.cpp \ 11 | ..\Photon.cpp \ 12 | ..\Light.cpp \ 13 | ..\LightAutofocus.cpp \ 14 | ..\Glass.cpp \ 15 | ..\GlassManager.cpp \ 16 | ..\MaterialAir.cpp \ 17 | ..\MaterialUnknow.cpp \ 18 | ..\MaterialVacuum.cpp \ 19 | ..\MaterialWater.cpp 20 | 21 | HEADERS += \ 22 | ..\OpticalDevice.h \ 23 | ..\ImageQuality.h \ 24 | ..\Surface.h \ 25 | ..\Photon.h \ 26 | ..\Light.h \ 27 | ..\LightAutofocus.h \ 28 | ..\Vector3D.h \ 29 | ..\Glass.h \ 30 | ..\GlassManager.h \ 31 | ..\MaterialAir.h \ 32 | ..\MaterialUnknow.h \ 33 | ..\MaterialVacuum.h \ 34 | ..\MaterialWater.h 35 | 36 | INCLUDEPATH += .. 37 | -------------------------------------------------------------------------------- /src/ImageQuality.cpp: -------------------------------------------------------------------------------- 1 | #include "ImageQuality.h" 2 | 3 | //////////////////////////////////////////////////////////////////////////////// 4 | ImageQuality::ImageQuality() 5 | { 6 | init(0); 7 | } 8 | //////////////////////////////////////////////////////////////////////////////// 9 | void ImageQuality::init(int iNbangles) 10 | { 11 | _iNbAngles=iNbangles; 12 | vdAngles.assign(iNbangles,-1.); 13 | vdDist.assign(iNbangles,-1.); 14 | vdVignetting.assign(iNbangles,-1.); 15 | vdSpotSize.assign(iNbangles,-1.); 16 | vdSpotvsAiry.assign(iNbangles,-1.); 17 | 18 | dFNumber=-1.; 19 | dAirySize=-1.; 20 | isImageInfinite=false; 21 | } 22 | //////////////////////////////////////////////////////////////////////////////// 23 | int ImageQuality::nb_angles() const 24 | { 25 | return _iNbAngles; 26 | } 27 | //////////////////////////////////////////////////////////////////////////////// 28 | -------------------------------------------------------------------------------- /samples/telescopes/Schmidt.astree: -------------------------------------------------------------------------------- 1 | 0.diameter=200 2 | 0.radius_curvature=inf 3 | 0.thick=4 4 | 0.type=BK7 5 | 1.diameter=200.168303 6 | 1.diameter.auto=1 7 | 1.r4=5.39e-010 8 | 1.r6=8.9e-016 9 | 1.radius_curvature=inf 10 | 1.thick=960 11 | 1.type=Air 12 | 2.diameter=262.1404955 13 | 2.diameter.auto=1 14 | 2.radius_curvature=-960 15 | 2.thick=-479.9678645 16 | 2.type=reflect 17 | 3.diameter=30.16605784 18 | 3.diameter.auto=1 19 | 3.radius_curvature=-473.4756013 20 | 3.thick=0 21 | 3.type=image 22 | 3.z.autofocus=1 23 | device.note=From http://www.telescope-optics.net/appendix3.htm 24 | device.note= 25 | device.note=Model 2: SchmidtCamera 26 | device.relative_convention=1 27 | image.autocurvature=1 28 | image.autofocus=1 29 | light.colors=Red.Yellow.Green.Blue. 30 | light.half_field_of_view=1.8 31 | light.nbsteps=3 32 | note=From http://www.telescope-optics.net/appendix3.htm 33 | note= 34 | note=Model 2: SchmidtCamera 35 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Windows image file caches 2 | Thumbs.db 3 | ehthumbs.db 4 | 5 | # Folder config file 6 | Desktop.ini 7 | 8 | # Recycle Bin used on file shares 9 | $RECYCLE.BIN/ 10 | 11 | # Windows Installer files 12 | *.cab 13 | *.msi 14 | *.msm 15 | *.msp 16 | 17 | # Windows shortcuts 18 | *.lnk 19 | 20 | # ========================= 21 | # Operating System Files 22 | # ========================= 23 | 24 | # OSX 25 | # ========================= 26 | 27 | .DS_Store 28 | .AppleDouble 29 | .LSOverride 30 | 31 | # Thumbnails 32 | ._* 33 | 34 | # Files that might appear in the root of a volume 35 | .DocumentRevisions-V100 36 | .fseventsd 37 | .Spotlight-V100 38 | .TemporaryItems 39 | .Trashes 40 | .VolumeIcon.icns 41 | 42 | # Directories potentially created on remote AFP share 43 | .AppleDB 44 | .AppleDesktop 45 | Network Trash Folder 46 | Temporary Items 47 | .apdisk 48 | *.exe 49 | *.user 50 | *.autosave 51 | *.pdb 52 | -------------------------------------------------------------------------------- /src/tests/test_perfect_surface.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = app 2 | CONFIG += console c++11 3 | CONFIG -= app_bundle 4 | CONFIG -= qt 5 | 6 | SOURCES += \ 7 | test_perfect_surface.cpp \ 8 | ..\OpticalDevice.cpp \ 9 | ..\ImageQuality.cpp \ 10 | ..\Surface.cpp \ 11 | ..\Photon.cpp \ 12 | ..\Light.cpp \ 13 | ..\LightAutofocus.cpp \ 14 | ..\Glass.cpp \ 15 | ..\GlassManager.cpp \ 16 | ..\MaterialAir.cpp \ 17 | ..\MaterialUnknow.cpp \ 18 | ..\MaterialVacuum.cpp \ 19 | ..\MaterialWater.cpp 20 | 21 | HEADERS += \ 22 | ..\OpticalDevice.h \ 23 | ..\ImageQuality.h \ 24 | ..\Surface.h \ 25 | ..\Photon.h \ 26 | ..\Light.h \ 27 | ..\LightAutofocus.h \ 28 | ..\Vector3D.h \ 29 | ..\Glass.h \ 30 | ..\GlassManager.h \ 31 | ..\MaterialAir.h \ 32 | ..\MaterialUnknow.h \ 33 | ..\MaterialVacuum.h \ 34 | ..\MaterialWater.h 35 | 36 | INCLUDEPATH += .. 37 | -------------------------------------------------------------------------------- /samples/refractors/Fraunhofer_100_F10.astree: -------------------------------------------------------------------------------- 1 | 0.diameter=100 2 | 0.radius_curvature=600 3 | 0.thick=11 4 | 0.type=BK7 5 | 1.diameter=100 6 | 1.radius_curvature=-360 7 | 1.thick=1 8 | 1.type=Air 9 | 2.diameter=100 10 | 2.radius_curvature=-363 11 | 2.thick=7 12 | 2.type=F2 13 | 3.diameter=100 14 | 3.radius_curvature=-1510 15 | 3.thick=989.4873591 16 | 3.type=Air 17 | 4.diameter=31.46708489 18 | 4.diameter.auto=1 19 | 4.radius_curvature=-370 20 | 4.thick=0 21 | 4.type=image 22 | 4.z.autofocus=1 23 | device.note=Fraunhofer doublet (100mm F/10) 24 | device.note=from 25 | device.note=http://www.telescope-optics.net/achromats.htm 26 | device.relative_convention=1 27 | image.autocurvature=0 28 | image.autofocus=1 29 | light.colors=Red.Yellow.Green.Blue. 30 | light.half_field_of_view=0.9 31 | light.nbsteps=3 32 | note=Fraunhofer doublet (100mm F/10) 33 | note=from 34 | note=http://www.telescope-optics.net/achromats.htm 35 | parameter.showLightOffAxis=100 36 | -------------------------------------------------------------------------------- /samples/telescopes/DallKirkam_400.astree: -------------------------------------------------------------------------------- 1 | 0.conic=-0.6142354219 2 | 0.diameter=400 3 | 0.inner_diameter=60 4 | 0.radius_curvature=-2397.003745 5 | 0.thick=-806.2921348 6 | 0.type=reflect 7 | 1.diameter=138.8396482 8 | 1.diameter.auto=1 9 | 1.radius_curvature=-1255.131086 10 | 1.thick=1045.816257 11 | 1.type=reflect 12 | 2.diameter=31.61865402 13 | 2.diameter.auto=1 14 | 2.radius_curvature=inf 15 | 2.thick=0 16 | 2.type=image 17 | 2.z.autofocus=1 18 | device.convention=relative 19 | device.note=from 20 | device.note=http://www.telescope-optics.net/appendix.htm#TWO-MIRROR 21 | device.note= 22 | device.note=model aplanatic cassegrain 23 | device.relative_convention=1 24 | half_field_of_view=0.28 25 | image.autocurvature=0 26 | image.autofocus=1 27 | light.colors=YellowBlack. 28 | light.half_field_of_view=0.28 29 | light.nbsteps=3 30 | note=from 31 | note=http://www.telescope-optics.net/appendix.htm#TWO-MIRROR 32 | note= 33 | note=model aplanatic cassegrain 34 | -------------------------------------------------------------------------------- /src/tests/test_scaling.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = app 2 | CONFIG += console c++11 3 | CONFIG -= app_bundle 4 | CONFIG -= qt 5 | 6 | SOURCES += \ 7 | test_scaling.cpp \ 8 | ..\OpticalDevice.cpp \ 9 | ..\ImageQuality.cpp \ 10 | ..\Surface.cpp \ 11 | ..\Photon.cpp \ 12 | ..\Light.cpp \ 13 | ..\LightAutofocus.cpp \ 14 | ..\Glass.cpp \ 15 | ..\GlassManager.cpp \ 16 | ..\MaterialAir.cpp \ 17 | ..\MaterialUnknow.cpp \ 18 | ..\MaterialVacuum.cpp \ 19 | ..\MaterialWater.cpp \ 20 | ../DeviceScaling.cpp 21 | 22 | HEADERS += \ 23 | ..\OpticalDevice.h \ 24 | ..\ImageQuality.h \ 25 | ..\Surface.h \ 26 | ..\Photon.h \ 27 | ..\Light.h \ 28 | ..\LightAutofocus.h \ 29 | ..\Vector3D.h \ 30 | ..\Glass.h \ 31 | ..\GlassManager.h \ 32 | ..\MaterialAir.h \ 33 | ..\MaterialUnknow.h \ 34 | ..\MaterialVacuum.h \ 35 | ..\MaterialWater.h \ 36 | ../DeviceScaling.h 37 | 38 | INCLUDEPATH += .. 39 | -------------------------------------------------------------------------------- /samples/telescopes/Cassegrain_400.astree: -------------------------------------------------------------------------------- 1 | 0.conic=-1 2 | 0.diameter=400 3 | 0.inner_diameter=60 4 | 0.radius_curvature=-2403.003755 5 | 0.thick=-808.310388 6 | 0.type=reflect 7 | 1.conic=-4.840672339 8 | 1.diameter=139.2208613 9 | 1.diameter.auto=1 10 | 1.radius_curvature=-1258.272841 11 | 1.thick=1048.427212 12 | 1.type=reflect 13 | 2.diameter=31.45011443 14 | 2.diameter.auto=1 15 | 2.radius_curvature=inf 16 | 2.thick=0 17 | 2.type=image 18 | 2.z.autofocus=1 19 | device.convention=relative 20 | device.note=from 21 | device.note=http://www.telescope-optics.net/appendix.htm#TWO-MIRROR 22 | device.note= 23 | device.note=model aplanatic cassegrain 24 | device.relative_convention=1 25 | half_field_of_view=0.28 26 | image.autocurvature=0 27 | image.autofocus=1 28 | light.colors=YellowBlack. 29 | light.half_field_of_view=0.28 30 | light.nbsteps=3 31 | note=from 32 | note=http://www.telescope-optics.net/appendix.htm#TWO-MIRROR 33 | note= 34 | note=model aplanatic cassegrain 35 | -------------------------------------------------------------------------------- /samples/telescopes/Maksutov.astree: -------------------------------------------------------------------------------- 1 | 0.diameter=200 2 | 0.radius_curvature=-225.36 3 | 0.thick=21 4 | 0.type=BK7 5 | 1.diameter=207.6152509 6 | 1.diameter.auto=1 7 | 1.radius_curvature=-237.8 8 | 1.thick=670 9 | 1.type=Air 10 | 2.diameter=257.180131 11 | 2.diameter.auto=1 12 | 2.radius_curvature=-1063 13 | 2.thick=-545.3254278 14 | 2.type=reflect 15 | 3.diameter=32.00297665 16 | 3.diameter.auto=1 17 | 3.radius_curvature=-458.0088815 18 | 3.thick=0 19 | 3.type=image 20 | 3.z.autofocus=1 21 | device.note=from http://www.telescope-optics.net/ 22 | device.note= 23 | device.note=chapter 10.2.3 24 | device.note= 25 | device.note=All surfaces are spherical. 26 | device.relative_convention=1 27 | image.autocurvature=1 28 | image.autofocus=1 29 | light.colors=Red.Yellow.Green.Blue. 30 | light.half_field_of_view=1.79 31 | light.nbsteps=3 32 | note=from http://www.telescope-optics.net/ 33 | note= 34 | note=chapter 10.2.3 35 | note= 36 | note=All surfaces are spherical. 37 | parameter.showLightOffAxis=0 38 | -------------------------------------------------------------------------------- /src/GlassExtended2.h: -------------------------------------------------------------------------------- 1 | // this file is covered by the General Public License version 2 or later 2 | // please see GPL.html for more details and licensing issues 3 | // copyright Etienne de Foras ( the author ) mailto: etienne.deforas@gmail.com 4 | 5 | #ifndef GlassExtended2_ 6 | #define GlassExtended2_ 7 | 8 | #include "Glass.h" 9 | 10 | // glass definition as in the https://github.com/nzhagen/zemaxglass 11 | 12 | class GlassExtended2 : public Glass 13 | { 14 | public: 15 | GlassExtended2(); 16 | GlassExtended2(const GlassExtended2& m); 17 | virtual Glass* clone() const; 18 | 19 | void set_coefs(double dC0,double dC1,double dC2,double dC3,double dC4,double dC5,double dC6,double dC7); 20 | 21 | protected: 22 | virtual double calc_index(double dLambdaMicrons); 23 | 24 | private: 25 | double _dC0; 26 | double _dC1; 27 | double _dC2; 28 | double _dC3; 29 | double _dC4; 30 | double _dC5; 31 | double _dC6; 32 | double _dC7; 33 | }; 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /src/GlassManager.h: -------------------------------------------------------------------------------- 1 | // this file is covered by the General Public License version 2 or later 2 | // please see GPL.html for more details and licensing issues 3 | // copyright Etienne de Foras ( the author ) mailto: etienne.deforas@gmail.com 4 | 5 | #ifndef GlassManager_ 6 | #define GlassManager_ 7 | 8 | #include 9 | #include 10 | using namespace std; 11 | 12 | class Glass; 13 | 14 | class GlassManager 15 | { 16 | public: 17 | static GlassManager& singleton(); 18 | Glass* create(string sMaterial) const; 19 | void destroy(Glass* pMaterial); 20 | 21 | void list_available(vector& vsAvailable); 22 | 23 | bool exist(string sGlass) const; 24 | 25 | unsigned int solid_color(string sMaterial); 26 | 27 | void inject(Glass* pGlass); //take ownership of pGlass 28 | 29 | private: 30 | GlassManager(); 31 | ~GlassManager(); 32 | 33 | static GlassManager* _pGlassManager; 34 | vector _vGlass; // TODO use map 35 | }; 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /samples/telescopes/RitcheyChretien_400.astree: -------------------------------------------------------------------------------- 1 | 0.conic=-1.136753441 2 | 0.diameter=400 3 | 0.inner_diameter=60 4 | 0.radius_curvature=-2406.015038 5 | 0.thick=-809.3233083 6 | 0.type=reflect 7 | 1.conic=-6.499526963 8 | 1.diameter=139.357288 9 | 1.diameter.auto=1 10 | 1.radius_curvature=-1259.849624 11 | 1.thick=1049.837418 12 | 1.type=reflect 13 | 2.diameter=31.36525282 14 | 2.diameter.auto=1 15 | 2.radius_curvature=-449.9236727 16 | 2.thick=0 17 | 2.type=image 18 | 2.z.autofocus=1 19 | device.convention=relative 20 | device.note=from 21 | device.note=http://www.telescope-optics.net/appendix.htm#TWO-MIRROR 22 | device.note= 23 | device.note=model aplanatic cassegrain 24 | device.relative_convention=1 25 | half_field_of_view=0.28 26 | image.autocurvature=1 27 | image.autofocus=1 28 | light.colors=YellowBlack. 29 | light.half_field_of_view=0.28 30 | light.nbsteps=3 31 | note=from 32 | note=http://www.telescope-optics.net/appendix.htm#TWO-MIRROR 33 | note= 34 | note=model aplanatic cassegrain 35 | parameter.showLightOffAxis=0 36 | -------------------------------------------------------------------------------- /samples/telescopes/Schwarzschild_aplanat.astree: -------------------------------------------------------------------------------- 1 | 0.conic=-8.63 2 | 0.diameter=200 3 | 0.radius_curvature=-2666 4 | 0.thick=-756 5 | 0.type=reflect 6 | 1.conic=2.5 7 | 1.diameter=99.1121398 8 | 1.diameter.auto=1 9 | 1.radius_curvature=951 10 | 1.thick=260.686552 11 | 1.type=reflect 12 | 2.diameter=9.255856163 13 | 2.diameter.auto=1 14 | 2.radius_curvature=inf 15 | 2.thick=0 16 | 2.type=image 17 | 2.z.autofocus=1 18 | device.convention=relative 19 | device.note=From 20 | device.note=http://www.telescope-optics.net/appendix.htm#TWO-MIRROR 21 | device.note= 22 | device.note=model Schwarzschild aplanat 23 | device.note= 24 | device.note=Optimized for a CCD sensor 25 | device.relative_convention=1 26 | half_field_of_view=0.44 27 | image.autocurvature=0 28 | image.autofocus=1 29 | light.colors=YellowBlack. 30 | light.half_field_of_view=0.44 31 | light.nbsteps=3 32 | note=From 33 | note=http://www.telescope-optics.net/appendix.htm#TWO-MIRROR 34 | note= 35 | note=model Schwarzschild aplanat 36 | note= 37 | note=Optimized for a CCD sensor 38 | -------------------------------------------------------------------------------- /src/FrameSideView.h: -------------------------------------------------------------------------------- 1 | // this file is covered by the General Public License version 2 or later 2 | // please see GPL.html for more details and licensing issues 3 | // copyright Etienne de Foras ( the author ) mailto: etienne.deforas@gmail.com 4 | 5 | #ifndef FRAMESIDEVIEW_H 6 | #define FRAMESIDEVIEW_H 7 | 8 | #include 9 | 10 | #include 11 | #include 12 | using namespace std; 13 | 14 | namespace Ui 15 | { 16 | class FrameSideView; 17 | } 18 | 19 | class OpticalDevice; 20 | class FrameSideView : public QFrame 21 | { 22 | Q_OBJECT 23 | Q_DISABLE_COPY(FrameSideView) 24 | public: 25 | FrameSideView(QWidget *parent = 0); 26 | virtual ~FrameSideView(); 27 | void device_changed(OpticalDevice *pDevice, int iReason); 28 | 29 | void fit_in_view(); 30 | void zoom_in(); 31 | void zoom_out(); 32 | 33 | protected: 34 | virtual void changeEvent(QEvent *e); 35 | 36 | private: 37 | Ui::FrameSideView *m_ui; 38 | OpticalDevice* _pDevice; 39 | 40 | void enlarge(QRectF& r,double dRatio); 41 | }; 42 | 43 | #endif // FRAMESIDEVIEW_H 44 | -------------------------------------------------------------------------------- /samples/telescopes/Schmidt_field_flattener.astree: -------------------------------------------------------------------------------- 1 | 0.diameter=200 2 | 0.radius_curvature=inf 3 | 0.thick=4 4 | 0.type=BK7 5 | 1.diameter=200 6 | 1.r4=5.39e-010 7 | 1.r6=8.9e-016 8 | 1.radius_curvature=inf 9 | 1.thick=960 10 | 1.type=Air 11 | 2.diameter=220 12 | 2.radius_curvature=-960 13 | 2.thick=-478 14 | 2.type=reflect 15 | 3.diameter=30.73798118 16 | 3.diameter.auto=1 17 | 3.radius_curvature=-161.88 18 | 3.thick=-1.5 19 | 3.type=BK7 20 | 4.diameter=30.49207191 21 | 4.diameter.auto=1 22 | 4.radius_curvature=inf 23 | 4.thick=-0.978593649 24 | 4.type=Air 25 | 5.diameter=30.0117994 26 | 5.diameter.auto=1 27 | 5.radius_curvature=inf 28 | 5.thick=0 29 | 5.type=image 30 | 5.z.autofocus=1 31 | device.note=From http://www.telescope-optics.net/appendix3.htm 32 | device.note= 33 | device.note= 34 | device.note=Model 2: Schmidt Camera 35 | device.relative_convention=1 36 | image.autocurvature=0 37 | image.autofocus=1 38 | light.colors=Red.Yellow.Green.Blue. 39 | light.half_field_of_view=1.8 40 | light.nbsteps=3 41 | note=From http://www.telescope-optics.net/appendix3.htm 42 | note= 43 | note= 44 | note=Model 2: Schmidt Camera 45 | -------------------------------------------------------------------------------- /src/main.cpp: -------------------------------------------------------------------------------- 1 | // this file is covered by the General Public License version 2 or later 2 | // please see GPL.html for more details and licensing issues 3 | // copyright Etienne de Foras ( the author ) mailto: etienne.deforas@gmail.com 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include "MainWindow.h" 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | QApplication app(argc, argv); 16 | 17 | QString sPath=QCoreApplication::applicationDirPath(); 18 | 19 | QTranslator qtTranslator; 20 | qtTranslator.load("qt_" + QLocale::system().name(), QLibraryInfo::location(QLibraryInfo::TranslationsPath)); 21 | app.installTranslator(&qtTranslator); 22 | 23 | QTranslator myappTranslator; 24 | myappTranslator.load("Astree_" + QLocale::system().name(),sPath); 25 | app.installTranslator(&myappTranslator); 26 | 27 | MainWindow w; 28 | w.showMaximized(); 29 | 30 | if (argc==2) 31 | { 32 | w.load_file(string(argv[1])); 33 | } 34 | 35 | return app.exec(); 36 | } 37 | -------------------------------------------------------------------------------- /samples/eyepieces/Huygens.astree: -------------------------------------------------------------------------------- 1 | 0.diameter=100 2 | 0.radius_curvature=1000 3 | 0.thick=500 4 | 0.type=perfect_lens 5 | 1.diameter=0 6 | 1.diameter.auto=1 7 | 1.radius_curvature=inf 8 | 1.thick=-5.8 9 | 1.type=void 10 | 2.diameter=15 11 | 2.radius_curvature=18 12 | 2.thick=3 13 | 2.type=BK7 14 | 3.diameter=15 15 | 3.radius_curvature=inf 16 | 3.thick=20 17 | 3.type=Air 18 | 4.diameter=10 19 | 4.radius_curvature=9 20 | 4.thick=2 21 | 4.type=BK7 22 | 5.diameter=10 23 | 5.radius_curvature=inf 24 | 5.thick=3.1 25 | 5.type=Air 26 | 6.diameter=6.267250588 27 | 6.diameter.auto=1 28 | 6.radius_curvature=inf 29 | 6.thick=0 30 | 6.type=image_infinite 31 | device.note=Huygens eyepiece 32 | device.note= 33 | device.note=frome the website: 34 | device.note= 35 | device.note=http://www.telescope-optics.net/appendix4.htm 36 | device.relative_convention=1 37 | image.autocurvature=0 38 | image.autofocus=0 39 | light.colors=Red.YellowBlack.Yellow.Green.Blue. 40 | light.half_field_of_view=0.8 41 | light.nbsteps=3 42 | note=Huygens eyepiece 43 | note= 44 | note=frome the website: 45 | note= 46 | note=http://www.telescope-optics.net/appendix4.htm 47 | -------------------------------------------------------------------------------- /src/DockOptimizer.h: -------------------------------------------------------------------------------- 1 | #ifndef DOCKOPTIMIZER_H 2 | #define DOCKOPTIMIZER_H 3 | 4 | #include 5 | 6 | #include "DeviceOptimizer.h" 7 | 8 | namespace Ui { 9 | class DockOptimizer; 10 | } 11 | 12 | class QTableWidgetItem; 13 | 14 | class OpticalDevice; 15 | 16 | class DockOptimizer : public QDockWidget 17 | { 18 | Q_OBJECT 19 | 20 | public: 21 | explicit DockOptimizer(QWidget *parent = 0); 22 | ~DockOptimizer(); 23 | 24 | void device_changed(OpticalDevice *pDevice, int iReason); 25 | 26 | private slots: 27 | void on_pushButton_clicked(); 28 | void on_twParams_cellChanged(int row, int column); 29 | void on_cbCriteria_currentTextChanged(const QString &arg1); 30 | void tableChanged(); 31 | 32 | void on_cbMethod_currentIndexChanged(int index); 33 | 34 | void on_pushButton_2_clicked(); 35 | 36 | void on_leMinVignetting_editingFinished(); 37 | 38 | private: 39 | void optimize(bool bModeRefine); 40 | 41 | Ui::DockOptimizer *ui; 42 | OpticalDevice* _pDevice; 43 | int _iNbSurfaces; 44 | bool _bBlockSignals; 45 | }; 46 | 47 | #endif // DOCKOPTIMIZER_H 48 | -------------------------------------------------------------------------------- /src/DockLightProperties.h: -------------------------------------------------------------------------------- 1 | // this file is covered by the General Public License version 2 or later 2 | // please see GPL.html for more details and licensing issues 3 | // copyright Etienne de Foras ( the author ) mailto: etienne.deforas@gmail.com 4 | 5 | #ifndef DOCKLIGHTPROPERTIES_H 6 | #define DOCKLIGHTPROPERTIES_H 7 | 8 | #include 9 | 10 | class OpticalDevice; 11 | 12 | namespace Ui 13 | { 14 | class DockLightProperties; 15 | } 16 | 17 | class DockLightProperties : public QDockWidget 18 | { 19 | Q_OBJECT 20 | Q_DISABLE_COPY(DockLightProperties) 21 | public: 22 | explicit DockLightProperties(QWidget *parent = 0); 23 | virtual ~DockLightProperties(); 24 | 25 | void device_changed(OpticalDevice* pDevice, int iReason); 26 | 27 | public slots: 28 | void OnLightChange(); 29 | 30 | protected: 31 | virtual void changeEvent(QEvent *e); 32 | 33 | private slots: 34 | void on_spNbAngles_valueChanged(int arg1); 35 | 36 | private: 37 | Ui::DockLightProperties *m_ui; 38 | OpticalDevice* _pDevice; 39 | bool _bBlockSignals; 40 | }; 41 | 42 | #endif // DOCKLIGHTPROPERTIES_H 43 | -------------------------------------------------------------------------------- /src/MaterialUnknow.cpp: -------------------------------------------------------------------------------- 1 | // this file is covered by the General Public License version 2 or later 2 | // please see GPL.html for more details and licensing issues 3 | // copyright Etienne de Foras ( the author ) mailto: etienne.deforas@gmail.com 4 | 5 | #include "MaterialUnknow.h" 6 | 7 | ////////////////////////////////////////////////////////////////////////////// 8 | MaterialUnknow::MaterialUnknow() 9 | { 10 | _sName="Unknow"; 11 | _sFormula="Unknow"; 12 | _iSolidColor=0xf0f0f0; 13 | } 14 | ////////////////////////////////////////////////////////////////////////////// 15 | MaterialUnknow::MaterialUnknow(const MaterialUnknow& m): Glass(m) 16 | { } 17 | ////////////////////////////////////////////////////////////////////////////// 18 | Glass* MaterialUnknow::clone() const 19 | { 20 | return new MaterialUnknow(*this); 21 | } 22 | ////////////////////////////////////////////////////////////////////////////// 23 | double MaterialUnknow::calc_index(double dLambdaMicrons) 24 | { 25 | (void)dLambdaMicrons; 26 | return 1.; 27 | } 28 | ////////////////////////////////////////////////////////////////////////////// 29 | -------------------------------------------------------------------------------- /src/Astree.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.28307.757 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Astree", "Astree.vcxproj", "{8CEE3939-7E98-3B3E-9BA8-DB91B29818E3}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Release|x64 = Release|x64 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {8CEE3939-7E98-3B3E-9BA8-DB91B29818E3}.Debug|x64.ActiveCfg = Debug|x64 15 | {8CEE3939-7E98-3B3E-9BA8-DB91B29818E3}.Debug|x64.Build.0 = Debug|x64 16 | {8CEE3939-7E98-3B3E-9BA8-DB91B29818E3}.Release|x64.ActiveCfg = Release|x64 17 | {8CEE3939-7E98-3B3E-9BA8-DB91B29818E3}.Release|x64.Build.0 = Release|x64 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {8F18B84B-CF2A-4C43-96ED-31098B1073B1} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /src/MaterialWater.cpp: -------------------------------------------------------------------------------- 1 | // this file is covered by the General Public License version 2 or later 2 | // please see GPL.html for more details and licensing issues 3 | // copyright Etienne de Foras ( the author ) mailto: etienne.deforas@gmail.com 4 | 5 | #include "MaterialWater.h" 6 | 7 | ////////////////////////////////////////////////////////////////////////////// 8 | MaterialWater::MaterialWater() 9 | { 10 | _sName="Water"; 11 | _sFormula="Constant"; 12 | set_maker("internal"); 13 | _iSolidColor=0xf0f0f0; 14 | } 15 | ////////////////////////////////////////////////////////////////////////////// 16 | MaterialWater::MaterialWater(const MaterialWater& m): Glass(m) 17 | { } 18 | ////////////////////////////////////////////////////////////////////////////// 19 | Glass* MaterialWater::clone() const 20 | { 21 | return new MaterialWater(*this); 22 | } 23 | ////////////////////////////////////////////////////////////////////////////// 24 | double MaterialWater::calc_index(double dLambdaMicrons) 25 | { 26 | (void)dLambdaMicrons; 27 | return 1.333; 28 | } 29 | ////////////////////////////////////////////////////////////////////////////// 30 | -------------------------------------------------------------------------------- /src/MaterialVacuum.cpp: -------------------------------------------------------------------------------- 1 | // this file is covered by the General Public License version 2 or later 2 | // please see GPL.html for more details and licensing issues 3 | // copyright Etienne de Foras ( the author ) mailto: etienne.deforas@gmail.com 4 | 5 | #include "MaterialVacuum.h" 6 | 7 | ////////////////////////////////////////////////////////////////////////////// 8 | MaterialVacuum::MaterialVacuum() 9 | { 10 | _sName="Vacuum"; 11 | _sFormula="Constant"; 12 | set_maker("internal"); 13 | _iSolidColor=0xf0f0f0; 14 | } 15 | ////////////////////////////////////////////////////////////////////////////// 16 | MaterialVacuum::MaterialVacuum(const MaterialVacuum& m): Glass(m) 17 | { } 18 | ////////////////////////////////////////////////////////////////////////////// 19 | Glass* MaterialVacuum::clone() const 20 | { 21 | return new MaterialVacuum(*this); 22 | } 23 | ////////////////////////////////////////////////////////////////////////////// 24 | double MaterialVacuum::calc_index(double dLambdaMicrons) 25 | { 26 | (void)dLambdaMicrons; 27 | return 1.; 28 | } 29 | ////////////////////////////////////////////////////////////////////////////// 30 | -------------------------------------------------------------------------------- /samples/refractors/Fraunhofer_155_F15.astree: -------------------------------------------------------------------------------- 1 | 0.diameter=150 2 | 0.radius_curvature=1370 3 | 0.thick=14 4 | 0.type=BK7 5 | 1.diameter=150 6 | 1.radius_curvature=-800.6 7 | 1.thick=0.053 8 | 1.type=Air 9 | 2.diameter=150 10 | 2.radius_curvature=-810.6 11 | 2.thick=10.3 12 | 2.type=F2 13 | 3.diameter=150 14 | 3.radius_curvature=-3320 15 | 3.thick=2242.763281 16 | 3.type=Air 17 | 4.diameter=32.32265894 18 | 4.diameter.auto=1 19 | 4.radius_curvature=inf 20 | 4.thick=0 21 | 4.type=image 22 | 4.z.autofocus=1 23 | device.note=Fraunhofer refractor from: 24 | device.note= 25 | device.note=http://bobmay.astronomy.net/refractor/Refrdesign.htm 26 | device.note= 27 | device.note=Diameter is 150 mm, F-ratio is 15 28 | device.note= 29 | device.note=The website explain how to build it 30 | device.relative_convention=1 31 | image.autocurvature=0 32 | image.autofocus=1 33 | light.colors=Red.YellowBlack.Yellow.Green.Blue. 34 | light.half_field_of_view=0.41 35 | light.nbsteps=3 36 | note=Fraunhofer refractor from: 37 | note= 38 | note=http://bobmay.astronomy.net/refractor/Refrdesign.htm 39 | note= 40 | note=Diameter is 150 mm, F-ratio is 15 41 | note= 42 | note=The website explain how to build it 43 | -------------------------------------------------------------------------------- /src/FrameSideView.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | FrameSideView 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 300 11 | 12 | 13 | 14 | 15 | 400 16 | 300 17 | 18 | 19 | 20 | Frame 21 | 22 | 23 | QFrame::StyledPanel 24 | 25 | 26 | QFrame::Raised 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | MyViewFrame 37 | QGraphicsView 38 |
MyViewFrame.h
39 |
40 |
41 | 42 | 43 |
44 | -------------------------------------------------------------------------------- /src/DockScatterPlot.h: -------------------------------------------------------------------------------- 1 | // this file is covered by the General Public License version 2 or later 2 | // please see GPL.html for more details and licensing issues 3 | // copyright Etienne de Foras ( the author ) mailto: etienne.deforas@gmail.com 4 | 5 | #ifndef DOCKSCATTERPLOT_H 6 | #define DOCKSCATTERPLOT_H 7 | 8 | #include 9 | 10 | namespace Ui 11 | { 12 | class DockScatterPlot; 13 | } 14 | 15 | class OpticalDevice; 16 | 17 | class DockScatterPlot : public QDockWidget 18 | { 19 | Q_OBJECT 20 | Q_DISABLE_COPY(DockScatterPlot) 21 | public: 22 | explicit DockScatterPlot(QWidget *parent = 0); 23 | virtual ~DockScatterPlot(); 24 | 25 | void device_changed(OpticalDevice *pDevice, int iReason); 26 | 27 | protected: 28 | virtual void changeEvent(QEvent *e); 29 | 30 | private slots: 31 | void on_pushButton_clicked(); 32 | 33 | void on_pushButton_2_clicked(); 34 | 35 | void on_pushButton_3_clicked(); 36 | 37 | void on_hsImageFieldPos_valueChanged(int value); 38 | 39 | private: 40 | Ui::DockScatterPlot *m_ui; 41 | OpticalDevice* _pDevice; 42 | bool _bBlockSignals; 43 | 44 | static void enlarge(QRectF& r,double dRatio); 45 | }; 46 | 47 | #endif // DOCKSCATTERPLOT_H 48 | -------------------------------------------------------------------------------- /src/Glass.h: -------------------------------------------------------------------------------- 1 | // this file is covered by the General Public License version 2 or later 2 | // please see GPL.html for more details and licensing issues 3 | // copyright Etienne de Foras ( the author ) mailto: etienne.deforas@gmail.com 4 | 5 | #ifndef Glass_ 6 | #define Glass_ 7 | 8 | #include 9 | using namespace std; 10 | 11 | class Glass 12 | { 13 | public: 14 | Glass(); 15 | Glass(const Glass& m); 16 | 17 | virtual Glass* clone() const =0; 18 | virtual ~Glass(); 19 | 20 | double index(double dLambdaMicrons); 21 | int solid_color() const; 22 | void set_solid_color(int iSolidColor); 23 | 24 | string maker() const; 25 | void set_maker(string sMaker); 26 | 27 | string name() const; 28 | void set_name(string sName); 29 | 30 | string formula() const; 31 | void set_formula(string sFormula); 32 | 33 | void compute_NdVd(double &Nd,double& Vd); 34 | void compute_NeVe(double &Ne,double& Ve); 35 | 36 | protected: 37 | virtual double calc_index(double dLambdaMicrons)=0; 38 | 39 | string _sMaker; 40 | string _sName; 41 | string _sFormula; 42 | int _iSolidColor; 43 | 44 | private: 45 | double _dLastLambda; 46 | double _dLastIndex; 47 | }; 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /samples/eyepieces/Monocentric.astree: -------------------------------------------------------------------------------- 1 | 0.diameter=100 2 | 0.radius_curvature=1000 3 | 0.thick=500 4 | 0.type=perfect_lens 5 | 1.diameter=0 6 | 1.diameter.auto=1 7 | 1.radius_curvature=inf 8 | 1.thick=8.3 9 | 1.type=void 10 | 2.diameter=12 11 | 2.radius_curvature=11.6 12 | 2.thick=6.3 13 | 2.type=F2 14 | 3.diameter=9.5 15 | 3.radius_curvature=5.3 16 | 3.thick=10.6 17 | 3.type=BK7 18 | 4.diameter=9.5 19 | 4.radius_curvature=-5.3 20 | 4.radius_curvature.clone=3 21 | 4.radius_curvature.clone.gain=-1 22 | 4.thick=6.3 23 | 4.type=F2 24 | 5.diameter=9.5 25 | 5.radius_curvature=-11.6 26 | 5.radius_curvature.clone=2 27 | 5.radius_curvature.clone.gain=-1 28 | 5.thick=9 29 | 5.type=Air 30 | 6.diameter=4.61319115 31 | 6.diameter.auto=1 32 | 6.radius_curvature=inf 33 | 6.thick=0 34 | 6.type=image_infinite 35 | device.note=Huygens eyepiece 36 | device.note= 37 | device.note=frome the website: 38 | device.note= 39 | device.note=http://www.telescope-optics.net/appendix4.htm 40 | device.relative_convention=1 41 | image.autocurvature=0 42 | image.autofocus=0 43 | light.colors=Red.YellowBlack.Yellow.Green.Blue. 44 | light.half_field_of_view=0.5 45 | light.nbsteps=3 46 | note=Huygens eyepiece 47 | note= 48 | note=frome the website: 49 | note= 50 | note=http://www.telescope-optics.net/appendix4.htm 51 | -------------------------------------------------------------------------------- /samples/eyepieces/Ramsden.astree: -------------------------------------------------------------------------------- 1 | 0.diameter=100 2 | 0.radius_curvature=1000 3 | 0.thick=500 4 | 0.type=perfect_lens 5 | 1.diameter=0 6 | 1.diameter.auto=1 7 | 1.radius_curvature=inf 8 | 1.thick=4 9 | 1.type=void 10 | 2.diameter=16 11 | 2.radius_curvature=inf 12 | 2.thick=4 13 | 2.type=BK7 14 | 3.diameter=16 15 | 3.radius_curvature=-14 16 | 3.thick=18 17 | 3.type=Air 18 | 4.diameter=10 19 | 4.radius_curvature=14 20 | 4.radius_curvature.clone=3 21 | 4.radius_curvature.clone.gain=-1 22 | 4.thick=2.5 23 | 4.type=BK7 24 | 5.diameter=10 25 | 5.radius_curvature=inf 26 | 5.thick=8 27 | 5.type=Air 28 | 6.diameter=10.60445316 29 | 6.diameter.auto=1 30 | 6.radius_curvature=inf 31 | 6.thick=0 32 | 6.type=image_infinite 33 | device.note=Ramsden eyepiece 34 | device.note= 35 | device.note=frome the website: 36 | device.note= 37 | device.note=http://www.telescope-optics.net/appendix4.htm 38 | device.note= 39 | device.note=unoptimized design 40 | device.relative_convention=1 41 | image.autocurvature=0 42 | image.autofocus=0 43 | light.colors=Red.YellowBlack.Yellow.Green.Blue. 44 | light.half_field_of_view=0.8 45 | light.nbsteps=3 46 | note=Ramsden eyepiece 47 | note= 48 | note=frome the website: 49 | note= 50 | note=http://www.telescope-optics.net/appendix4.htm 51 | note= 52 | note=unoptimized design 53 | -------------------------------------------------------------------------------- /samples/telescopes/Gregory_400.astree: -------------------------------------------------------------------------------- 1 | 0.conic=-1 2 | 0.diameter=400 3 | 0.inner_diameter=100 4 | 0.radius_curvature=-2109.89011 5 | 0.type=reflect 6 | 0.z=-0 7 | 1.conic=-0.5136111111 8 | 1.diameter=106.7922197 9 | 1.diameter.auto=1 10 | 1.radius_curvature=452.7472527 11 | 1.type=reflect 12 | 1.z=-1318.681319 13 | 2.diameter=33.5103607 14 | 2.diameter.auto=1 15 | 2.radius_curvature=276.4944774 16 | 2.type=image 17 | 2.z=279.2501506 18 | 2.z.autofocus=1 19 | device.note=sample Gregory 20 | device.note= 21 | device.note=Primary is parabolical 22 | device.note=Image field is curved 23 | device.note= 24 | device.note=F# is big 25 | device.relative_convention=0 26 | image.autocurvature=1 27 | image.autofocus=1 28 | light.colors=YellowBlack. 29 | light.half_field_of_view=0.15 30 | light.nbsteps=3 31 | note=sample Gregory 32 | note= 33 | note=Primary is parabolical 34 | note=Image field is curved 35 | note= 36 | note=F# is big 37 | parameter.optimizer.0.checked=0 38 | parameter.optimizer.1.checked=0 39 | parameter.optimizer.2.checked=0 40 | parameter.optimizer.3.checked=0 41 | parameter.optimizer.4.checked=0 42 | parameter.optimizer.5.checked=0 43 | parameter.optimizer.6.checked=0 44 | parameter.optimizer.7.checked=0 45 | parameter.optimizer.8.checked=0 46 | parameter.optimizer.9.checked=0 47 | parameter.showLightOffAxis=100 48 | -------------------------------------------------------------------------------- /samples/telescopes/TMT.astree: -------------------------------------------------------------------------------- 1 | 0.conic=-1.0009535 2 | 0.diameter=30000 3 | 0.radius_curvature=-60000 4 | 0.thick=-27093.75 5 | 0.type=reflect 6 | 1.conic=-1.31822813 7 | 1.diameter=3024.5 8 | 1.radius_curvature=-6227.6786 9 | 1.thick=43593.75483 10 | 1.type=reflect 11 | 2.diameter=2576.772891 12 | 2.diameter.auto=1 13 | 2.radius_curvature=-3009.2 14 | 2.thick=0 15 | 2.type=image 16 | 2.z.autofocus=1 17 | device.convention=relative 18 | device.note=TMT telescope: 19 | device.note= 20 | device.note=Diameter=30m 21 | device.note=Focal=450m 22 | device.note= 23 | device.note=from the document 24 | device.note=TMT-Construction-Proposal-Public.pdf 25 | device.note=(chapter 7.2) 26 | device.note= 27 | device.note=Ritchey-Chretien design 28 | device.note= 29 | device.note=Tertiary flat removed 30 | device.note= 31 | device.relative_convention=1 32 | half_field_of_view=0.165 33 | image.autocurvature=0 34 | image.autofocus=1 35 | light.colors=YellowBlack. 36 | light.half_field_of_view=0.165 37 | light.nbsteps=3 38 | note=TMT telescope: 39 | note= 40 | note=Diameter=30m 41 | note=Focal=450m 42 | note= 43 | note=from the document 44 | note=TMT-Construction-Proposal-Public.pdf 45 | note=(chapter 7.2) 46 | note= 47 | note=Ritchey-Chretien design 48 | note= 49 | note=Tertiary flat removed 50 | note= 51 | parameter.showLightOffAxis=0 52 | -------------------------------------------------------------------------------- /samples/telescopes/Cassegrain__field_corrector.astree: -------------------------------------------------------------------------------- 1 | 0.conic=-1 2 | 0.diameter=200 3 | 0.radius_curvature=-942.21 4 | 0.type=reflect 5 | 0.z=0 6 | 1.diameter=90 7 | 1.radius_curvature=-942.9 8 | 1.type=reflect 9 | 1.z=-279.37 10 | 2.diameter=53 11 | 2.radius_curvature=175.9 12 | 2.type=Silica 13 | 2.z=-102.17 14 | 3.diameter=53 15 | 3.radius_curvature=87.6 16 | 3.type=Air 17 | 3.z=-98.67 18 | 4.diameter=53 19 | 4.radius_curvature=-641.5 20 | 4.type=Silica 21 | 4.z=-93.76 22 | 5.diameter=53 23 | 5.radius_curvature=-134.1 24 | 5.type=Air 25 | 5.z=-87.76 26 | 6.diameter=30 27 | 6.radius_curvature=inf 28 | 6.type=image 29 | 6.z=49.09390358 30 | 6.z.autofocus=1 31 | device.note=from the book: 32 | device.note= 33 | device.note=handbook of optics Volume 2 34 | device.note= 35 | device.note=Chapter18 : reflective and catadioptric objectives 36 | device.note=section 7 37 | device.note= 38 | device.note=All surfaces except primary are spherical 39 | device.relative_convention=0 40 | image.autocurvature=0 41 | image.autofocus=1 42 | light.colors=Red.Yellow.Green.Blue. 43 | light.half_field_of_view=1 44 | light.nbsteps=3 45 | note=from the book: 46 | note= 47 | note=handbook of optics Volume 2 48 | note= 49 | note=Chapter18 : reflective and catadioptric objectives 50 | note=section 7 51 | note= 52 | note=All surfaces except primary are spherical 53 | parameter.showLightOffAxis=100 54 | -------------------------------------------------------------------------------- /src/MaterialAir.cpp: -------------------------------------------------------------------------------- 1 | // this file is covered by the General Public License version 2 or later 2 | // please see GPL.html for more details and licensing issues 3 | // copyright Etienne de Foras ( the author ) mailto: etienne.deforas@gmail.com 4 | 5 | #include "MaterialAir.h" 6 | 7 | ////////////////////////////////////////////////////////////////////////////// 8 | MaterialAir::MaterialAir() 9 | { 10 | _sName="Air"; 11 | _sFormula="Custom"; 12 | set_maker("internal"); 13 | _iSolidColor=0xffffff; 14 | } 15 | ////////////////////////////////////////////////////////////////////////////// 16 | MaterialAir::MaterialAir(const MaterialAir& m): Glass(m) 17 | { } 18 | ////////////////////////////////////////////////////////////////////////////// 19 | Glass* MaterialAir::clone() const 20 | { 21 | return new MaterialAir(*this); 22 | } 23 | ////////////////////////////////////////////////////////////////////////////// 24 | double MaterialAir::calc_index(double dLambdaMicrons) 25 | { 26 | double sigma2=1./(dLambdaMicrons*dLambdaMicrons); //dLambda in microns 27 | return 1. + 6.4328e-5 + 2.94981e-2/(146.-sigma2) + 2.554e-4/(41.- sigma2); 28 | 29 | //source : http://olivier.fournet.free.fr/science_et_physique/refraction_air.htm 30 | // with 0.03% de CO2 , 101325 Pa , T= 288.15 K 31 | } 32 | ////////////////////////////////////////////////////////////////////////////// 33 | -------------------------------------------------------------------------------- /src/Util/Properties.h: -------------------------------------------------------------------------------- 1 | #ifndef _Properties_ 2 | #define _Properties_ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | using namespace std; 9 | 10 | /** 11 | Simple association (dictionnary key-values ) class 12 | 13 | Handle creation, loading and saving from files, adding and testing keys. 14 | 15 | @author Etienne de Foras 16 | @version 1.01 17 | */ 18 | class Properties 19 | { 20 | 21 | public: 22 | Properties(); 23 | 24 | bool save(string sFileName) const; 25 | bool load(string sFileName); 26 | 27 | void set(string sKey, string sValue); 28 | void set(string sKey, int iValue); 29 | void set(string sKey, unsigned int uiValue); 30 | void set(string sKey, long lValue); 31 | void set(string sKey, bool bValue); 32 | void set(string sKey, double dValue); 33 | void set(string sKey, const vector& vdValue); 34 | 35 | bool exist(string sKey) const; 36 | void remove(string sKey); 37 | 38 | string get(string sKey) const; 39 | int get_int(string sKey) const; 40 | unsigned int get_unsigned_int(string sKey) const; 41 | long get_long(string sKey) const; 42 | bool get_bool(string sKey) const; 43 | double get_double(string sKey) const; 44 | vector get_vector_double(string sKey) const; 45 | 46 | const map& all() const; 47 | private: 48 | map _pairs; 49 | }; 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /samples/telescopes/PaulBacker_flat.astree: -------------------------------------------------------------------------------- 1 | 0.conic=-1 2 | 0.diameter=200 3 | 0.inner_diameter=70 4 | 0.radius_curvature=-1250 5 | 0.thick=-434 6 | 0.type=reflect 7 | 1.conic=-0.6651 8 | 1.diameter=70 9 | 1.radius_curvature=-381.94 10 | 1.thick=550 11 | 1.type=reflect 12 | 2.diameter=110 13 | 2.radius_curvature=-550 14 | 2.thick=-275.0570547 15 | 2.type=reflect 16 | 3.diameter=30 17 | 3.radius_curvature=inf 18 | 3.thick=0 19 | 3.type=image 20 | 3.z.autofocus=1 21 | device.convention=relative 22 | device.note=Paul backer telescope (flat version) as described at: 23 | device.note= 24 | device.note=http://www.telescope-optics.net/paul-baker_telescope.htm 25 | device.note= 26 | device.note=Primary is parabolic 27 | device.note=Secondary is elliptic 28 | device.note=Tertiary is spherical. 29 | device.note=Image field is flat 30 | device.note= 31 | device.note=Image field is accessible with a diagonal flat 32 | device.relative_convention=1 33 | half_field_of_view=0.8 34 | image.autocurvature=0 35 | image.autofocus=1 36 | light.colors=YellowBlack. 37 | light.half_field_of_view=0.8 38 | light.nbsteps=3 39 | note=Paul backer telescope (flat version) as described at: 40 | note= 41 | note=http://www.telescope-optics.net/paul-baker_telescope.htm 42 | note= 43 | note=Primary is parabolic 44 | note=Secondary is elliptic 45 | note=Tertiary is spherical. 46 | note=Image field is flat 47 | note= 48 | note=Image field is accessible with a diagonal flat 49 | -------------------------------------------------------------------------------- /samples/telescopes/Gregory_3Reflexions_2mirrors.astree: -------------------------------------------------------------------------------- 1 | 0.conic=-0.428 2 | 0.diameter=200 3 | 0.inner_diameter=90 4 | 0.radius_curvature=-1474 5 | 0.thick=-1069 6 | 0.type=reflect 7 | 1.conic=-6.55 8 | 1.diameter=100 9 | 1.inner_diameter=30 10 | 1.radius_curvature=1044 11 | 1.thick=1069 12 | 1.thick.clone=0 13 | 1.thick.clone.gain=-1 14 | 1.type=reflect 15 | 2.conic=-0.428 16 | 2.conic.clone=0 17 | 2.diameter=200 18 | 2.inner_diameter=90 19 | 2.radius_curvature=-1474 20 | 2.radius_curvature.clone=0 21 | 2.radius_curvature.clone.gain=1 22 | 2.thick=-1173.550898 23 | 2.type=reflect 24 | 3.diameter=20.93958896 25 | 3.diameter.auto=1 26 | 3.radius_curvature=-215 27 | 3.thick=0 28 | 3.type=image 29 | 3.z.autofocus=1 30 | device.note=from http://www.telescope-optics.net 31 | device.note= 32 | device.note=chapter 8.2.5 33 | device.note= 34 | device.note=2 mirror, 3 reflexions telescope : primary is used twice. 35 | device.note= 36 | device.note=Image is excellent over full field, but obstruction is big. 37 | device.note= 38 | device.note=Image field is curved. 39 | device.relative_convention=1 40 | image.autocurvature=0 41 | image.autofocus=1 42 | light.colors= 43 | light.half_field_of_view=0.5 44 | light.nbsteps=3 45 | note=from http://www.telescope-optics.net 46 | note= 47 | note=chapter 8.2.5 48 | note= 49 | note=2 mirror, 3 reflexions telescope : primary is used twice. 50 | note= 51 | note=Image is excellent over full field, but obstruction is big. 52 | note= 53 | note=Image field is curved. 54 | parameter.showLightOffAxis=0 55 | -------------------------------------------------------------------------------- /samples/telescopes/PaulBacker.astree: -------------------------------------------------------------------------------- 1 | 0.conic=-1 2 | 0.diameter=200 3 | 0.radius_curvature=-1200 4 | 0.type=reflect 5 | 0.z=0 6 | 1.diameter=60 7 | 1.radius_curvature=-300 8 | 1.type=reflect 9 | 1.z=-450 10 | 2.diameter=80 11 | 2.radius_curvature=-300 12 | 2.type=reflect 13 | 2.z=-150 14 | 3.diameter=31.59414117 15 | 3.diameter.auto=1 16 | 3.radius_curvature=-600 17 | 3.type=image 18 | 3.z=-299.9926662 19 | 3.z.autofocus=1 20 | device.note=Paul backer telescope as described at: 21 | device.note= 22 | device.note=http://www.telescope-optics.net/paul-baker_telescope.htm 23 | device.note= 24 | device.note= 25 | device.note=Primary is parabolic, secondary and tertiary are spherical. 26 | device.note= 27 | device.note=Secondary and tertiary have the same radii of curvature. 28 | device.note= 29 | device.note=Image field is curved in this configuration. 30 | device.note= 31 | device.note=It is not possible to use eyepieces in this configuration 32 | device.relative_convention=0 33 | image.autocurvature=0 34 | image.autofocus=1 35 | light.colors=YellowBlack. 36 | light.half_field_of_view=1.5 37 | light.nbsteps=3 38 | note=Paul backer telescope as described at: 39 | note= 40 | note=http://www.telescope-optics.net/paul-baker_telescope.htm 41 | note= 42 | note= 43 | note=Primary is parabolic, secondary and tertiary are spherical. 44 | note= 45 | note=Secondary and tertiary have the same radii of curvature. 46 | note= 47 | note=Image field is curved in this configuration. 48 | note= 49 | note=It is not possible to use eyepieces in this configuration 50 | -------------------------------------------------------------------------------- /samples/telescopes/EisenburgPearson.astree: -------------------------------------------------------------------------------- 1 | 0.conic=-1.05 2 | 0.diameter=200 3 | 0.radius_curvature=-480 4 | 0.thick=-172.89 5 | 0.type=reflect 6 | 1.conic=-1.539 7 | 1.diameter=59.4095874 8 | 1.diameter.auto=1 9 | 1.inner_diameter=17 10 | 1.radius_curvature=-144.72 11 | 1.thick=172.89 12 | 1.thick.clone=0 13 | 1.thick.clone.gain=-1 14 | 1.type=reflect 15 | 2.conic=-1.05 16 | 2.conic.clone=0 17 | 2.diameter=59.01024322 18 | 2.diameter.auto=1 19 | 2.radius_curvature=-480 20 | 2.radius_curvature.clone=0 21 | 2.radius_curvature.clone.gain=1 22 | 2.thick=-181.9496569 23 | 2.type=reflect 24 | 3.diameter=13.97887315 25 | 3.diameter.auto=1 26 | 3.radius_curvature=122.442164 27 | 3.thick=0 28 | 3.type=image 29 | 3.z.autofocus=1 30 | device.note=from the book: 31 | device.note= 32 | device.note=Handbook of optics Volume 2 33 | device.note= 34 | device.note=chapter18 35 | device.note= 36 | device.note=43. 2 mirror, 3 reflexions telescope : primary is used twice. 37 | device.note= 38 | device.note=Image field is strongly curved. 39 | device.note= 40 | device.note=Units are converted to mm 41 | device.relative_convention=1 42 | image.autocurvature=1 43 | image.autofocus=1 44 | light.colors= 45 | light.half_field_of_view=0.5 46 | light.nbsteps=3 47 | note=from the book: 48 | note= 49 | note=Handbook of optics Volume 2 50 | note= 51 | note=chapter18 52 | note= 53 | note=43. 2 mirror, 3 reflexions telescope : primary is used twice. 54 | note= 55 | note=Image field is strongly curved. 56 | note= 57 | note=Units are converted to mm 58 | parameter.showLightOffAxis=0 59 | -------------------------------------------------------------------------------- /samples/telescopes/Hougton_asymetric.astree: -------------------------------------------------------------------------------- 1 | 0.diameter=200 2 | 0.inner_diameter=50 3 | 0.radius_curvature=1907 4 | 0.type=BK7 5 | 0.z=-1119 6 | 1.diameter=200 7 | 1.inner_diameter=50 8 | 1.inner_diameter.clone=0 9 | 1.inner_diameter.clone.gain=1 10 | 1.radius_curvature=-4348 11 | 1.type=Air 12 | 1.z=-1110 13 | 2.diameter=200 14 | 2.inner_diameter=50 15 | 2.inner_diameter.clone=0 16 | 2.inner_diameter.clone.gain=1 17 | 2.radius_curvature=-1907 18 | 2.radius_curvature.clone=0 19 | 2.radius_curvature.clone.gain=-1 20 | 2.type=BK7 21 | 2.z=-1107 22 | 3.diameter=200 23 | 3.inner_diameter=50 24 | 3.inner_diameter.clone=0 25 | 3.inner_diameter.clone.gain=1 26 | 3.radius_curvature=4348 27 | 3.radius_curvature.clone=1 28 | 3.radius_curvature.clone.gain=-1 29 | 3.type=Air 30 | 3.z=-1100 31 | 4.diameter=200 32 | 4.radius_curvature=-2400 33 | 4.type=reflect 34 | 4.z=-0 35 | 5.diameter=31.93978405 36 | 5.diameter.auto=1 37 | 5.radius_curvature=inf 38 | 5.type=image 39 | 5.z=-1198.636336 40 | device.note=The two glass window aperture are grinded one on the other, reducing time 41 | device.note= 42 | device.note=System is unoptimized 43 | device.note= 44 | device.note=Uses only spherical surfaces 45 | device.relative_convention=0 46 | image.autocurvature=0 47 | image.autofocus=0 48 | light.colors=Red.Yellow.Green.Blue. 49 | light.half_field_of_view=0.76 50 | light.nbsteps=3 51 | note=The two glass window aperture are grinded one on the other, reducing time 52 | note= 53 | note=System is unoptimized 54 | note= 55 | note=Uses only spherical surfaces 56 | parameter.showLightOffAxis=0 57 | -------------------------------------------------------------------------------- /samples/telescopes/Houghton_flat.astree: -------------------------------------------------------------------------------- 1 | 0.diameter=200 2 | 0.inner_diameter=50 3 | 0.radius_curvature=1840 4 | 0.thick=8 5 | 0.type=BK7 6 | 1.diameter=200 7 | 1.inner_diameter=50 8 | 1.inner_diameter.clone=0 9 | 1.inner_diameter.clone.gain=1 10 | 1.radius_curvature=inf 11 | 1.thick=5 12 | 1.type=Air 13 | 2.diameter=200 14 | 2.inner_diameter=50 15 | 2.inner_diameter.clone=0 16 | 2.inner_diameter.clone.gain=1 17 | 2.radius_curvature=-1840 18 | 2.radius_curvature.clone=0 19 | 2.radius_curvature.clone.gain=-1 20 | 2.thick=6 21 | 2.type=BK7 22 | 3.diameter=200 23 | 3.inner_diameter=50 24 | 3.inner_diameter.clone=0 25 | 3.inner_diameter.clone.gain=1 26 | 3.radius_curvature=inf 27 | 3.radius_curvature.clone=1 28 | 3.radius_curvature.clone.gain=1 29 | 3.thick=1100 30 | 3.type=Air 31 | 4.diameter=200 32 | 4.radius_curvature=-2400 33 | 4.thick=-1198.819621 34 | 4.type=reflect 35 | 5.diameter=31.92420402 36 | 5.diameter.auto=1 37 | 5.radius_curvature=inf 38 | 5.thick=0 39 | 5.type=image 40 | 5.z.autofocus=1 41 | device.note=The two glass window aperture are grinded one on the other, reducing time 42 | device.note= 43 | device.note=System is unoptimized 44 | device.note= 45 | device.note=Uses only spherical surfaces 46 | device.relative_convention=1 47 | image.autocurvature=0 48 | image.autofocus=1 49 | light.colors=Red.Yellow.Green.Blue. 50 | light.half_field_of_view=0.76 51 | light.nbsteps=3 52 | note=The two glass window aperture are grinded one on the other, reducing time 53 | note= 54 | note=System is unoptimized 55 | note= 56 | note=Uses only spherical surfaces 57 | parameter.showLightOffAxis=100 58 | -------------------------------------------------------------------------------- /src/DockCommentary.cpp: -------------------------------------------------------------------------------- 1 | #include "DockCommentary.h" 2 | #include "ui_DockCommentary.h" 3 | 4 | #include "MainWindow.h" 5 | #include "OpticalDevice.h" 6 | 7 | #include 8 | 9 | DockCommentary::DockCommentary(QWidget *parent) : 10 | QDockWidget(parent), 11 | ui(new Ui::DockComment) 12 | { 13 | _bBlockSignals=true; 14 | ui->setupUi(this); 15 | _bBlockSignals=false; 16 | } 17 | 18 | DockCommentary::~DockCommentary() 19 | { 20 | delete ui; 21 | } 22 | 23 | void DockCommentary::changeEvent(QEvent *e) 24 | { 25 | QDockWidget::changeEvent(e); 26 | switch (e->type()) { 27 | case QEvent::LanguageChange: 28 | ui->retranslateUi(this); 29 | break; 30 | default: 31 | break; 32 | } 33 | } 34 | //////////////////////////////////////////////////////////////////////// 35 | void DockCommentary::device_changed(OpticalDevice* pDevice,int iReason) 36 | { 37 | if(iReason!=NEW_OPTICAL_DEVICE) 38 | return; 39 | 40 | assert(pDevice!=0); 41 | _pDevice=pDevice; 42 | 43 | _bBlockSignals=true; 44 | ui->textEdit->setText(_pDevice->note().c_str()); 45 | _bBlockSignals=false; 46 | } 47 | //////////////////////////////////////////////////////////////////////// 48 | void DockCommentary::on_textEdit_textChanged() 49 | { 50 | if(_bBlockSignals) 51 | return; 52 | 53 | _pDevice->set_note(ui->textEdit->document()->toPlainText().toStdString()); 54 | static_cast(parent())->device_changed(this,COMMENT_CHANGED); 55 | } 56 | //////////////////////////////////////////////////////////////////////// 57 | -------------------------------------------------------------------------------- /src/Photon.cpp: -------------------------------------------------------------------------------- 1 | // this file is covered by the General Public License version 2 or later 2 | // please see GPL.html for more details and licensing issues 3 | // copyright Etienne de Foras ( the author ) mailto: etienne.deforas@gmail.com 4 | 5 | #include "Photon.h" 6 | #include 7 | #include 8 | using namespace std; 9 | 10 | //////////////////////////////////////////////////////////////////////////////// 11 | Photon::Photon() 12 | { 13 | x=0.; 14 | y=0.; 15 | z=0.; 16 | 17 | dx=0.; 18 | dy=0.; 19 | dz=0.; 20 | 21 | anglex=0.; 22 | angley=0.; 23 | 24 | _lambda=0.; 25 | 26 | valid=false; 27 | } 28 | //////////////////////////////////////////////////////////////////////////////// 29 | void Photon::set_lambda(double dLambda) 30 | { 31 | assert(dLambda>0.); 32 | _lambda=dLambda; 33 | } 34 | //////////////////////////////////////////////////////////////////////////////// 35 | double Photon::lambda() const 36 | { 37 | assert(_lambda>0.); 38 | return _lambda; 39 | } 40 | //////////////////////////////////////////////////////////////////////////////// 41 | bool Photon::is_valid() const 42 | { 43 | assert(!isnan(x)); 44 | assert(!isnan(y)); 45 | assert(!isnan(z)); 46 | assert(!isnan(dx)); 47 | assert(!isnan(dy)); 48 | assert(!isnan(dz)); 49 | 50 | assert(!isinf(x)); 51 | assert(!isinf(y)); 52 | assert(!isinf(z)); 53 | assert(!isinf(dx)); 54 | assert(!isinf(dy)); 55 | assert(!isinf(dz)); 56 | 57 | return valid; 58 | } 59 | //////////////////////////////////////////////////////////////////////////////// 60 | 61 | -------------------------------------------------------------------------------- /src/MyViewFrame.h: -------------------------------------------------------------------------------- 1 | // this file is covered by the General Public License version 2 or later 2 | // please see GPL.html for more details and licensing issues 3 | // copyright Etienne de Foras ( the author ) mailto: etienne.deforas@gmail.com 4 | 5 | #ifndef MyViewFrame_ 6 | #define MyViewFrame_ 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | class MyViewFrame : public QGraphicsView 14 | { 15 | public: 16 | MyViewFrame(QWidget *parent = 0):QGraphicsView(parent) 17 | { 18 | _pMW=0; 19 | setMouseTracking (true); 20 | setCursor(Qt::CrossCursor); 21 | setRenderHints( QPainter::Antialiasing ); 22 | } 23 | 24 | void mousePressEvent ( QMouseEvent * event ) 25 | { 26 | setDragMode(ScrollHandDrag); 27 | QGraphicsView::mousePressEvent(event); 28 | } 29 | 30 | void mouseReleaseEvent ( QMouseEvent * event ) 31 | { 32 | setDragMode(NoDrag ); 33 | QGraphicsView::mouseReleaseEvent(event); 34 | setCursor(Qt::CrossCursor); 35 | } 36 | 37 | void set_main_window(QMainWindow* pMW) 38 | { _pMW=pMW; } 39 | 40 | void mouseMoveEvent ( QMouseEvent * event ) 41 | { 42 | if(_pMW==0) 43 | return; 44 | 45 | QPointF pf=mapToScene(event->x(),event->y()); 46 | stringstream ss; 47 | ss << setprecision(5) << "Mouse Position(mm): x=" << 0 << " y=" << -pf.y() << " z=" << pf.x(); 48 | 49 | QStatusBar* ps=_pMW->statusBar(); 50 | ps->showMessage(ss.str().c_str()); 51 | 52 | QGraphicsView::mouseMoveEvent(event); 53 | } 54 | 55 | private: 56 | QMainWindow* _pMW; 57 | }; 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /samples/telescopes/Schmidt_meniscus_cassegrain.astree: -------------------------------------------------------------------------------- 1 | 0.diameter=200 2 | 0.radius_curvature=7877 3 | 0.thick=14 4 | 0.type=BK7 5 | 1.diameter=200 6 | 1.radius_curvature=inf 7 | 1.thick=326.9 8 | 1.type=Air 9 | 2.diameter=200 10 | 2.radius_curvature=-326.9 11 | 2.thick=26.2 12 | 2.type=BK7 13 | 3.diameter=210 14 | 3.radius_curvature=-356 15 | 3.thick=634.46 16 | 3.type=Air 17 | 4.diameter=240 18 | 4.radius_curvature=-819.7 19 | 4.thick=-217.8 20 | 4.type=reflect 21 | 5.diameter=130 22 | 5.radius_curvature=-795 23 | 5.thick=386.5149165 24 | 5.type=reflect 25 | 6.diameter=33.5777388 26 | 6.diameter.auto=1 27 | 6.radius_curvature=inf 28 | 6.thick=0 29 | 6.type=image 30 | 6.z.autofocus=1 31 | device.note=from OSA Handbook 32 | device.note=volume 2 chapter18 33 | device.note= 34 | device.note=All spherical surface, 4 degrees field of view. 35 | device.note= 36 | device.note=Only BK7 glass used 37 | device.note=Only spherical surfaces 38 | device.note=Image field is flat. 39 | device.note= 40 | device.note=Secondary obstruction is strong (62%) 41 | device.note=There is vignetting at the edge of the image plane 42 | device.note= 43 | device.note=Units are scaled to millimeters 44 | device.relative_convention=1 45 | image.autocurvature=0 46 | image.autofocus=1 47 | light.colors=Red.Yellow.Green.Blue. 48 | light.half_field_of_view=1.2 49 | light.nbsteps=3 50 | note=from OSA Handbook 51 | note=volume 2 chapter18 52 | note= 53 | note=All spherical surface, 4 degrees field of view. 54 | note= 55 | note=Only BK7 glass used 56 | note=Only spherical surfaces 57 | note=Image field is flat. 58 | note= 59 | note=Secondary obstruction is strong (62%) 60 | note=There is vignetting at the edge of the image plane 61 | note= 62 | note=Units are scaled to millimeters 63 | -------------------------------------------------------------------------------- /src/tests/test_newton.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | #include "OpticalDevice.h" 6 | 7 | ///////////////////////////////////////////////////////////////////// 8 | inline bool is_near(double a,double b, double tolerancis=1e-10) 9 | { 10 | return fabs(a-b) 9 | 10 | #include 11 | using namespace std; 12 | 13 | namespace Ui 14 | { 15 | class DockSurfacesData; 16 | } 17 | 18 | class OpticalDevice; 19 | 20 | class DockSurfacesData : public QDockWidget 21 | { 22 | Q_OBJECT 23 | Q_DISABLE_COPY(DockSurfacesData) 24 | 25 | public: 26 | 27 | explicit DockSurfacesData(QWidget *parent = 0); 28 | virtual ~DockSurfacesData(); 29 | 30 | void device_changed(OpticalDevice* pDevice, int iReason); 31 | int selected_surface() const; 32 | 33 | protected: 34 | virtual void changeEvent(QEvent *e); 35 | 36 | private slots: 37 | void onTypeChanged(); 38 | void on_cbPolyAspheric_clicked(); 39 | void on_cbInnerDiameter_clicked(); 40 | void on_cbComment_clicked(); 41 | void on_comboCoordMode_activated(const QString &arg1); 42 | 43 | void on_btnAddSurfaceBefore_clicked(); 44 | void on_btnAddSurfaceAfter_clicked(); 45 | void on_btnDeleteSurface_clicked(); 46 | 47 | void on_twSurfacesDatas_cellChanged(int row, int column); 48 | 49 | private: 50 | void update_labels(); 51 | void update_table(); 52 | 53 | Ui::DockSurfacesData* m_ui; 54 | OpticalDevice* _pOD; 55 | bool _bBlockSignals; 56 | 57 | bool _bHaveAspheric; 58 | bool _bDisplayAspheric; 59 | 60 | bool _bHaveInnerDiameter; 61 | bool _bDisplayInnerDiameter; 62 | 63 | bool _bHaveComment; 64 | bool _bDisplayComment; 65 | }; 66 | 67 | #endif // DOCKSURFACESDATA_H 68 | -------------------------------------------------------------------------------- /src/GlassSellmeier.cpp: -------------------------------------------------------------------------------- 1 | // this file is covered by the General Public License version 2 or later 2 | // please see GPL.html for more details and licensing issues 3 | // copyright Etienne de Foras ( the author ) mailto: etienne.deforas@gmail.com 4 | 5 | #include "GlassSellmeier.h" 6 | #include 7 | #include 8 | 9 | ////////////////////////////////////////////////////////////////////////////// 10 | GlassSellmeier::GlassSellmeier() 11 | { 12 | _sName="Sellmeier"; 13 | _sFormula="Sellmeier"; 14 | 15 | _dB1=0.; 16 | _dB2=0.; 17 | _dB3=0.; 18 | _dC1=0.; 19 | _dC2=0.; 20 | _dC3=0.; 21 | } 22 | ////////////////////////////////////////////////////////////////////////////// 23 | Glass* GlassSellmeier::clone() const 24 | { 25 | return new GlassSellmeier(*this); 26 | } 27 | ////////////////////////////////////////////////////////////////////////////// 28 | GlassSellmeier::GlassSellmeier(const GlassSellmeier& m): 29 | Glass(m) 30 | { 31 | assert(m._sFormula=="Sellmeier"); 32 | 33 | _dB1=m._dB1; 34 | _dB2=m._dB2; 35 | _dB3=m._dB3; 36 | _dC1=m._dC1; 37 | _dC2=m._dC2; 38 | _dC3=m._dC3; 39 | } 40 | ////////////////////////////////////////////////////////////////////////////// 41 | double GlassSellmeier::calc_index(double dLambdaMicrons) 42 | { 43 | //use the Selmeier formulae 44 | double l2=dLambdaMicrons*dLambdaMicrons; 45 | return sqrt( 1.+_dB1*l2/(l2-_dC1)+_dB2*l2/(l2-_dC2)+_dB3*l2/(l2-_dC3) ); 46 | } 47 | ////////////////////////////////////////////////////////////////////////////// 48 | void GlassSellmeier::set_coefs(double dB1,double dB2,double dB3,double dC1,double dC2,double dC3) 49 | { 50 | _dB1=dB1; 51 | _dB2=dB2; 52 | _dB3=dB3; 53 | _dC1=dC1; 54 | _dC2=dC2; 55 | _dC3=dC3; 56 | } 57 | ////////////////////////////////////////////////////////////////////////////// 58 | -------------------------------------------------------------------------------- /samples/telescopes/Meniscus_Sphere_Corrector.astree: -------------------------------------------------------------------------------- 1 | 0.diameter=200 2 | 0.radius_curvature=-2315.41806 3 | 0.thick=-883.9464883 4 | 0.type=reflect 5 | 1.diameter=71.72613603 6 | 1.diameter.auto=1 7 | 1.radius_curvature=103.0434783 8 | 1.thick=-24.5819398 9 | 1.type=BK7 10 | 2.diameter=75.55614933 11 | 2.diameter.auto=1 12 | 2.radius_curvature=108.361204 13 | 2.thick=-291.0465922 14 | 2.type=Air 15 | 3.diameter=32.00288569 16 | 3.diameter.auto=1 17 | 3.radius_curvature=138.4615385 18 | 3.thick=0 19 | 3.type=image 20 | 3.z.autofocus=1 21 | device.note=Primary is spherical 22 | device.note=Corrector is spherical 23 | device.note= 24 | device.note=From : http://www.telescope-optics.net/appendix2.htm#SUB-APERTURE_CATS 25 | device.note= 26 | device.note=rescaled to 200mm 27 | device.relative_convention=1 28 | image.autocurvature=0 29 | image.autofocus=1 30 | light.colors=Red.Yellow.Green.Blue. 31 | light.half_field_of_view=0.76 32 | light.nbsteps=3 33 | note=Primary is spherical 34 | note=Corrector is spherical 35 | note= 36 | note=From : http://www.telescope-optics.net/appendix2.htm#SUB-APERTURE_CATS 37 | note= 38 | note=rescaled to 200mm 39 | parameter.optimizer.0.checked=1 40 | parameter.optimizer.0.parameter=RCurv 41 | parameter.optimizer.0.surface=2 42 | parameter.optimizer.1.checked=1 43 | parameter.optimizer.1.parameter=RCurv 44 | parameter.optimizer.1.surface=3 45 | parameter.optimizer.2.checked=1 46 | parameter.optimizer.2.parameter=Thick 47 | parameter.optimizer.2.surface=2 48 | parameter.optimizer.3.checked=1 49 | parameter.optimizer.3.parameter=Thick 50 | parameter.optimizer.3.surface=1 51 | parameter.optimizer.4.checked=0 52 | parameter.optimizer.5.checked=0 53 | parameter.optimizer.6.checked=0 54 | parameter.optimizer.7.checked=0 55 | parameter.optimizer.8.checked=0 56 | parameter.optimizer.9.checked=0 57 | parameter.optimizer.merit=FullFrameMaxError 58 | parameter.showLightOffAxis=0 59 | -------------------------------------------------------------------------------- /samples/telescopes/E-ELT.astree: -------------------------------------------------------------------------------- 1 | 0.comment=inner diameter is approximative 2 | 0.conic=-0.992726 3 | 0.diameter=42000 4 | 0.inner_diameter=8000 5 | 0.radius_curvature=-84000 6 | 0.thick=-36200 7 | 0.type=reflect 8 | 1.conic=-2.307544 9 | 1.diameter=5985.58079 10 | 1.diameter.auto=1 11 | 1.radius_curvature=-14800 12 | 1.thick=42800 13 | 1.type=reflect 14 | 2.diameter=4272.470517 15 | 2.diameter.auto=1 16 | 2.r4=5.24685e-015 17 | 2.r6=1.80083e-024 18 | 2.radius_curvature=-24790 19 | 2.thick=-55309.68 20 | 2.type=reflect 21 | 3.diameter=1955.688367 22 | 3.diameter.auto=1 23 | 3.radius_curvature=33852.30467 24 | 3.thick=0 25 | 3.type=image 26 | device.convention=relative 27 | device.note=E-ELT Initial 42m design 28 | device.note=(AO and Flat mirrors M4 and M5 removed) 29 | device.note= 30 | device.note= 31 | device.note=From the document: 32 | device.note= 33 | device.note=Optical design for an adaptive anastigmatic five-mirror extremely large telescope 34 | device.note= 35 | device.note= 36 | device.note=Publication: 37 | device.note= 38 | device.note=http://www.aanda.org/articles/aa/abs/2008/31/aa8528-07/aa8528-07.html 39 | device.note= 40 | device.note=Spot seems slightly inacurate, but it may come from the numbers resolution of the publication. 41 | device.relative_convention=1 42 | half_field_of_view=0.08333 43 | image.autocurvature=0 44 | image.autofocus=0 45 | light.colors=YellowBlack. 46 | light.half_field_of_view=0.08333 47 | light.nbsteps=5 48 | note=E-ELT Initial 42m design 49 | note=(AO and Flat mirrors M4 and M5 removed) 50 | note= 51 | note= 52 | note=From the document: 53 | note= 54 | note=Optical design for an adaptive anastigmatic five-mirror extremely large telescope 55 | note= 56 | note= 57 | note=Publication: 58 | note= 59 | note=http://www.aanda.org/articles/aa/abs/2008/31/aa8528-07/aa8528-07.html 60 | note= 61 | note=Spot seems slightly inacurate, but it may come from the numbers resolution of the publication. 62 | parameter.showLightOffAxis=0 63 | -------------------------------------------------------------------------------- /src/Util/FileUtil.cpp: -------------------------------------------------------------------------------- 1 | #include "FileUtil.h" 2 | 3 | // dep a verifier 4 | #include 5 | //#include 6 | #include 7 | #include 8 | 9 | ////////////////////////////////////////////////////////////////////////////// 10 | int FileUtil::file_size(char* sFileName) 11 | { 12 | struct stat stat_p; 13 | 14 | if (stat(sFileName, &stat_p) == -1) 15 | { 16 | return -1; 17 | } 18 | return stat_p.st_size; 19 | } 20 | ////////////////////////////////////////////////////////////////////////////// 21 | bool FileUtil::file_delete(char* sFileName) 22 | { 23 | remove(sFileName); 24 | return true; 25 | } 26 | ////////////////////////////////////////////////////////////////////////////// 27 | vector FileUtil::list(string sPathAndMask) //TODO faire qq chose portable 28 | { 29 | vector vsResult; 30 | HANDLE hfind; 31 | WIN32_FIND_DATAA wfd; 32 | 33 | // Liste le contenu du repertoire 34 | hfind = FindFirstFileA(sPathAndMask.c_str(), &wfd ); 35 | if (hfind != INVALID_HANDLE_VALUE) 36 | { 37 | do 38 | { 39 | // if( wfd.cFileName[0] != '.') 40 | { 41 | vsResult.push_back( wfd.cFileName); 42 | } 43 | 44 | } 45 | while(FindNextFileA( hfind, &wfd)); 46 | FindClose(hfind); 47 | } 48 | 49 | return vsResult; 50 | } 51 | ////////////////////////////////////////////////////////////////////////////// 52 | string FileUtil::get_executable_path() 53 | { 54 | char szEXEPath[ 2048 ]; 55 | DWORD nChars = GetModuleFileNameA( NULL, szEXEPath, 2048 ); 56 | 57 | return string(szEXEPath,nChars); 58 | } 59 | ////////////////////////////////////////////////////////////////////////////// 60 | string FileUtil::get_path(string sFile) 61 | { 62 | size_t iPos=sFile.find_last_of("\\"); 63 | return sFile.substr(0,iPos); 64 | } 65 | ////////////////////////////////////////////////////////////////////////////// 66 | 67 | -------------------------------------------------------------------------------- /src/DockCommentary.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | DockComment 4 | 5 | 6 | 7 | 0 8 | 0 9 | 276 10 | 332 11 | 12 | 13 | 14 | QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable 15 | 16 | 17 | Notes 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 255 30 | 253 31 | 193 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 255 41 | 253 42 | 193 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 212 52 | 208 53 | 200 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /samples/telescopes/LSST.astree: -------------------------------------------------------------------------------- 1 | 0.comment=M1 2 | 0.conic=-1.215 3 | 0.diameter=8360 4 | 0.inner_diameter=5116 5 | 0.r6=1.38e-024 6 | 0.radius_curvature=-19835 7 | 0.type=reflect 8 | 0.z=0 9 | 1.comment=M2 10 | 1.conic=-0.222 11 | 1.diameter=3420 12 | 1.inner_diameter=1800 13 | 1.r6=-1.274e-020 14 | 1.r8=-9.68e-028 15 | 1.radius_curvature=-6788 16 | 1.type=reflect 17 | 1.z=-6156.2006 18 | 10.diameter=750 19 | 10.radius_curvature=-5594 20 | 10.type=Air 21 | 10.z=-4297.71302 22 | 11.comment=LensCorrector#3 23 | 11.conic=-0.962 24 | 11.diameter=722 25 | 11.radius_curvature=-3169 26 | 11.type=Silica 27 | 11.z=-4340.91302 28 | 12.diameter=722 29 | 12.radius_curvature=13360 30 | 12.type=Air 31 | 12.z=-4400.91302 32 | 13.comment=CCD 33 | 13.diameter=630.559876 34 | 13.radius_curvature=inf 35 | 13.type=image 36 | 13.z=-4429.41302 37 | 2.comment=M1/M3 offset 38 | 2.diameter=0 39 | 2.radius_curvature=inf 40 | 2.type=void 41 | 2.z=0 42 | 3.comment=M3 43 | 3.conic=0.155 44 | 3.diameter=5016 45 | 3.inner_diameter=1100 46 | 3.r6=-4.5e-022 47 | 3.r8=-8.15e-030 48 | 3.radius_curvature=-8344.5 49 | 3.type=reflect 50 | 3.z=233.8 51 | 4.diameter=1776.356226 52 | 4.radius_curvature=inf 53 | 4.type=stop 54 | 4.z=-3396.7 55 | 5.comment=LensCorrector#1 56 | 5.diameter=1550 57 | 5.radius_curvature=-2824 58 | 5.type=Silica 59 | 5.z=-3397.461 60 | 6.diameter=1550 61 | 6.radius_curvature=-5021 62 | 6.type=Air 63 | 6.z=-3479.691 64 | 7.comment=LensCorrector#2 65 | 7.diameter=1102 66 | 7.radius_curvature=inf 67 | 7.type=Silica 68 | 7.z=-3892.33302 69 | 8.conic=-1.57 70 | 8.diameter=1102 71 | 8.r6=1.656e-018 72 | 8.radius_curvature=-2529 73 | 8.type=Air 74 | 8.z=-3922.33302 75 | 9.comment=ChromaticFilter#1 76 | 9.diameter=750 77 | 9.radius_curvature=-5624 78 | 9.type=Silica 79 | 9.z=-4279.91302 80 | device.convention=relative 81 | half_field_of_view=1.75 82 | light.colors=Red.Yellow.Green. 83 | light.nbsteps=3 84 | note=reference document: 85 | note=LSST Optical Design Summary.pdf 86 | note= 87 | note=R-Band configuration: 88 | note=lambda : from 550 to 694 nm ; using Red,Yellow,Green 89 | note= 90 | note=Image is not perfect since Lens3, face#1 must be polynomial aspheric but I don't have the value 91 | -------------------------------------------------------------------------------- /src/Light.h: -------------------------------------------------------------------------------- 1 | // this file is covered by the General Public License version 2 or later 2 | // please see GPL.html for more details and licensing issues 3 | // copyright Etienne de Foras ( the author ) mailto: etienne.deforas@gmail.com 4 | 5 | #ifndef Light_ 6 | #define Light_ 7 | 8 | #include 9 | #include 10 | using namespace std; 11 | 12 | class Photon; 13 | class Glass; 14 | 15 | class Light 16 | { 17 | public: 18 | Light(); 19 | virtual ~Light(); 20 | 21 | void set_nb_photons(int iNbX,int iNbY); 22 | int nb_photon(); 23 | Photon& get_photon(int iPos); 24 | const vector& photons() const; 25 | vector get_all_photons(); 26 | 27 | void set_tilt(double dTiltX,double dTiltY); 28 | void get_tilt(double& dTiltX,double& dTiltY) const; 29 | Glass& material(); 30 | void set_material(Glass* pM); 31 | 32 | void set_colors(const string & vsAllColors); 33 | static void calc_colors(string sColors,vector& vdLambda,vector& vdVisualColors); 34 | int get_visual_color(double dLambda) const; 35 | 36 | void set_geometry(double dZ,double dDiameter); 37 | 38 | void compute_spot_size(bool bInfinite=false); // if bInfinite==false, compute a focal plane else compute as parallel light (like eyes) 39 | 40 | void get_spot_center(double& dCenterX,double& dCenterY) const; 41 | double spot_size() const; 42 | double get_FD() const; 43 | 44 | bool is_image_infinite() const; //return true if last image is infinite (eye observer) 45 | 46 | bool is_valid() const; 47 | 48 | double airy_radius() const; 49 | double spot_vs_airy() const; 50 | 51 | void init_vignetting(); 52 | double vignetting() const; 53 | 54 | private: 55 | void init(); 56 | 57 | vector _vPhotons; 58 | Glass* _pFirstMaterial; 59 | Glass* _pMaterial; 60 | bool _bMustInit; 61 | double _dTiltX,_dTiltY; 62 | int _iDimX,_iDimY,_iNbPhotons; 63 | int _iNbPhotonsInitVignetting; 64 | double _dDiameter,_dZ; 65 | double _dCenterX,_dCenterY,_dSpotSize; 66 | double _dFD; 67 | double _dVignetting; 68 | bool _bIsInfinite; 69 | bool _bIsValid; 70 | 71 | string _sAllColors; 72 | bool _bYellowBlack; 73 | }; 74 | 75 | #endif 76 | -------------------------------------------------------------------------------- /src/Referential.cpp: -------------------------------------------------------------------------------- 1 | #include "Referential.h" 2 | #include 3 | 4 | ////////////////////////////////////////////////////////////////////////////// 5 | Referential::Referential() 6 | { 7 | _rotMat[0]=1.; _rotMat[1]=0.; _rotMat[2]=0.; 8 | _rotMat[3]=0.; _rotMat[4]=1.; _rotMat[5]=0.; 9 | _rotMat[6]=0.; _rotMat[7]=0.; _rotMat[8]=1.; 10 | 11 | _x=0.; _y=0.; _z=0.; 12 | } 13 | ////////////////////////////////////////////////////////////////////////////// 14 | Referential::~Referential() 15 | { } 16 | ////////////////////////////////////////////////////////////////////////////// 17 | void Referential::setYawPitchRoll(double Yaw,double Pitch,double Roll) 18 | { // from public domain www.developpez.com 19 | double A=cos(Roll); 20 | double B=sin(Roll); 21 | double C=cos(Pitch); 22 | double D=sin(Pitch); 23 | double E=cos(Yaw); 24 | double F=sin(Yaw); 25 | 26 | _rotMat[0]=C*E; 27 | _rotMat[1]=-C*F; 28 | _rotMat[2]=-D; 29 | 30 | _rotMat[3]=-B*D*E + A*F; 31 | _rotMat[4]= B*D*F + A*E; 32 | _rotMat[5]=-B*C; 33 | 34 | _rotMat[6]= A*D*E + B*F; 35 | _rotMat[7]=-A*D*F + B*E; 36 | _rotMat[8]= A*C; 37 | } 38 | ////////////////////////////////////////////////////////////////////////////// 39 | void Referential::transform(double& x,double& y,double& z) const 40 | { 41 | double xt=x+_x; 42 | double yt=y+_y; 43 | double zt=z+_z; 44 | 45 | double nx=_rotMat[0]*xt+_rotMat[1]*yt+_rotMat[2]*zt; 46 | double ny=_rotMat[3]*xt+_rotMat[4]*yt+_rotMat[5]*zt; 47 | double nz=_rotMat[6]*xt+_rotMat[7]*yt+_rotMat[8]*zt; 48 | 49 | x=nx; y=ny; z=nz; 50 | } 51 | ////////////////////////////////////////////////////////////////////////////// 52 | void Referential::unTransform(double& x,double& y,double& z) const 53 | { 54 | double nx=_rotMat[0]*x+_rotMat[3]*y+_rotMat[6]*z; 55 | double ny=_rotMat[1]*x+_rotMat[4]*y+_rotMat[7]*z; 56 | double nz=_rotMat[2]*x+_rotMat[5]*y+_rotMat[8]*z; 57 | 58 | x=nx-_x; y=ny-_y; z=nz-_z; 59 | } 60 | ////////////////////////////////////////////////////////////////////////////// 61 | void Referential::setTranslation(double x,double y, double z) 62 | { 63 | _x=x; _y=y;_z=z; 64 | } 65 | ////////////////////////////////////////////////////////////////////////////// 66 | -------------------------------------------------------------------------------- /src/DialogMediumManager.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | DialogMediumManager 4 | 5 | 6 | 7 | 0 8 | 0 9 | 885 10 | 585 11 | 12 | 13 | 14 | GlassManager 15 | 16 | 17 | 18 | :/Astree/Astree.ico:/Astree/Astree.ico 19 | 20 | 21 | true 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | Qt::Horizontal 35 | 36 | 37 | 38 | 40 39 | 20 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | Cancel 48 | 49 | 50 | 51 | 52 | 53 | 54 | Select 55 | 56 | 57 | 58 | 59 | 60 | 61 | Ok 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /src/GlassExtended2.cpp: -------------------------------------------------------------------------------- 1 | // this file is covered by the General Public License version 2 or later 2 | // please see GPL.html for more details and licensing issues 3 | // copyright Etienne de Foras ( the author ) mailto: etienne.deforas@gmail.com 4 | 5 | #include "GlassExtended2.h" 6 | #include 7 | #include 8 | 9 | // glass definition as in the https://github.com/nzhagen/zemaxglass 10 | 11 | ////////////////////////////////////////////////////////////////////////////// 12 | GlassExtended2::GlassExtended2() 13 | { 14 | _sName="Extended2"; 15 | _sFormula="Extended2"; 16 | 17 | _dC0=0.; 18 | _dC1=0.; 19 | _dC2=0.; 20 | _dC3=0.; 21 | _dC4=0.; 22 | _dC5=0.; 23 | _dC6=0.; 24 | _dC7=0.; 25 | } 26 | ////////////////////////////////////////////////////////////////////////////// 27 | Glass* GlassExtended2::clone() const 28 | { 29 | return new GlassExtended2(*this); 30 | } 31 | ////////////////////////////////////////////////////////////////////////////// 32 | GlassExtended2::GlassExtended2(const GlassExtended2& m): 33 | Glass(m) 34 | { 35 | assert(m._sFormula=="Extended2"); 36 | 37 | _dC0=m._dC0; 38 | _dC1=m._dC1; 39 | _dC2=m._dC2; 40 | _dC3=m._dC3; 41 | _dC4=m._dC4; 42 | _dC5=m._dC5; 43 | _dC6=m._dC6; 44 | _dC7=m._dC7; 45 | } 46 | ////////////////////////////////////////////////////////////////////////////// 47 | double GlassExtended2::calc_index(double dLambdaMicrons) 48 | { 49 | //use the Extended2 formulae 50 | // n^2 = c0 + c1 λ^2 + c2 λ^−2 + c3 λ^−4 + c4 λ^−6 + c5 λ^−8 + c6 λ^4 + c7 λ^6 51 | 52 | double l2=dLambdaMicrons*dLambdaMicrons; 53 | double l4=l2*l2; 54 | double invl2=1./l2; 55 | double invl4=invl2*invl2; 56 | 57 | //todo optimize with the Horner rule 58 | double n2=_dC0+_dC1*l2+_dC2*invl2+_dC3*invl4+_dC4*invl2*invl4+_dC5*invl4*invl4+_dC6*l4+_dC7*l4*l2; 59 | return sqrt(n2); 60 | } 61 | ////////////////////////////////////////////////////////////////////////////// 62 | void GlassExtended2::set_coefs(double dC0,double dC1,double dC2,double dC3,double dC4,double dC5,double dC6,double dC7) 63 | { 64 | _dC0=dC0; 65 | _dC1=dC1; 66 | _dC2=dC2; 67 | _dC3=dC3; 68 | _dC4=dC4; 69 | _dC5=dC5; 70 | _dC6=dC6; 71 | _dC7=dC7; 72 | } 73 | ////////////////////////////////////////////////////////////////////////////// 74 | -------------------------------------------------------------------------------- /src/tests/test_perfect_surface.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | #include "OpticalDevice.h" 6 | 7 | ///////////////////////////////////////////////////////////////////// 8 | inline bool is_near(double a,double b, double tolerancis=1e-10) 9 | { 10 | return fabs(a-b) 2 | #include 3 | using namespace std; 4 | 5 | #include "OpticalDevice.h" 6 | #include "DeviceScaling.h" 7 | 8 | ///////////////////////////////////////////////////////////////////// 9 | inline bool is_near(double a,double b, double tolerancis=1e-10) 10 | { 11 | return fabs(a-b) 9 | #include "AstreeDefines.h" 10 | 11 | #include 12 | #include 13 | using namespace std; 14 | 15 | namespace Ui 16 | { 17 | class MainWindowClass; 18 | } 19 | 20 | class OpticalDevice; 21 | class DockSurfacesData; 22 | class FrameSideView; 23 | class DockLightProperties; 24 | class DockScatterPlot; 25 | class DockAutofocus; 26 | class DockImageQuality; 27 | class DockCommentary; 28 | class DockOptimizer; 29 | 30 | class MainWindow : public QMainWindow 31 | { 32 | Q_OBJECT 33 | 34 | public: 35 | MainWindow(QWidget *parent = 0); 36 | ~MainWindow(); 37 | 38 | bool load_file(string sFile); 39 | bool ask_save_and_action(); 40 | void clear_device(); 41 | 42 | public slots: 43 | void device_changed(void* pSender, int iReason, bool bMustSave=true); 44 | 45 | protected: 46 | virtual void closeEvent ( QCloseEvent * event ); 47 | virtual void resizeEvent( QResizeEvent *e ); 48 | 49 | private: 50 | void glass_dialog(bool bSelect); 51 | Ui::MainWindowClass *ui; 52 | 53 | private slots: 54 | void on_actionNew_triggered(); 55 | void on_actionLoad_triggered(); 56 | void on_actionSave_triggered(); 57 | void on_actionSave_as_triggered(); 58 | void on_actionClose_triggered(); 59 | void on_actionAbout_triggered(); 60 | void on_actionQuit_triggered(); 61 | void on_actionMedium_Manager_triggered(); 62 | void on_actionScal_device_triggered(); 63 | void on_actionImport_ZMX_file_triggered(); 64 | void on_actionFit_in_View_triggered(); 65 | void on_actionZoom_in_triggered(); 66 | void on_actionZoom_out_triggered(); 67 | 68 | void on_actionReload_triggered(); 69 | 70 | private: 71 | OpticalDevice* _pDevice; 72 | DockSurfacesData* _pDockSurfacesData; 73 | DockLightProperties* _pDockLightProperties; 74 | DockAutofocus* _pDockAutofocus; 75 | DockScatterPlot* _pDockScatterPlot; 76 | DockCommentary* _pDockCommentary; 77 | DockOptimizer* _pDockOptimizer; 78 | FrameSideView* _pFrameSideView; 79 | DockImageQuality* _pDockImageQuality; 80 | bool _bMustSave; 81 | string _sFileName; 82 | }; 83 | 84 | #endif // MAINWINDOW_H 85 | -------------------------------------------------------------------------------- /samples/telescopes/EdF_T2000_F3.4.astree: -------------------------------------------------------------------------------- 1 | 0.conic=-0.9998478811 2 | 0.diameter=2000 3 | 0.inner_diameter=750 4 | 0.r4=3.293299738e-014 5 | 0.r6=3.275194978e-022 6 | 0.radius_curvature=-7000 7 | 0.thick=-2355.711965 8 | 0.type=reflect 9 | 1.conic=-1.763029623 10 | 1.diameter=698.467494 11 | 1.diameter.auto=1 12 | 1.inner_diameter=204.802828 13 | 1.inner_diameter.auto=1 14 | 1.radius_curvature=-2546.265269 15 | 1.thick=3141.396494 16 | 1.type=reflect 17 | 2.conic=-0.4691962653 18 | 2.diameter=672.5745806 19 | 2.diameter.auto=1 20 | 2.inner_diameter=0.9308674766 21 | 2.inner_diameter.auto=1 22 | 2.radius_curvature=-4063.548405 23 | 2.thick=-1626.934909 24 | 2.type=reflect 25 | 3.diameter=120.3162294 26 | 3.diameter.auto=1 27 | 3.radius_curvature=inf 28 | 3.thick=0 29 | 3.type=image 30 | 3.z.autofocus=1 31 | device.note=Work in progress in a fast 2000mm telescope 32 | device.note= 33 | device.note=image field is flat 34 | device.note= 35 | device.note=author: Etienne de Foras 36 | device.relative_convention=1 37 | image.autocurvature=0 38 | image.autofocus=1 39 | light.colors= 40 | light.half_field_of_view=0.5 41 | light.nbsteps=5 42 | note=Work in progress in a fast 2000mm telescope 43 | note= 44 | note=image field is flat 45 | note= 46 | note=author: Etienne de Foras 47 | parameter.optimizer.0.checked=1 48 | parameter.optimizer.0.parameter=Conic 49 | parameter.optimizer.0.surface=1 50 | parameter.optimizer.1.checked=1 51 | parameter.optimizer.1.parameter=Conic 52 | parameter.optimizer.1.surface=2 53 | parameter.optimizer.2.checked=0 54 | parameter.optimizer.2.parameter=RCurv 55 | parameter.optimizer.2.surface=2 56 | parameter.optimizer.3.checked=1 57 | parameter.optimizer.3.parameter=Conic 58 | parameter.optimizer.3.surface=3 59 | parameter.optimizer.4.checked=0 60 | parameter.optimizer.4.parameter=RCurv 61 | parameter.optimizer.4.surface=3 62 | parameter.optimizer.5.checked=0 63 | parameter.optimizer.5.parameter=Thick 64 | parameter.optimizer.5.surface=2 65 | parameter.optimizer.6.checked=0 66 | parameter.optimizer.6.parameter=Thick 67 | parameter.optimizer.6.surface=1 68 | parameter.optimizer.7.checked=1 69 | parameter.optimizer.7.parameter=R4 70 | parameter.optimizer.7.surface=1 71 | parameter.optimizer.8.checked=1 72 | parameter.optimizer.8.parameter=R6 73 | parameter.optimizer.8.surface=1 74 | parameter.optimizer.9.checked=0 75 | parameter.optimizer.9.parameter=R4 76 | parameter.optimizer.9.surface=3 77 | parameter.optimizer.merit=FullFrameMaxError 78 | parameter.showLightOffAxis=100 79 | -------------------------------------------------------------------------------- /samples/telescopes/Edf_T400_F8.astree: -------------------------------------------------------------------------------- 1 | 0.conic=-1.199811754 2 | 0.diameter=400 3 | 0.inner_diameter=60 4 | 0.radius_curvature=-2406.015038 5 | 0.thick=-809.3233083 6 | 0.type=reflect 7 | 1.conic=-7.383176499 8 | 1.diameter=139.4160692 9 | 1.diameter.auto=1 10 | 1.radius_curvature=-1259.849624 11 | 1.thick=1000 12 | 1.type=reflect 13 | 2.diameter=36.90012819 14 | 2.diameter.auto=1 15 | 2.radius_curvature=-35.24889038 16 | 2.thick=3.126064642 17 | 2.type=BK7 18 | 3.diameter=37.92556873 19 | 3.diameter.auto=1 20 | 3.radius_curvature=-36.31679815 21 | 3.thick=50.64540437 22 | 3.type=Air 23 | 4.diameter=32.29072276 24 | 4.diameter.auto=1 25 | 4.radius_curvature=inf 26 | 4.thick=0 27 | 4.type=image 28 | 4.z.autofocus=1 29 | device.note=Custom formula from Etienne de Foras, for a planetary telescope: 30 | device.note= 31 | device.note=-Two conical mirrror + thin BK7 corrector 32 | device.note= 33 | device.note=Image is very good in all the image field 34 | device.note= 35 | device.note=Surfaces has been roughly optimised 36 | device.note= 37 | device.note=Work in progress 38 | device.relative_convention=1 39 | image.autocurvature=0 40 | image.autofocus=1 41 | light.colors=Red.Yellow.Green.Blue. 42 | light.half_field_of_view=0.28 43 | light.nbsteps=3 44 | note=Custom formula from Etienne de Foras, for a planetary telescope: 45 | note= 46 | note=-Two conical mirrror + thin BK7 corrector 47 | note= 48 | note=Image is very good in all the image field 49 | note= 50 | note=Surfaces has been roughly optimised 51 | note= 52 | note=Work in progress 53 | parameter.optimizer.0.checked=0 54 | parameter.optimizer.0.parameter=Conic 55 | parameter.optimizer.0.surface=1 56 | parameter.optimizer.1.checked=0 57 | parameter.optimizer.1.parameter=Conic 58 | parameter.optimizer.1.surface=2 59 | parameter.optimizer.2.checked=0 60 | parameter.optimizer.2.parameter=RCurv 61 | parameter.optimizer.2.surface=3 62 | parameter.optimizer.3.checked=0 63 | parameter.optimizer.3.parameter=RCurv 64 | parameter.optimizer.3.surface=4 65 | parameter.optimizer.4.checked=0 66 | parameter.optimizer.4.parameter=Thick 67 | parameter.optimizer.4.surface=3 68 | parameter.optimizer.5.checked=0 69 | parameter.optimizer.5.parameter=Thick 70 | parameter.optimizer.5.surface=4 71 | parameter.optimizer.6.checked=0 72 | parameter.optimizer.7.checked=0 73 | parameter.optimizer.8.checked=0 74 | parameter.optimizer.9.checked=0 75 | parameter.optimizer.merit=FullFrameMaxError 76 | parameter.optimizer.method=NelderMead 77 | parameter.showLightOffAxis=100 78 | -------------------------------------------------------------------------------- /samples/telescopes/Ross_hyperbolic_corrector.astree: -------------------------------------------------------------------------------- 1 | 0.conic=-1.275837344 2 | 0.diameter=200 3 | 0.radius_curvature=-2462 4 | 0.type=reflect 5 | 0.z=-0 6 | 1.diameter=45.07233177 7 | 1.diameter.auto=1 8 | 1.radius_curvature=-99.76369509 9 | 1.type=BK7 10 | 1.z=-1135.5 11 | 2.diameter=44.01960722 12 | 2.diameter.auto=1 13 | 2.radius_curvature=-64.81536209 14 | 2.type=Air 15 | 2.z=-1138.5 16 | 3.diameter=43.99369333 17 | 3.diameter.auto=1 18 | 3.radius_curvature=-723.7881841 19 | 3.type=BK7 20 | 3.z=-1146 21 | 4.diameter=43.88217634 22 | 4.diameter.auto=1 23 | 4.radius_curvature=221.780077 24 | 4.type=Air 25 | 4.z=-1152 26 | 5.diameter=32.0513936 27 | 5.diameter.auto=1 28 | 5.radius_curvature=inf 29 | 5.type=image 30 | 5.z=-1234.466077 31 | 5.z.autofocus=1 32 | device.note=Telescope using a hyperbolic mirror, with a two lens Ross corrector using BK7 glass 33 | device.note= 34 | device.note=Limited by diffraction on nearly all image field 35 | device.note= 36 | device.note=Found on: 37 | device.note= 38 | device.note=http://www.jeandijon.com/correcteurs_de_champ_pour_miroir.htm 39 | device.note= 40 | device.note=Diameter scaled to 200 mm 41 | device.note=Surfaces roughly reoptimized 42 | device.note= 43 | device.note=FNumber scaled to 6 44 | device.relative_convention=0 45 | image.autocurvature=0 46 | image.autofocus=1 47 | light.colors=Red.Yellow.Green.Blue. 48 | light.half_field_of_view=0.75 49 | light.nbsteps=3 50 | note=Telescope using a hyperbolic mirror, with a two lens Ross corrector using BK7 glass 51 | note= 52 | note=Limited by diffraction on nearly all image field 53 | note= 54 | note=Found on: 55 | note= 56 | note=http://www.jeandijon.com/correcteurs_de_champ_pour_miroir.htm 57 | note= 58 | note=Diameter scaled to 200 mm 59 | note=Surfaces roughly reoptimized 60 | note= 61 | note=FNumber scaled to 6 62 | parameter.optimizer.0.checked=1 63 | parameter.optimizer.0.parameter=RCurv 64 | parameter.optimizer.0.surface=2 65 | parameter.optimizer.1.checked=1 66 | parameter.optimizer.1.parameter=RCurv 67 | parameter.optimizer.1.surface=3 68 | parameter.optimizer.2.checked=1 69 | parameter.optimizer.2.parameter=RCurv 70 | parameter.optimizer.2.surface=4 71 | parameter.optimizer.3.checked=1 72 | parameter.optimizer.3.parameter=RCurv 73 | parameter.optimizer.3.surface=5 74 | parameter.optimizer.4.checked=1 75 | parameter.optimizer.4.parameter=Conic 76 | parameter.optimizer.4.surface=1 77 | parameter.optimizer.5.checked=0 78 | parameter.optimizer.6.checked=0 79 | parameter.optimizer.7.checked=0 80 | parameter.optimizer.8.checked=0 81 | parameter.optimizer.9.checked=0 82 | parameter.optimizer.merit=FullFrameMaxError 83 | parameter.showLightOffAxis=0 84 | -------------------------------------------------------------------------------- /samples/others/Mangin.astree: -------------------------------------------------------------------------------- 1 | 0.diameter=200 2 | 0.radius_curvature=-1212.698863 3 | 0.thick=9.926944442 4 | 0.type=BK7 5 | 1.diameter=200.7626 6 | 1.diameter.auto=1 7 | 1.radius_curvature=-1810.726266 8 | 1.thick=-9.926944442 9 | 1.thick.clone=0 10 | 1.thick.clone.gain=-1 11 | 1.type=reflect 12 | 2.diameter=199.0267349 13 | 2.diameter.auto=1 14 | 2.radius_curvature=-1212.698863 15 | 2.radius_curvature.clone=0 16 | 2.radius_curvature.clone.gain=1 17 | 2.thick=-1196.013289 18 | 2.type=Air 19 | 3.diameter=21.03847063 20 | 3.diameter.auto=1 21 | 3.radius_curvature=1056.357315 22 | 3.thick=0 23 | 3.type=image 24 | device.note=The Mangin mirror uses a transparent glasse and reflect the light on the back surface. 25 | device.note= 26 | device.note=With these two spherical surfaces, it is possible to have a perfect image on-axis and monochromatic only (here in Red light). 27 | device.note= 28 | device.note=(Radius of curvatures optimised with the "Optimiser" panel) 29 | device.note= 30 | device.note=This design use clone surfaces, surface #3 geometry is a clone of the surface #1 ( changing the radius of curvature of surface #1 change also surface #3) , note the #1 keyword in surface3 RCurv columns. 31 | device.note= 32 | device.note=Only Rcurv, conic and polynomial coefs can be cloned for now. 33 | device.relative_convention=1 34 | image.autocurvature=1 35 | image.autofocus=0 36 | light.colors=Red. 37 | light.half_field_of_view=0.5 38 | light.nbsteps=3 39 | note=The Mangin mirror uses a transparent glasse and reflect the light on the back surface. 40 | note= 41 | note=With these two spherical surfaces, it is possible to have a perfect image on-axis and monochromatic only (here in Red light). 42 | note= 43 | note=(Radius of curvatures optimised with the "Optimiser" panel) 44 | note= 45 | note=This design use clone surfaces, surface #3 geometry is a clone of the surface #1 ( changing the radius of curvature of surface #1 change also surface #3) , note the #1 keyword in surface3 RCurv columns. 46 | note= 47 | note=Only Rcurv, conic and polynomial coefs can be cloned for now. 48 | parameter.optimizer.0.checked=1 49 | parameter.optimizer.0.parameter=RCurv 50 | parameter.optimizer.0.surface=1 51 | parameter.optimizer.1.checked=1 52 | parameter.optimizer.1.parameter=RCurv 53 | parameter.optimizer.1.surface=2 54 | parameter.optimizer.2.checked=1 55 | parameter.optimizer.2.parameter=Thick 56 | parameter.optimizer.2.surface=1 57 | parameter.optimizer.3.checked=0 58 | parameter.optimizer.4.checked=0 59 | parameter.optimizer.5.checked=0 60 | parameter.optimizer.6.checked=0 61 | parameter.optimizer.7.checked=0 62 | parameter.optimizer.8.checked=0 63 | parameter.optimizer.9.checked=0 64 | parameter.optimizer.merit=CenterOnly 65 | parameter.showLightOffAxis=0 66 | -------------------------------------------------------------------------------- /src/Astree.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = app 2 | QT += widgets 3 | DESTDIR= .. 4 | 5 | CONFIG(debug, debug|release):TARGET = Astree_debug 6 | CONFIG(release, debug|release):TARGET = Astree 7 | CONFIG(release, debug|release):DEFINES+=NDEBUG 8 | CONFIG(release, debug|release):DEFINES += QT_NO_DEBUG 9 | 10 | win32:RC_FILE = Astree.rc 11 | RESOURCES += Astree.qrc 12 | TRANSLATIONS = Astree_fr.ts 13 | SOURCES += main.cpp \ 14 | MainWindow.cpp \ 15 | DockLightProperties.cpp \ 16 | FrameSideView.cpp \ 17 | GlassCatalogIo.cpp \ 18 | DockScatterPlot.cpp \ 19 | DockSurfacesData.cpp \ 20 | DockCommentary.cpp \ 21 | MaterialVacuum.cpp \ 22 | DialogMediumManager.cpp \ 23 | OpticalDevice.cpp \ 24 | DialogScaleDevice.cpp \ 25 | DeviceIoZmx.cpp \ 26 | LightAutoFocus.cpp \ 27 | DeviceScaling.cpp \ 28 | DockImageQuality.cpp \ 29 | ImageQuality.cpp \ 30 | DockOptimizer.cpp \ 31 | DeviceOptimizer.cpp \ 32 | DeviceOptimizerAmoeba.cpp \ 33 | DeviceOptimizerRandom.cpp \ 34 | Util/FileUtil.cpp \ 35 | Glass.cpp \ 36 | GlassManager.cpp \ 37 | GlassSellmeier.cpp \ 38 | GlassExtended2.cpp 39 | 40 | HEADERS += MainWindow.h \ 41 | DockLightProperties.h \ 42 | FrameSideView.h \ 43 | DockScatterPlot.h \ 44 | DockSurfacesData.h \ 45 | DockCommentary.h \ 46 | MyViewFrame.h \ 47 | Util/FileUtil.h \ 48 | MaterialVacuum.h \ 49 | DialogMediumManager.h \ 50 | OpticalDevice.h \ 51 | DialogScaleDevice.h \ 52 | DeviceIoZmx.h \ 53 | LightAutoFocus.h \ 54 | DeviceScaling.h \ 55 | DockImageQuality.h \ 56 | ImageQuality.h \ 57 | DockOptimizer.h \ 58 | DeviceOptimizer.h \ 59 | DeviceOptimizerAmoeba.h \ 60 | DeviceOptimizerRandom.h \ 61 | GlassManager.h \ 62 | GlassCatalogIo.h \ 63 | Glass.h \ 64 | GlassSellmeier.h \ 65 | GlassExtended2.h \ 66 | Vector3D.h 67 | 68 | FORMS += MainWindow.ui \ 69 | DockLightProperties.ui \ 70 | FrameSideView.ui \ 71 | DockScatterPlot.ui \ 72 | DockSurfacesData.ui \ 73 | DockCommentary.ui \ 74 | DialogMediumManager.ui \ 75 | DialogScaleDevice.ui \ 76 | DockImageQuality.ui \ 77 | DockOptimizer.ui 78 | 79 | # internal engine files 80 | INCLUDEPATH += Util 81 | SOURCES += \ 82 | DeviceIo.cpp \ 83 | Surface.cpp \ 84 | Photon.cpp \ 85 | Referential.cpp \ 86 | Light.cpp \ 87 | Photon.h \ 88 | MaterialUnknow.cpp \ 89 | MaterialAir.cpp \ 90 | MaterialWater.cpp \ 91 | Util/Properties.cpp 92 | 93 | HEADERS += \ 94 | DeviceIo.h \ 95 | Surface.h \ 96 | Referential.h \ 97 | Light.h \ 98 | Photon.h \ 99 | MaterialAir.h \ 100 | MaterialWater.h \ 101 | MaterialUnknow.h \ 102 | Util/Properties.h \ 103 | AstreeDefines.h 104 | 105 | OTHER_FILES += Astree.iss 106 | -------------------------------------------------------------------------------- /samples/telescopes/WideField.astree: -------------------------------------------------------------------------------- 1 | 0.comment=L1 2 | 0.diameter=511.8 3 | 0.radius_curvature=1141.913 4 | 0.thick=47 5 | 0.type=Silica 6 | 1.diameter=490.1 7 | 1.radius_curvature=1241.285 8 | 1.thick=165.714 9 | 1.type=Air 10 | 10.comment=image 11 | 10.diameter=413.7399568 12 | 10.diameter.auto=1 13 | 10.radius_curvature=-781.7444593 14 | 10.thick=0 15 | 10.type=image 16 | 10.z.autofocus=1 17 | 2.comment=L2 18 | 2.diameter=422.5 19 | 2.radius_curvature=-1060.8 20 | 2.thick=51.871 21 | 2.type=Silica 22 | 3.diameter=410.1 23 | 3.radius_curvature=-997.351 24 | 3.thick=0 25 | 3.type=Air 26 | 4.comment=Stop 27 | 4.diameter=397.9 28 | 4.radius_curvature=inf 29 | 4.thick=304.135 30 | 4.type=stop 31 | 5.comment=L3 32 | 5.diameter=515.7267403 33 | 5.diameter.auto=1 34 | 5.radius_curvature=-530.106 35 | 5.thick=50 36 | 5.type=Silica 37 | 6.diameter=533.453713 38 | 6.diameter.auto=1 39 | 6.radius_curvature=-436.465 40 | 6.thick=23.871 41 | 6.type=Air 42 | 7.comment=L4 43 | 7.diameter=540.7538149 44 | 7.diameter.auto=1 45 | 7.radius_curvature=-438.102 46 | 7.thick=62 47 | 7.type=Silica 48 | 8.diameter=597.9513088 49 | 8.diameter.auto=1 50 | 8.radius_curvature=-653.243 51 | 8.thick=1065.44 52 | 8.type=Air 53 | 9.comment=M1 54 | 9.diameter=1163.110421 55 | 9.diameter.auto=1 56 | 9.radius_curvature=-1656.21 57 | 9.thick=-855.1947317 58 | 9.type=reflect 59 | device.note=Desing form the paper: 60 | device.note= 61 | device.note=All-spherical telescope 62 | device.note=with extremely wide field of view 63 | device.note=V. Yu. Terebizh 1,2∗ 64 | device.note=1 Crimean Astrophysical Observatory, Nauchny, Crimea 298409 65 | device.note=2 Institute of Astronomy RAN, Moscow 119017, Russian Federation 66 | device.note= 67 | device.note=web: http://arxiv.org/pdf/1602.02370.pdf 68 | device.note= 69 | device.note= 70 | device.note=All surfaces are spherical 71 | device.note=Only one glass type used: Fused Silica 72 | device.note= 73 | device.note=30 degree field of view! 74 | device.note= 75 | device.note=image field is curved , must be used with sensor stripe 76 | device.relative_convention=1 77 | image.autocurvature=1 78 | image.autofocus=1 79 | light.colors=Red.YellowBlack.Yellow.Green.Blue. 80 | light.half_field_of_view=15 81 | light.nbsteps=6 82 | note=Desing form the paper: 83 | note= 84 | note=All-spherical telescope 85 | note=with extremely wide field of view 86 | note=V. Yu. Terebizh 1,2∗ 87 | note=1 Crimean Astrophysical Observatory, Nauchny, Crimea 298409 88 | note=2 Institute of Astronomy RAN, Moscow 119017, Russian Federation 89 | note= 90 | note=web: http://arxiv.org/pdf/1602.02370.pdf 91 | note= 92 | note= 93 | note=All surfaces are spherical 94 | note=Only one glass type used: Fused Silica 95 | note= 96 | note=30 degree field of view! 97 | note= 98 | note=image field is curved , must be used with sensor stripe 99 | parameter.showLightOffAxis=100 100 | -------------------------------------------------------------------------------- /src/DeviceOptimizer.h: -------------------------------------------------------------------------------- 1 | // this file is covered by the General Public License version 2 or later 2 | // please see GPL.html for more details and licensing issues 3 | // copyright Etienne de Foras ( the author ) mailto: etienne.deforas@gmail.com 4 | 5 | #ifndef DeviceOptimizer_ 6 | #define DeviceOptimizer_ 7 | 8 | #include 9 | #include 10 | using namespace std; 11 | 12 | #include "OpticalDevice.h" 13 | 14 | #define MIN_RESOLUTION_CONIC 1.e-7 15 | #define CONIC_HALF_RANGE 4 16 | #define CONIC_HALF_RANGE_REFINE 0.5 17 | 18 | #define MIN_RESOLUTION_RCURV 1.e-7 19 | #define RCURV_HALF_RATIO 2 20 | #define RCURV_HALF_RATIO_REFINE 1.05 21 | #define MIN_RESOLUTION_CURVATURE 1.e-13 //TODO? !! 22 | 23 | #define MIN_RESOLUTION_THICK 1.e-7 24 | #define Z_HALF_RANGE 100. 25 | #define THICK_HALF_RANGE 100. 26 | #define Z_HALF_RANGE_REFINE 5 27 | #define THICK_HALF_RANGE_REFINE 5 28 | 29 | #define MIN_RESOLUTION_R4 1.e-22 30 | #define R4_HALF_RATIO 2 31 | #define R4_HALF_RATIO_REFINE 1.05 32 | 33 | #define MIN_RESOLUTION_R6 1.e-24 34 | #define R6_HALF_RATIO 2 35 | #define R6_HALF_RATIO_REFINE 1.05 36 | 37 | #define MIN_RESOLUTION_R8 1.e-26 38 | #define R8_HALF_RATIO 2 39 | #define R8_HALF_RATIO_REFINE 1.05 40 | 41 | #define MIN_RESOLUTION_R10 1.e-28 42 | #define R10_HALF_RATIO 2 43 | #define R10_HALF_RATIO_REFINE 1.05 44 | 45 | class DeviceOptimizerParameter 46 | { 47 | public: 48 | int iSurface; 49 | string sParameter; 50 | double dMin; 51 | double dMax; 52 | double dValue; 53 | double dResolution; 54 | }; 55 | 56 | enum OptimizerMeritFunction 57 | { 58 | eCenterOnly, 59 | eMostlyCenter, 60 | eFullFrameMean, 61 | eFullFrameMaxError 62 | }; 63 | 64 | enum OptimizerResult 65 | { 66 | eInvalidState, 67 | eBetterSolutionFound, 68 | eNoBetterSolution, 69 | eSolutionOnEdge, 70 | eNothingToOptimize 71 | }; 72 | 73 | typedef vector ParameterSet; 74 | 75 | class DeviceOptimizer 76 | { 77 | public: 78 | DeviceOptimizer(); 79 | virtual ~DeviceOptimizer(); 80 | 81 | void clear(); 82 | void set_device(OpticalDevice* pDevice); 83 | void set_min_vignetting(double dMinVignetting); 84 | void add_parameter(int iSurface,string sParameter, bool bRefine=false); // auto min & max 85 | void add_parameter(int iSurface,string sParameter,double dMin,double dMax); 86 | void set_merit_function(OptimizerMeritFunction eMeritFunction); 87 | 88 | virtual OptimizerResult optimize()=0; 89 | 90 | bool domain_under_resolution(const ParameterSet& params); 91 | 92 | protected: 93 | void apply_parameter(const ParameterSet& parameters); 94 | double compute_demerit(); //return demerit value: lower is better 95 | 96 | OpticalDevice* _pDevice; 97 | ParameterSet _parameters; 98 | OptimizerMeritFunction _meritFunction; 99 | double _dMinVignetting; 100 | }; 101 | 102 | #endif 103 | -------------------------------------------------------------------------------- /src/DialogScaleDevice.cpp: -------------------------------------------------------------------------------- 1 | #include "DialogScaleDevice.h" 2 | #include "ui_DialogScaleDevice.h" 3 | 4 | #include 5 | 6 | DialogScaleDevice::DialogScaleDevice(QWidget *parent) : 7 | QDialog(parent), 8 | ui(new Ui::DialogScaleDevice) 9 | { 10 | ui->setupUi(this); 11 | 12 | _dScale=-1.; 13 | _bScaleDiameter=false; 14 | _bScaleFocal=false; 15 | } 16 | 17 | DialogScaleDevice::~DialogScaleDevice() 18 | { 19 | delete ui; 20 | } 21 | 22 | void DialogScaleDevice::on_pushButton_clicked() 23 | { 24 | bool bOk=false; 25 | 26 | if(ui->rbFactor->isChecked()) 27 | { 28 | _dScale=ui->leFactor->text().toDouble(&bOk); 29 | if(!bOk||(_dScale<=0.)) 30 | { 31 | QMessageBox::warning(this,"Error","Please, enter a valid ratio"); 32 | return; 33 | } 34 | } 35 | 36 | if(ui->rbPercentage->isChecked()) 37 | { 38 | _dScale=ui->lePercentage->text().toDouble(&bOk)/100.; 39 | if(!bOk||(_dScale<=0.)) 40 | { 41 | QMessageBox::warning(this,"Error","Please, enter a valid percentage"); 42 | return; 43 | } 44 | } 45 | 46 | if(ui->rbSizeChange->isChecked()) 47 | { 48 | double dOldSize=ui->leOldSize->text().toDouble(&bOk); 49 | if(!bOk||(dOldSize<=0.)) 50 | { 51 | QMessageBox::warning(this,"Error","Please, enter a valid old size"); 52 | return; 53 | } 54 | double dNewSize=ui->leNewSize->text().toDouble(&bOk); 55 | if(!bOk|| (dNewSize<=0.)) 56 | { 57 | QMessageBox::warning(this,"Error","Please, enter a valid old size"); 58 | return; 59 | } 60 | 61 | _dScale=dNewSize/dOldSize; 62 | } 63 | 64 | _bScaleDiameter=ui->cbScaleDiameter->isChecked(); 65 | _bScaleFocal=ui->cbScaleFocal->isChecked(); 66 | 67 | accept(); 68 | } 69 | 70 | void DialogScaleDevice::on_pushButton_2_clicked() 71 | { 72 | reject(); 73 | } 74 | 75 | void DialogScaleDevice::on_rbFactor_clicked() 76 | { 77 | ui->leFactor->setEnabled(true); 78 | ui->lePercentage->setEnabled(false); 79 | ui->leOldSize->setEnabled(false); 80 | ui->leNewSize->setEnabled(false); 81 | } 82 | 83 | void DialogScaleDevice::on_rbPercentage_clicked() 84 | { 85 | ui->leFactor->setEnabled(false); 86 | ui->lePercentage->setEnabled(true); 87 | ui->leOldSize->setEnabled(false); 88 | ui->leNewSize->setEnabled(false); 89 | } 90 | 91 | void DialogScaleDevice::on_rbSizeChange_clicked() 92 | { 93 | ui->leFactor->setEnabled(false); 94 | ui->lePercentage->setEnabled(false); 95 | ui->leOldSize->setEnabled(true); 96 | ui->leNewSize->setEnabled(true); 97 | } 98 | 99 | double DialogScaleDevice::get_scale() 100 | { 101 | return _dScale; 102 | } 103 | 104 | bool DialogScaleDevice::get_scale_diameter() 105 | { 106 | return _bScaleDiameter; 107 | } 108 | 109 | bool DialogScaleDevice::get_scale_focal() 110 | { 111 | return _bScaleFocal; 112 | } 113 | -------------------------------------------------------------------------------- /src/DeviceScaling.cpp: -------------------------------------------------------------------------------- 1 | // this file is covered by the General Public License version 2 or later 2 | // please see GPL.html for more details and licensing issues 3 | // copyright Etienne de Foras ( the author ) mailto: etienne.deforas@gmail.com 4 | 5 | #include "DeviceScaling.h" 6 | #include "OpticalDevice.h" 7 | 8 | #include 9 | 10 | //////////////////////////////////////////////////////////////////////////////// 11 | bool DeviceScaling::scale(OpticalDevice *pDevice, double dRatio, bool bScaleDiameter, bool bScaleFocal) 12 | { 13 | assert(pDevice!=0); 14 | 15 | if(dRatio<=0.) 16 | return false; 17 | 18 | bool bConvention=pDevice->relative_convention(); 19 | pDevice->set_relative_convention(true); 20 | 21 | for(int iS=0;iSnb_surface();iS++) 22 | { 23 | if(bScaleDiameter) 24 | { 25 | if(pDevice->is_clone(iS,DIAMETER)==false) 26 | { 27 | double dDiameter=pDevice->get(iS,DIAMETER,false); 28 | pDevice->set(iS,DIAMETER,dDiameter*dRatio); 29 | } 30 | 31 | if(pDevice->is_clone(iS,INNER_DIAMETER)==false) 32 | { 33 | double dInnerDiameter=pDevice->get(iS,INNER_DIAMETER,false); 34 | pDevice->set(iS,INNER_DIAMETER,dInnerDiameter*dRatio); 35 | } 36 | } 37 | 38 | if(bScaleFocal) 39 | { 40 | if(pDevice->is_clone(iS,THICK)==false) //always in relative convention 41 | { 42 | double dTHICK=pDevice->get(iS,THICK,false); 43 | pDevice->set(iS,THICK,dTHICK*dRatio); 44 | } 45 | 46 | if(pDevice->is_clone(iS,RADIUS_CURVATURE)==false) 47 | { 48 | double dRadiusCurvature=pDevice->get(iS,RADIUS_CURVATURE,false); 49 | pDevice->set(iS,RADIUS_CURVATURE,dRadiusCurvature*dRatio); 50 | } 51 | 52 | double dRatio2=dRatio*dRatio; 53 | double dRatio3=dRatio2*dRatio; 54 | double dRatio5=dRatio2*dRatio3; 55 | double dRatio7=dRatio2*dRatio5; 56 | double dRatio9=dRatio2*dRatio7; 57 | 58 | if(pDevice->is_clone(iS,R4)==false) 59 | { 60 | double dR4=pDevice->get(iS,R4,false); 61 | pDevice->set(iS,R4,dR4/dRatio3); 62 | } 63 | 64 | if(pDevice->is_clone(iS,R6)==false) 65 | { 66 | double dR6=pDevice->get(iS,R6,false); 67 | pDevice->set(iS,R6,dR6/dRatio5); 68 | } 69 | 70 | if(pDevice->is_clone(iS,R8)==false) 71 | { 72 | double dR8=pDevice->get(iS,R8,false); 73 | pDevice->set(iS,R8,dR8/dRatio7); 74 | } 75 | 76 | if(pDevice->is_clone(iS,R10)==false) 77 | { 78 | double dR10=pDevice->get(iS,R10,false); 79 | pDevice->set(iS,R10,dR10/dRatio9); 80 | } 81 | } 82 | } 83 | 84 | pDevice->set_relative_convention(bConvention); 85 | return true; 86 | } 87 | ////////////////////////////////////////////////////////////////////////////// 88 | -------------------------------------------------------------------------------- /src/Astree_vs2017.iss: -------------------------------------------------------------------------------- 1 | ; Script generated by the Inno Setup Script Wizard. 2 | ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! 3 | 4 | [Setup] 5 | AppName=Astree 6 | AppVerName=Astree 1.23 7 | AppPublisher=Etienne de Foras 8 | AppPublisherURL=http://edeforas.free.fr 9 | AppSupportURL=http://edeforas.free.fr 10 | AppUpdatesURL=http://edeforas.free.fr 11 | DefaultDirName={pf}\Astree 12 | DefaultGroupName=Astree 13 | AllowNoIcons=yes 14 | Compression=lzma 15 | SolidCompression=yes 16 | ChangesAssociations=yes 17 | SetupIconFile=".\Astree.ico" 18 | UninstallDisplayIcon="{app}\Astree.exe" 19 | OutputBaseFilename="setup_Astree" 20 | ArchitecturesInstallIn64BitMode=x64 21 | 22 | [Tasks] 23 | Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked 24 | Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked 25 | 26 | [Files] 27 | Source: "..\Astree.exe"; DestDir: "{app}"; Flags: ignoreversion 28 | Source: ".\*.qm"; DestDir: "{app}"; Flags: ignoreversion 29 | Source: "..\samples\telescopes\*.astree"; DestDir: "{app}\samples\telescopes"; Flags: ignoreversion 30 | Source: "..\samples\refractors\*.astree"; DestDir: "{app}\samples\refractors"; Flags: ignoreversion 31 | Source: "..\samples\others\*.astree"; DestDir: "{app}\samples\others"; Flags: ignoreversion 32 | Source: "..\samples\eyepieces\*.astree"; DestDir: "{app}\samples\eyepieces"; Flags: ignoreversion 33 | Source: "..\samples\afocal\*.astree"; DestDir: "{app}\samples\afocal"; Flags: ignoreversion 34 | Source: "..\glass\*.*"; DestDir: "{app}\glass"; Flags: ignoreversion 35 | Source: "C:\Qt\Qt5.11.0\5.11.0\msvc2017_64\bin\Qt5Core.dll"; DestDir: "{app}" 36 | Source: "C:\Qt\Qt5.11.0\5.11.0\msvc2017_64\bin\Qt5Gui.dll"; DestDir: "{app}" 37 | Source: "C:\Qt\Qt5.11.0\5.11.0\msvc2017_64\bin\Qt5Widgets.dll"; DestDir: "{app}" 38 | 39 | 40 | [INI] 41 | Filename: "{app}\Astree.url"; Section: "InternetShortcut"; Key: "URL"; String: "http://edeforas.free.fr" 42 | 43 | [Icons] 44 | Name: "{group}\Astree"; Filename: "{app}\Astree.exe"; WorkingDir: "{app}" 45 | Name: "{group}\Astree website"; Filename: "{app}\Astree.url" 46 | Name: "{group}\Astree Samples"; Filename: "{app}\samples\" 47 | Name: "{group}\{cm:UninstallProgram,Astree}"; Filename: "{uninstallexe}" 48 | Name: "{userdesktop}\Astree"; Filename: "{app}\Astree.exe"; Tasks: desktopicon; WorkingDir: "{app}" 49 | Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\Astree"; Filename: "{app}\Astree.exe"; Tasks: quicklaunchicon; WorkingDir: "{app}" 50 | 51 | [Run] 52 | Filename: "{app}\Astree.exe"; Description: "{cm:LaunchProgram,Astree}"; Flags: nowait postinstall skipifsilent 53 | 54 | [UninstallDelete] 55 | Type: files; Name: "{app}\Astree.url" 56 | 57 | [Registry] 58 | Root: HKCR; Subkey: ".Astree"; ValueType: string; ValueName: ""; ValueData: "Astree"; Flags: uninsdeletevalue 59 | Root: HKCR; Subkey: "Astree"; ValueType: string; ValueName: ""; ValueData: "Astree File"; Flags: uninsdeletekey 60 | Root: HKCR; Subkey: "Astree\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\Astree.exe,0" 61 | Root: HKCR; Subkey: "Astree\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\Astree.exe"" ""%1""" 62 | 63 | -------------------------------------------------------------------------------- /src/DeviceOptimizerRandom.cpp: -------------------------------------------------------------------------------- 1 | // this file is covered by the General Public License version 2 or later 2 | // please see GPL.html for more details and licensing issues 3 | // copyright Etienne de Foras ( the author ) mailto: etienne.deforas@gmail.com 4 | 5 | #include "DeviceOptimizerRandom.h" 6 | 7 | #include 8 | //////////////////////////////////////////////////////////////////////////////// 9 | DeviceOptimizerRandom::DeviceOptimizerRandom(): 10 | DeviceOptimizer() 11 | { } 12 | 13 | ////////////////////////////////////////////////////////////////////////////// 14 | DeviceOptimizerRandom::~DeviceOptimizerRandom() 15 | { } 16 | ////////////////////////////////////////////////////////////////////////////// 17 | OptimizerResult DeviceOptimizerRandom::optimize() 18 | { 19 | // random choice in hypercube (nb test:RANDOM_ITER_BY_AXIS^^N) then reduce on best 20 | assert(_pDevice!=0); 21 | 22 | double dMeritOrig=compute_demerit(); 23 | OpticalDevice deviceOrig(*_pDevice); 24 | 25 | if(_parameters.empty()) 26 | return eNothingToOptimize; 27 | 28 | ParameterSet paramBest=_parameters; 29 | 30 | // compute nb of iterations 31 | int iNbIter=1; 32 | for(unsigned int i=0;i=dop.dMin); 51 | } 52 | 53 | apply_parameter(paramBestTest); 54 | double dMerit=compute_demerit(); 55 | 56 | if(dMerit 9 | using namespace std; 10 | 11 | #define MAX_DIAMETER 1.e10 12 | #define LARGER_RADIUS_CHECK_TOLERANCIS 1e-6 //1 nm 13 | #define CURVATURE_FLAT 1e-20 14 | 15 | class Light; 16 | class Glass; 17 | class Photon; 18 | 19 | class Surface 20 | { 21 | public: 22 | Surface(); 23 | Surface(const Surface &rSurf); 24 | Surface& operator=(const Surface& rSurf); 25 | virtual ~Surface(); 26 | 27 | string name(); 28 | void name(string sName); 29 | 30 | string type() const; 31 | bool set_type(string sType); 32 | 33 | void set_x(double dx); 34 | double x() const; 35 | 36 | void set_y(double dy); 37 | double y() const; 38 | 39 | void set_z(double dz); 40 | double z() const; 41 | 42 | void set_diameter(double dDiameter); 43 | void set_auto_diameter(bool bAutoDiameter); 44 | bool get_auto_diameter() const; 45 | double diameter() const; 46 | 47 | void set_inner_diameter(double dInnerDiameter); 48 | void set_auto_inner_diameter(bool bAutoInnerDiameter); 49 | bool get_auto_inner_diameter() const; 50 | double inner_diameter() const; 51 | 52 | void set_radius_curvature(double dRadiusCurvature); 53 | double radius_curvature() const; 54 | 55 | void set_curvature(double dCurvature); 56 | double curvature() const; 57 | 58 | void set_R4(double dR4); 59 | void set_R6(double dR6); 60 | void set_R8(double dR8); 61 | void set_R10(double dR10); 62 | 63 | double R4() const; 64 | double R6() const; 65 | double R8() const; 66 | double R10() const; 67 | bool is_aspheric() const; 68 | 69 | void set_conic(double dConic); 70 | double conic() const; 71 | 72 | void receive(Light& l); 73 | 74 | bool compute_z(double x,double y,double& z); 75 | 76 | void set_comment(string sComment); 77 | string comment() const; 78 | 79 | private: 80 | bool update_auto_diameter(double dX,double dY); //and return true if point is inside diameters 81 | void local_ref(Photon& p) const; 82 | void global_ref(Photon& p) const; 83 | 84 | void stop(Light& l); 85 | void stop_infinite(Light& l); 86 | void reflect(Light& l); 87 | void transmit(Light& l); 88 | 89 | void stop_photon(Photon& p); 90 | void reflect_photon(Photon& p); 91 | void transmit_photon(Photon& p); 92 | 93 | bool compute_normal(double x,double y, double z,double& nx,double& ny,double &nz); 94 | void update_geometry(); 95 | 96 | Glass* _pMaterial; 97 | Glass* _pMaterialPrev; 98 | Glass* _pMaterialNext; 99 | 100 | double _dConic; 101 | double _dCurvature; 102 | 103 | bool _bIsFlat; 104 | bool _bIsSpherical; 105 | bool _bIsConic; 106 | bool _bIsAspheric; 107 | bool _bIsPerfect; //simple geometrical optic 108 | double _dR4, _dR6, _dR8, _dR10; // _dR4 = coef of h**4 , etc ( with h**2=x*x+y*y) 109 | 110 | string _sType; 111 | string _sComment; 112 | 113 | double _x,_y,_z; 114 | double _dDiameter,_dDiameter2; 115 | double _dInnerDiameter,_dInnerDiameter2; 116 | 117 | bool _bAutoDiameter; 118 | bool _bAutoInnerDiameter; 119 | }; 120 | 121 | #endif 122 | -------------------------------------------------------------------------------- /src/DialogMediumManager.cpp: -------------------------------------------------------------------------------- 1 | #include "DialogMediumManager.h" 2 | #include "ui_DialogMediumManager.h" 3 | 4 | #include "GlassManager.h" 5 | #include "Glass.h" 6 | 7 | ////////////////////////////////////////////////////////////////////// 8 | DialogMediumManager::DialogMediumManager(QWidget *parent, string sGlass) : 9 | QDialog(parent), 10 | ui(new Ui::DialogMediumManager) 11 | { 12 | ui->setupUi(this); 13 | 14 | vector lsM; 15 | GlassManager::singleton().list_available(lsM); 16 | 17 | ui->twMedium->setRowCount((int)lsM.size()); 18 | 19 | QStringList qsl; 20 | qsl+="Maker"; 21 | qsl+="Name"; 22 | qsl+="Formulae"; 23 | qsl+="Nd"; 24 | qsl+="Vd"; 25 | qsl+="Ne"; 26 | qsl+="Ve"; 27 | 28 | ui->twMedium->setColumnCount(qsl.size()); 29 | ui->twMedium->setHorizontalHeaderLabels (qsl); 30 | 31 | int iPosGlass=-1; 32 | 33 | for(int i=0;i<(int)lsM.size();i++) 34 | { 35 | Glass* m=GlassManager::singleton().create(lsM[i]); 36 | 37 | QTableWidgetItem* qwmaker=new QTableWidgetItem(m->maker().c_str()); 38 | ui->twMedium->setItem(i,0,qwmaker); 39 | 40 | QTableWidgetItem* qwname=new QTableWidgetItem(m->name().c_str()); 41 | ui->twMedium->setItem(i,1,qwname); 42 | 43 | if(sGlass==m->name()) 44 | iPosGlass=i; 45 | 46 | QTableWidgetItem* qwformula=new QTableWidgetItem(m->formula().c_str()); 47 | ui->twMedium->setItem(i,2,qwformula); 48 | 49 | double dNd,dVd,dNe,dVe; 50 | m->compute_NdVd(dNd,dVd); 51 | m->compute_NeVe(dNe,dVe); 52 | 53 | QTableWidgetItem* qwtiNd=new QTableWidgetItem(QString::number(dNd,'f',5)); 54 | ui->twMedium->setItem(i,3,qwtiNd); 55 | 56 | QTableWidgetItem* qwtiVd=new QTableWidgetItem(QString::number(dVd,'f',3)); 57 | ui->twMedium->setItem(i,4,qwtiVd); 58 | 59 | QTableWidgetItem* qwtiNe=new QTableWidgetItem(QString::number(dNe,'f',5)); 60 | ui->twMedium->setItem(i,5,qwtiNe); 61 | 62 | QTableWidgetItem* qwtiVe=new QTableWidgetItem(QString::number(dVe,'f',3)); 63 | ui->twMedium->setItem(i,6,qwtiVe); 64 | 65 | delete m; 66 | } 67 | 68 | if(iPosGlass!=-1) 69 | { 70 | ui->twMedium->setCurrentCell(iPosGlass,1); 71 | ui->btnOk->hide(); 72 | } 73 | else 74 | { 75 | ui->btnSelect->hide(); 76 | ui->btnCancel->hide(); 77 | } 78 | } 79 | ////////////////////////////////////////////////////////////////////// 80 | DialogMediumManager::~DialogMediumManager() 81 | { 82 | delete ui; 83 | } 84 | ////////////////////////////////////////////////////////////////////// 85 | string DialogMediumManager::selected_glass() const 86 | { 87 | return _sSelectedGlass; 88 | } 89 | ////////////////////////////////////////////////////////////////////// 90 | void DialogMediumManager::on_btnSelect_clicked() 91 | { 92 | int iRow=ui->twMedium->currentRow(); 93 | _sSelectedGlass=ui->twMedium->item(iRow,1)->text().toStdString(); 94 | 95 | accept(); 96 | } 97 | ////////////////////////////////////////////////////////////////////// 98 | void DialogMediumManager::on_btnCancel_clicked() 99 | { 100 | reject(); 101 | } 102 | ////////////////////////////////////////////////////////////////////// 103 | void DialogMediumManager::on_btnOk_clicked() 104 | { 105 | _sSelectedGlass=""; 106 | accept(); 107 | } 108 | ////////////////////////////////////////////////////////////////////// 109 | -------------------------------------------------------------------------------- /src/GlassManager.cpp: -------------------------------------------------------------------------------- 1 | // this file is covered by the General Public License version 2 or later 2 | // please see GPL.html for more details and licensing issues 3 | // copyright Etienne de Foras ( the author ) mailto: etienne.deforas@gmail.com 4 | 5 | #include "GlassManager.h" 6 | #include "Glass.h" 7 | #include "MaterialAir.h" 8 | #include "MaterialVacuum.h" 9 | #include "MaterialWater.h" 10 | #include "MaterialUnknow.h" 11 | 12 | #include 13 | 14 | GlassManager* GlassManager::_pGlassManager=0; 15 | 16 | ////////////////////////////////////////////////////////////////////////////// 17 | GlassManager::GlassManager() 18 | { 19 | _vGlass.push_back(new MaterialAir); 20 | _vGlass.push_back(new MaterialVacuum); 21 | _vGlass.push_back(new MaterialWater); 22 | } 23 | ////////////////////////////////////////////////////////////////////////////// 24 | GlassManager::~GlassManager() 25 | { 26 | for(unsigned int i=0;i<_vGlass.size();i++) 27 | delete _vGlass[i]; //TODO check destructor is called 28 | } 29 | ////////////////////////////////////////////////////////////////////////////// 30 | Glass* GlassManager::create(string sMaterial) const 31 | { 32 | for(unsigned int i=0;i<_vGlass.size();i++) 33 | { 34 | if(_vGlass[i]->name()==sMaterial) 35 | return _vGlass[i]->clone(); 36 | } 37 | 38 | //if glass does not exist , try find N- behind(Schott lead free glasses) 39 | sMaterial="N-"+sMaterial; 40 | for(unsigned int i=0;i<_vGlass.size();i++) 41 | { 42 | if(_vGlass[i]->name()==sMaterial) 43 | return _vGlass[i]->clone(); 44 | } 45 | 46 | //error case 47 | Glass* pM=new MaterialUnknow; 48 | pM->set_formula("unknown"); 49 | pM->set_name(sMaterial); 50 | pM->set_maker("unknown_glass"); 51 | return pM; 52 | } 53 | ////////////////////////////////////////////////////////////////////////////// 54 | void GlassManager::destroy(Glass* pMaterial) 55 | { 56 | delete pMaterial; 57 | } 58 | ////////////////////////////////////////////////////////////////////////////// 59 | GlassManager& GlassManager::singleton() 60 | { 61 | if(_pGlassManager==0) 62 | _pGlassManager= new GlassManager; //TODO delete at exit 63 | 64 | assert(_pGlassManager); 65 | return *_pGlassManager; 66 | } 67 | ////////////////////////////////////////////////////////////////////////////// 68 | void GlassManager::list_available(vector& vsAvailable) 69 | { 70 | vsAvailable.clear(); 71 | for(unsigned int i=0;i<_vGlass.size();i++) 72 | vsAvailable.push_back(_vGlass[i]->name()); 73 | } 74 | ////////////////////////////////////////////////////////////////////////////// 75 | bool GlassManager::exist(string sGlass) const 76 | { 77 | for(unsigned int i=0;i<_vGlass.size();i++) 78 | { 79 | if(_vGlass[i]->name()==sGlass) 80 | return true; 81 | } 82 | 83 | return false; 84 | } 85 | ////////////////////////////////////////////////////////////////////////////// 86 | unsigned int GlassManager::solid_color(string sMaterial) 87 | { 88 | for(unsigned int i=0;i<_vGlass.size();i++) 89 | { 90 | if(_vGlass[i]->name()==sMaterial) 91 | return _vGlass[i]->solid_color(); 92 | } 93 | return 0xffffff; 94 | } 95 | ////////////////////////////////////////////////////////////////////////////// 96 | void GlassManager::inject(Glass* pGlass) //take ownership of pGlass 97 | { 98 | _vGlass.push_back(pGlass); 99 | } 100 | ////////////////////////////////////////////////////////////////////////////// 101 | -------------------------------------------------------------------------------- /samples/telescopes/Honder_Riccardi.astree: -------------------------------------------------------------------------------- 1 | 0.diameter=200 2 | 0.inner_diameter=68 3 | 0.radius_curvature=4566.787349 4 | 0.thick=9.884678748 5 | 0.type=BK7 6 | 1.diameter=200.0289656 7 | 1.diameter.auto=1 8 | 1.inner_diameter=68 9 | 1.radius_curvature=-7332.9404 10 | 1.thick=1006.260297 11 | 1.type=Air 12 | 2.diameter=191.3877096 13 | 2.diameter.auto=1 14 | 2.radius_curvature=-1324.656093 15 | 2.thick=9.884678748 16 | 2.type=BK7 17 | 3.diameter=191.8766047 18 | 3.diameter.auto=1 19 | 3.radius_curvature=-2195.666029 20 | 3.thick=-9.884678748 21 | 3.thick.clone=2 22 | 3.thick.clone.gain=-1 23 | 3.type=reflect 24 | 4.diameter=190.4013338 25 | 4.diameter.auto=1 26 | 4.radius_curvature=-1324.656093 27 | 4.radius_curvature.clone=2 28 | 4.radius_curvature.clone.gain=1 29 | 4.thick=-1018.121911 30 | 4.type=Air 31 | 5.diameter=63.38120901 32 | 5.diameter.auto=1 33 | 5.radius_curvature=-334.2163683 34 | 5.thick=-9.884678748 35 | 5.type=BK7 36 | 6.diameter=62.14235175 37 | 6.diameter.auto=1 38 | 6.radius_curvature=-10602.70991 39 | 6.thick=-133.3759258 40 | 6.type=Air 41 | 7.diameter=32.61271413 42 | 7.diameter.auto=1 43 | 7.radius_curvature=inf 44 | 7.thick=0 45 | 7.type=image 46 | 7.z.autofocus=1 47 | device.note=from http://www.telescope-optics.net/honders_camera.htm 48 | device.note= 49 | device.note=Honders riccardi telescope, diameter is reduced to 200mm 50 | device.note= 51 | device.note=Advantages: 52 | device.note=- all surfaces are spherical 53 | device.note=- only BK7 glass is used 54 | device.note=- image is very good, in all the field 55 | device.note=- image field is flat 56 | device.note= 57 | device.note=The drawbacks are: 58 | device.note=- the number of surface to make (6) 59 | device.note=- the size of the tube 60 | device.note=- need to add a secondary to use it as a Newton telescope 61 | device.note= 62 | device.note=Scaled to FNumber=6 63 | device.note= 64 | device.note=Design has been re-optimised 65 | device.relative_convention=1 66 | image.autocurvature=0 67 | image.autofocus=1 68 | light.colors=Red.Yellow.Green.Blue. 69 | light.half_field_of_view=0.8 70 | light.nbsteps=3 71 | note=from http://www.telescope-optics.net/honders_camera.htm 72 | note= 73 | note=Honders riccardi telescope, diameter is reduced to 200mm 74 | note= 75 | note=Advantages: 76 | note=- all surfaces are spherical 77 | note=- only BK7 glass is used 78 | note=- image is very good, in all the field 79 | note=- image field is flat 80 | note= 81 | note=The drawbacks are: 82 | note=- the number of surface to make (6) 83 | note=- the size of the tube 84 | note=- need to add a secondary to use it as a Newton telescope 85 | note= 86 | note=Scaled to FNumber=6 87 | note= 88 | note=Design has been re-optimised 89 | parameter.optimizer.0.checked=1 90 | parameter.optimizer.0.parameter=RCurv 91 | parameter.optimizer.0.surface=1 92 | parameter.optimizer.1.checked=1 93 | parameter.optimizer.1.parameter=RCurv 94 | parameter.optimizer.1.surface=2 95 | parameter.optimizer.2.checked=1 96 | parameter.optimizer.2.parameter=RCurv 97 | parameter.optimizer.2.surface=3 98 | parameter.optimizer.3.checked=1 99 | parameter.optimizer.3.parameter=RCurv 100 | parameter.optimizer.3.surface=4 101 | parameter.optimizer.4.checked=0 102 | parameter.optimizer.5.checked=1 103 | parameter.optimizer.5.parameter=RCurv 104 | parameter.optimizer.5.surface=6 105 | parameter.optimizer.6.checked=1 106 | parameter.optimizer.6.parameter=RCurv 107 | parameter.optimizer.6.surface=7 108 | parameter.optimizer.7.checked=0 109 | parameter.optimizer.8.checked=0 110 | parameter.optimizer.9.checked=0 111 | parameter.optimizer.merit=FullFrameMaxError 112 | parameter.showLightOffAxis=50 113 | -------------------------------------------------------------------------------- /src/Glass.cpp: -------------------------------------------------------------------------------- 1 | // this file is covered by the General Public License version 2 or later 2 | // please see GPL.html for more details and licensing issues 3 | // copyright Etienne de Foras ( the author ) mailto: etienne.deforas@gmail.com 4 | 5 | #include "Glass.h" 6 | 7 | ////////////////////////////////////////////////////////////////////////////// 8 | Glass::Glass(): 9 | _sMaker("unknow"), 10 | _sName("unknow"), 11 | _sFormula("unknow"), 12 | _iSolidColor(0), 13 | _dLastLambda(0.), 14 | _dLastIndex(-1.) 15 | { } 16 | ////////////////////////////////////////////////////////////////////////////// 17 | Glass::Glass(const Glass& m): 18 | _sMaker(m._sMaker), 19 | _sName(m._sName), 20 | _sFormula(m._sFormula) 21 | { 22 | _iSolidColor=m._iSolidColor; 23 | _dLastIndex=-1.; 24 | _dLastLambda=0.; 25 | } 26 | ////////////////////////////////////////////////////////////////////////////// 27 | Glass::~Glass() 28 | { } 29 | ////////////////////////////////////////////////////////////////////////////// 30 | double Glass::index(double dLambdaMicrons) 31 | { 32 | if(dLambdaMicrons!=_dLastLambda) 33 | { 34 | _dLastLambda=dLambdaMicrons; 35 | _dLastIndex=calc_index(dLambdaMicrons); 36 | } 37 | 38 | return _dLastIndex; 39 | } 40 | ////////////////////////////////////////////////////////////////////////////// 41 | string Glass::maker() const 42 | { 43 | return _sMaker; 44 | } 45 | ////////////////////////////////////////////////////////////////////////////// 46 | void Glass::set_maker(string sMaker) 47 | { 48 | _sMaker=sMaker; 49 | } 50 | ////////////////////////////////////////////////////////////////////////////// 51 | string Glass::name() const 52 | { 53 | return _sName; 54 | } 55 | ////////////////////////////////////////////////////////////////////////////// 56 | void Glass::set_name(string sName) 57 | { 58 | _sName=sName; 59 | } 60 | ////////////////////////////////////////////////////////////////////////////// 61 | void Glass::set_formula(string sFormula) 62 | { 63 | _sFormula=sFormula; 64 | } 65 | ////////////////////////////////////////////////////////////////////////////// 66 | int Glass::solid_color() const 67 | { 68 | return _iSolidColor; 69 | } 70 | ////////////////////////////////////////////////////////////////////////////// 71 | void Glass::set_solid_color(int iSolidColor) 72 | { 73 | _iSolidColor=iSolidColor; 74 | } 75 | ////////////////////////////////////////////////////////////////////////////// 76 | string Glass::formula() const 77 | { 78 | return _sFormula; 79 | } 80 | ////////////////////////////////////////////////////////////////////////////// 81 | void Glass::compute_NdVd(double &Nd,double& Vd) 82 | { 83 | double dLambdaD=587.5618e-3; // He in microns 84 | double dLambdaF=486.13e-3; // H in microns 85 | double dLambdaC=656.27e-3; // H in microns 86 | 87 | Nd=index(dLambdaD); 88 | double Nf=index(dLambdaF); 89 | double Nc=index(dLambdaC); 90 | 91 | if(Nf!=Nc) 92 | Vd=(Nd-1.)/(Nf-Nc); 93 | else 94 | Vd=-1.; //not applicable 95 | } 96 | ////////////////////////////////////////////////////////////////////////////// 97 | void Glass::compute_NeVe(double &Ne, double& Ve) 98 | { 99 | double dLambdae=546.07e-3; // Hg in microns 100 | double dLambdaFp=479.99e-3; // Cd in microns 101 | double dLambdaCp=643.85e-3; // Cd in microns 102 | 103 | Ne=index(dLambdae); 104 | double Nfp=index(dLambdaFp); 105 | double Ncp=index(dLambdaCp); 106 | 107 | if(Nfp!=Ncp) 108 | Ve=(Ne-1.)/(Nfp-Ncp); 109 | else 110 | Ve=-1.; //not applicable 111 | } 112 | ////////////////////////////////////////////////////////////////////////////// 113 | -------------------------------------------------------------------------------- /src/GlassCatalogIo.cpp: -------------------------------------------------------------------------------- 1 | // this file is covered by the General Public License version 2 or later 2 | // please see GPL.html for more details and licensing issues 3 | // copyright Etienne de Foras ( the author ) mailto: etienne.deforas@gmail.com 4 | 5 | #include 6 | #include 7 | using namespace std; 8 | 9 | #include "GlassCatalogIo.h" 10 | #include "GlassSellmeier.h" 11 | #include "GlassExtended2.h" 12 | #include "GlassManager.h" 13 | 14 | //////////////////////////////////////////////////////////////////////////////// 15 | bool GlassCatalogIO::load(string sFile,GlassManager& pManager) 16 | { 17 | ifstream f(sFile.c_str(),ios::in); 18 | 19 | bool bGlassPending=false; 20 | 21 | string sName; 22 | int iGlassFormula = 0; 23 | string sMaker; 24 | double B1=0.; 25 | double B2=0.; 26 | double B3=0.; 27 | double C1=0.; 28 | double C2=0.; 29 | double C3=0.; 30 | double B4=0.; 31 | double B5=0.; 32 | 33 | auto iIndexStartMaker=sFile.find_last_of('\\'); 34 | if( (iIndexStartMaker!=string::npos) ) 35 | sMaker=sFile.substr(iIndexStartMaker+1); 36 | auto iIndexSeparator=sMaker.find_first_of("_. -"); 37 | if( (iIndexSeparator!=string::npos) ) 38 | sMaker=sMaker.substr(0,iIndexSeparator); 39 | 40 | while(!f.eof()) 41 | { 42 | string sLine; 43 | ::getline(f,sLine); 44 | 45 | //trim first space if any 46 | size_t iPos=sLine.find_first_not_of(" "); 47 | if(iPos!=string::npos) 48 | sLine=sLine.substr(iPos); 49 | 50 | if(sLine.size()<2) 51 | continue; // nothing to parse //TODO test bGlassPending before exit 52 | 53 | string sKey=sLine.substr(0,2); 54 | string sVal=sLine.substr(2); // can be empty 55 | 56 | //trim first space if any 57 | size_t iPos2=sVal.find_first_not_of(" "); 58 | if(iPos2!=string::npos) 59 | sVal=sVal.substr(iPos2); 60 | 61 | if(sKey=="CC") 62 | { 63 | // pCatalog->set_comment(sVal); 64 | } 65 | 66 | if(sKey=="NM") 67 | { 68 | if(bGlassPending) 69 | { 70 | if(iGlassFormula==2) //Sellmeier 71 | { 72 | //create and store the glass 73 | GlassSellmeier* pGlass=new GlassSellmeier; 74 | pGlass->set_maker(sMaker); 75 | pGlass->set_name(sName); 76 | pGlass->set_coefs(B1,B2,B3,C1,C2,C3); 77 | pGlass->set_solid_color(8844025); //TODO 78 | pManager.inject(pGlass); 79 | } 80 | else if(iGlassFormula==12) //Extended2 81 | { 82 | //create and store the glass 83 | GlassExtended2* pGlass=new GlassExtended2; 84 | pGlass->set_maker(sMaker); 85 | pGlass->set_name(sName); 86 | pGlass->set_coefs(B1,C1,B2,C2,B3,C3,B4,B5); 87 | pGlass->set_solid_color(8844025); //TODO 88 | pManager.inject(pGlass); 89 | } 90 | else 91 | { 92 | //TODO 93 | } 94 | } 95 | 96 | //compute subkey 97 | stringstream ss(sVal); 98 | ss >> sName >> iGlassFormula; 99 | 100 | bGlassPending=true; 101 | } 102 | 103 | if(sKey=="CD") //GlassCoef formula 104 | { 105 | stringstream ss(sVal); 106 | ss >> B1 >> C1 >> B2 >> C2 >> B3 >> C3 >> B4 >> B5; //may have more coef than needed 107 | } 108 | 109 | // pCatalog->set_maker("unknown"); //TODO 110 | } 111 | 112 | return true; 113 | } 114 | //////////////////////////////////////////////////////////////////////////////// 115 | -------------------------------------------------------------------------------- /samples/telescopes/EdF_T300_F5.astree: -------------------------------------------------------------------------------- 1 | 0.diameter=300 2 | 0.radius_curvature=2210.31828 3 | 0.thick=18.42103329 4 | 0.type=BK7 5 | 1.diameter=300 6 | 1.diameter.auto=1 7 | 1.diameter.clone=0 8 | 1.diameter.clone.gain=1 9 | 1.radius_curvature=-6354.881199 10 | 1.thick=300.0000148 11 | 1.type=Air 12 | 2.diameter=300 13 | 2.diameter.auto=1 14 | 2.diameter.clone=0 15 | 2.diameter.clone.gain=1 16 | 2.radius_curvature=-1041.508248 17 | 2.thick=15.65589159 18 | 2.type=BK7 19 | 3.diameter=300 20 | 3.diameter.auto=1 21 | 3.diameter.clone=0 22 | 3.diameter.clone.gain=1 23 | 3.radius_curvature=-2718.427229 24 | 3.thick=-15.65589159 25 | 3.thick.clone=2 26 | 3.thick.clone.gain=-1 27 | 3.type=reflect 28 | 4.diameter=300 29 | 4.diameter.auto=1 30 | 4.diameter.clone=0 31 | 4.diameter.clone.gain=1 32 | 4.radius_curvature=-1041.508248 33 | 4.radius_curvature.clone=2 34 | 4.radius_curvature.clone.gain=1 35 | 4.thick=-300.0000148 36 | 4.thick.clone=1 37 | 4.thick.clone.gain=-1 38 | 4.type=Air 39 | 5.diameter=300 40 | 5.diameter.auto=1 41 | 5.diameter.clone=0 42 | 5.diameter.clone.gain=1 43 | 5.radius_curvature=-6354.881199 44 | 5.radius_curvature.clone=1 45 | 5.radius_curvature.clone.gain=1 46 | 5.thick=-18.42103329 47 | 5.thick.clone=0 48 | 5.thick.clone.gain=-1 49 | 5.type=BK7 50 | 6.diameter=300 51 | 6.diameter.auto=1 52 | 6.diameter.clone=0 53 | 6.diameter.clone.gain=1 54 | 6.radius_curvature=2210.31828 55 | 6.radius_curvature.clone=0 56 | 6.radius_curvature.clone.gain=1 57 | 6.thick=-1130.869915 58 | 6.type=Air 59 | 7.diameter=28.61172223 60 | 7.diameter.auto=1 61 | 7.radius_curvature=inf 62 | 7.thick=0 63 | 7.type=image 64 | 7.z.autofocus=1 65 | device.note=Custom formula from Etienne de Foras: 66 | device.note=- 4 spherical surfaces 67 | device.note= 68 | device.note= 69 | device.note=Advantages: 70 | device.note=- all surfaces are spherical 71 | device.note=- only BK7 glass is used 72 | device.note=- image is good, in all the field 73 | device.note=- image field is flat 74 | device.note= 75 | device.note=The drawbacks are: 76 | device.note=- the number of surface to make: 4 77 | device.note=- need to add a secondary to use it as a Newton telescope 78 | device.note=- need unwanted light analysis 79 | device.note= 80 | device.note=Scaled to FNumber=5 81 | device.note= 82 | device.note=Surfaces has been roughly optimised 83 | device.note= 84 | device.note=Work in progress 85 | device.relative_convention=1 86 | image.autocurvature=0 87 | image.autofocus=1 88 | light.colors=Red.Yellow.Green.Blue. 89 | light.half_field_of_view=0.55 90 | light.nbsteps=3 91 | note=Custom formula from Etienne de Foras: 92 | note=- 4 spherical surfaces 93 | note= 94 | note= 95 | note=Advantages: 96 | note=- all surfaces are spherical 97 | note=- only BK7 glass is used 98 | note=- image is good, in all the field 99 | note=- image field is flat 100 | note= 101 | note=The drawbacks are: 102 | note=- the number of surface to make: 4 103 | note=- need to add a secondary to use it as a Newton telescope 104 | note=- need unwanted light analysis 105 | note= 106 | note=Scaled to FNumber=5 107 | note= 108 | note=Surfaces has been roughly optimised 109 | note= 110 | note=Work in progress 111 | parameter.optimizer.0.checked=0 112 | parameter.optimizer.0.parameter=RCurv 113 | parameter.optimizer.0.surface=1 114 | parameter.optimizer.1.checked=0 115 | parameter.optimizer.1.parameter=RCurv 116 | parameter.optimizer.1.surface=2 117 | parameter.optimizer.2.checked=0 118 | parameter.optimizer.2.parameter=RCurv 119 | parameter.optimizer.2.surface=3 120 | parameter.optimizer.3.checked=0 121 | parameter.optimizer.3.parameter=RCurv 122 | parameter.optimizer.3.surface=4 123 | parameter.optimizer.4.checked=0 124 | parameter.optimizer.4.parameter=Thick 125 | parameter.optimizer.4.surface=1 126 | parameter.optimizer.5.checked=0 127 | parameter.optimizer.5.parameter=Thick 128 | parameter.optimizer.5.surface=2 129 | parameter.optimizer.6.checked=0 130 | parameter.optimizer.6.parameter=Thick 131 | parameter.optimizer.6.surface=3 132 | parameter.optimizer.7.checked=0 133 | parameter.optimizer.8.checked=0 134 | parameter.optimizer.9.checked=0 135 | parameter.optimizer.merit=FullFrameMean 136 | parameter.showLightOffAxis=100 137 | -------------------------------------------------------------------------------- /samples/telescopes/EdF_T200_F2.5.astree: -------------------------------------------------------------------------------- 1 | 0.diameter=200 2 | 0.radius_curvature=905.6990792 3 | 0.thick=9.505703422 4 | 0.type=BK7 5 | 1.diameter=199.7650005 6 | 1.diameter.auto=1 7 | 1.radius_curvature=inf 8 | 1.thick=170.4501162 9 | 1.type=Air 10 | 2.conic=0.7245243358 11 | 2.diameter=185.2462493 12 | 2.diameter.auto=1 13 | 2.radius_curvature=-506.1119343 14 | 2.thick=8.55513308 15 | 2.type=BK7 16 | 3.diameter=186.1133883 17 | 3.diameter.auto=1 18 | 3.radius_curvature=-950.5703422 19 | 3.thick=-8.55513308 20 | 3.thick.clone=2 21 | 3.thick.clone.gain=-1 22 | 3.type=reflect 23 | 4.diameter=182.1178419 24 | 4.diameter.auto=1 25 | 4.radius_curvature=-506.1119343 26 | 4.radius_curvature.clone=2 27 | 4.radius_curvature.clone.gain=1 28 | 4.thick=-170.4501162 29 | 4.thick.clone=1 30 | 4.thick.clone.gain=-1 31 | 4.type=Air 32 | 5.diameter=132.4936464 33 | 5.diameter.auto=1 34 | 5.radius_curvature=inf 35 | 5.radius_curvature.clone=1 36 | 5.radius_curvature.clone.gain=1 37 | 5.thick=-9.505703422 38 | 5.thick.clone=0 39 | 5.thick.clone.gain=-1 40 | 5.type=BK7 41 | 6.diameter=131.0617006 42 | 6.diameter.auto=1 43 | 6.radius_curvature=905.6990792 44 | 6.radius_curvature.clone=0 45 | 6.radius_curvature.clone.gain=1 46 | 6.thick=-305.3690507 47 | 6.type=Air 48 | 7.diameter=12.46195304 49 | 7.diameter.auto=1 50 | 7.radius_curvature=inf 51 | 7.thick=0 52 | 7.type=image 53 | 7.z.autofocus=1 54 | device.note=Mangin and double pass, wide field telescope 55 | device.note= 56 | device.note=by Etienne de Foras 57 | device.note= 58 | device.note=(work in progress) 59 | device.note= 60 | device.note=One surface is conic but can be foucaulted (concave) 61 | device.note=all other surfaces are spherical 62 | device.note=glass is BK7 only 63 | device.note=Numerical aperture is 2.5 64 | device.note= 65 | device.note= 66 | device.note=Image field is flat 67 | device.note=Image is correct in all the field 68 | device.note= 69 | device.note=The drawbacks are: 70 | device.note=- the number and curvature of all surface to make 4 71 | device.note= 72 | device.note=Surfaces has been slitlghy optimised 73 | device.relative_convention=1 74 | image.autocurvature=0 75 | image.autofocus=1 76 | light.colors=Red.Yellow.Green.Blue. 77 | light.half_field_of_view=0.7 78 | light.nbsteps=3 79 | note=Mangin and double pass, wide field telescope 80 | note= 81 | note=by Etienne de Foras 82 | note= 83 | note=(work in progress) 84 | note= 85 | note=One surface is conic but can be foucaulted (concave) 86 | note=all other surfaces are spherical 87 | note=glass is BK7 only 88 | note=Numerical aperture is 2.5 89 | note= 90 | note= 91 | note=Image field is flat 92 | note=Image is correct in all the field 93 | note= 94 | note=The drawbacks are: 95 | note=- the number and curvature of all surface to make 4 96 | note= 97 | note=Surfaces has been slitlghy optimised 98 | parameter.optimizer.0.checked=0 99 | parameter.optimizer.0.max= 100 | parameter.optimizer.0.min= 101 | parameter.optimizer.0.parameter=RCurv 102 | parameter.optimizer.0.surface=1 103 | parameter.optimizer.1.checked=0 104 | parameter.optimizer.1.max= 105 | parameter.optimizer.1.min= 106 | parameter.optimizer.1.parameter=RCurv 107 | parameter.optimizer.1.surface=2 108 | parameter.optimizer.2.checked=0 109 | parameter.optimizer.2.max= 110 | parameter.optimizer.2.min= 111 | parameter.optimizer.2.parameter=RCurv 112 | parameter.optimizer.2.surface=3 113 | parameter.optimizer.3.checked=0 114 | parameter.optimizer.3.max= 115 | parameter.optimizer.3.min= 116 | parameter.optimizer.3.parameter=RCurv 117 | parameter.optimizer.3.surface=4 118 | parameter.optimizer.4.checked=0 119 | parameter.optimizer.4.max= 120 | parameter.optimizer.4.min= 121 | parameter.optimizer.4.parameter=Conic 122 | parameter.optimizer.4.surface=3 123 | parameter.optimizer.5.checked=0 124 | parameter.optimizer.5.max= 125 | parameter.optimizer.5.min= 126 | parameter.optimizer.5.parameter=Thick 127 | parameter.optimizer.5.surface=1 128 | parameter.optimizer.6.checked=0 129 | parameter.optimizer.6.parameter=Thick 130 | parameter.optimizer.6.surface=2 131 | parameter.optimizer.7.checked=0 132 | parameter.optimizer.7.parameter=Thick 133 | parameter.optimizer.7.surface=3 134 | parameter.optimizer.8.checked=0 135 | parameter.optimizer.9.checked=0 136 | parameter.optimizer.merit=FullFrameMaxError 137 | parameter.showLightOffAxis=0 138 | -------------------------------------------------------------------------------- /src/DockLightProperties.cpp: -------------------------------------------------------------------------------- 1 | // this file is covered by the General Public License version 2 or later 2 | // please see GPL.html for more details and licensing issues 3 | // copyright Etienne de Foras ( the author ) mailto: etienne.deforas@gmail.com 4 | 5 | 6 | #include "DockLightProperties.h" 7 | #include "ui_DockLightProperties.h" 8 | 9 | #include "MainWindow.h" 10 | #include "OpticalDevice.h" 11 | 12 | DockLightProperties::DockLightProperties(QWidget *parent) : 13 | QDockWidget(parent), 14 | m_ui(new Ui::DockLightProperties) 15 | { 16 | _bBlockSignals=true; 17 | 18 | m_ui->setupUi(this); 19 | 20 | connect(m_ui->leHalfFOV,SIGNAL(editingFinished()),this,SLOT(OnLightChange())); 21 | 22 | connect(m_ui->cbIR,SIGNAL(stateChanged(int)),this,SLOT(OnLightChange())); 23 | connect(m_ui->cbRed,SIGNAL(stateChanged(int)),this,SLOT(OnLightChange())); 24 | connect(m_ui->cbYellowBlack,SIGNAL(stateChanged(int)),this,SLOT(OnLightChange())); 25 | connect(m_ui->cbYellow,SIGNAL(stateChanged(int)),this,SLOT(OnLightChange())); 26 | connect(m_ui->cbGreen,SIGNAL(stateChanged(int)),this,SLOT(OnLightChange())); 27 | connect(m_ui->cbBlue,SIGNAL(stateChanged(int)),this,SLOT(OnLightChange())); 28 | connect(m_ui->cbUV,SIGNAL(stateChanged(int)),this,SLOT(OnLightChange())); 29 | 30 | _bBlockSignals=false; 31 | } 32 | 33 | DockLightProperties::~DockLightProperties() 34 | { 35 | delete m_ui; 36 | } 37 | 38 | void DockLightProperties::changeEvent(QEvent *e) 39 | { 40 | QDockWidget::changeEvent(e); 41 | switch (e->type()) 42 | { 43 | case QEvent::LanguageChange: 44 | m_ui->retranslateUi(this); 45 | break; 46 | default: 47 | break; 48 | } 49 | } 50 | 51 | void DockLightProperties::device_changed(OpticalDevice* pDevice,int iReason) 52 | { 53 | if( (iReason!=OPTICAL_DEVICE_CHANGED) && (iReason!=NEW_OPTICAL_DEVICE) ) 54 | return; 55 | 56 | _bBlockSignals=true; 57 | _pDevice=pDevice; 58 | 59 | double dHalfFOV=_pDevice->half_field_of_view(); 60 | m_ui->leHalfFOV->setText(QString("%1").arg(dHalfFOV)); 61 | 62 | int iNbStep=_pDevice->nb_intermediate_angles(); 63 | m_ui->spNbAngles->setValue(iNbStep); 64 | 65 | string sLightColors=_pDevice->light_colors(); 66 | 67 | m_ui->cbIR->setChecked((sLightColors.find("IR.")!=string::npos)); 68 | m_ui->cbRed->setChecked((sLightColors.find("Red.")!=string::npos)); 69 | m_ui->cbYellowBlack->setChecked((sLightColors.find("YellowBlack.")!=string::npos)); 70 | m_ui->cbYellow->setChecked((sLightColors.find("Yellow.")!=string::npos)); 71 | m_ui->cbGreen->setChecked((sLightColors.find("Green.")!=string::npos)); 72 | m_ui->cbBlue->setChecked((sLightColors.find("Blue.")!=string::npos)); 73 | m_ui->cbUV->setChecked((sLightColors.find("UV.")!=string::npos)); 74 | 75 | _bBlockSignals=false; 76 | } 77 | 78 | void DockLightProperties::OnLightChange() 79 | { 80 | if(_bBlockSignals) 81 | return; 82 | 83 | double dHalfFOV=m_ui->leHalfFOV->text().toDouble(); 84 | _pDevice->set_half_field_of_view(dHalfFOV); 85 | 86 | string sLightColors; 87 | 88 | if (m_ui->cbIR->checkState ()==Qt::Checked) 89 | sLightColors+="IR."; 90 | 91 | if (m_ui->cbRed->checkState ()==Qt::Checked) 92 | sLightColors+="Red."; 93 | 94 | if (m_ui->cbYellowBlack->checkState ()==Qt::Checked) 95 | sLightColors+="YellowBlack."; 96 | 97 | if (m_ui->cbYellow->checkState()==Qt::Checked) 98 | sLightColors+="Yellow."; 99 | 100 | if (m_ui->cbGreen->checkState()==Qt::Checked) 101 | sLightColors+="Green."; 102 | 103 | if (m_ui->cbBlue->checkState()==Qt::Checked) 104 | sLightColors+="Blue."; 105 | 106 | if (m_ui->cbUV->checkState()==Qt::Checked) 107 | sLightColors+="UV."; 108 | 109 | _pDevice->set_light_colors(sLightColors); 110 | 111 | int iNbStep=m_ui->spNbAngles->value(); 112 | if(iNbStep<1) 113 | { 114 | iNbStep=1; 115 | m_ui->spNbAngles->setValue(1); 116 | } 117 | _pDevice->set_nb_intermediate_angles(iNbStep); 118 | 119 | static_cast(parent())->device_changed(this,OPTICAL_DEVICE_CHANGED); 120 | } 121 | 122 | 123 | void DockLightProperties::on_spNbAngles_valueChanged(int arg1) 124 | { 125 | (void)arg1; 126 | OnLightChange(); 127 | } 128 | -------------------------------------------------------------------------------- /src/DockSurfacesData.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | DockSurfacesData 4 | 5 | 6 | 7 | 0 8 | 0 9 | 684 10 | 256 11 | 12 | 13 | 14 | QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable 15 | 16 | 17 | Surfaces Data 18 | 19 | 20 | 21 | 22 | 23 | 24 | Qt::SolidLine 25 | 26 | 27 | true 28 | 29 | 30 | 0 31 | 32 | 33 | 0 34 | 35 | 36 | 70 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | Insert Surface before 46 | 47 | 48 | 49 | 50 | 51 | 52 | Insert Surface after 53 | 54 | 55 | 56 | 57 | 58 | 59 | Delete Surface 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | Qt::Vertical 69 | 70 | 71 | 72 | 20 73 | 40 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | Absolute 84 | 85 | 86 | 87 | Absolute 88 | 89 | 90 | 91 | 92 | Relative 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | PolyAspheric 101 | 102 | 103 | 104 | 105 | 106 | 107 | InnerDiameter 108 | 109 | 110 | 111 | 112 | 113 | 114 | Comment 115 | 116 | 117 | 118 | 119 | 120 | 121 | Qt::Horizontal 122 | 123 | 124 | 125 | 40 126 | 20 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | -------------------------------------------------------------------------------- /src/DockLightProperties.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | DockLightProperties 4 | 5 | 6 | 7 | 0 8 | 0 9 | 217 10 | 321 11 | 12 | 13 | 14 | QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable 15 | 16 | 17 | Light Properties 18 | 19 | 20 | 21 | 22 | 23 | 24 | Wavelength 25 | 26 | 27 | 28 | 29 | 30 | IR (disp as brown) 31 | 32 | 33 | 34 | 35 | 36 | 37 | Red 38 | 39 | 40 | 41 | 42 | 43 | 44 | Yellow (disp as black) 45 | 46 | 47 | 48 | 49 | 50 | 51 | Yellow 52 | 53 | 54 | 55 | 56 | 57 | 58 | Green 59 | 60 | 61 | 62 | 63 | 64 | 65 | Blue 66 | 67 | 68 | 69 | 70 | 71 | 72 | UV (disp as violet) 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | Image Field 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | Half Field of View(deg) 91 | 92 | 93 | 94 | 95 | 96 | 97 | 0 98 | 99 | 100 | 101 | 102 | 103 | 104 | Nb Intermediates angles 105 | 106 | 107 | 108 | 109 | 110 | 111 | 1 112 | 113 | 114 | 3 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | Qt::Vertical 127 | 128 | 129 | 130 | 20 131 | 40 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | -------------------------------------------------------------------------------- /src/DockImageQuality.cpp: -------------------------------------------------------------------------------- 1 | #include "DockImageQuality.h" 2 | #include "ui_DockImageQuality.h" 3 | 4 | #include "OpticalDevice.h" 5 | #include "AstreeDefines.h" 6 | #include "MainWindow.h" 7 | 8 | #include 9 | 10 | DockImageQuality::DockImageQuality(QWidget *parent) : 11 | QDockWidget(parent), 12 | ui(new Ui::DockImageQuality) 13 | { 14 | _bBlockSignals=true; 15 | 16 | ui->setupUi(this); 17 | _pDevice=0; 18 | 19 | _bBlockSignals=false; 20 | } 21 | ////////////////////////////////////////////////////////////////////////////////// 22 | DockImageQuality::~DockImageQuality() 23 | { 24 | delete ui; 25 | } 26 | ////////////////////////////////////////////////////////////////////////////////// 27 | void DockImageQuality::device_changed(OpticalDevice* pDevice,int iReason) 28 | { 29 | assert(pDevice!=0); 30 | 31 | _pDevice=pDevice; 32 | 33 | if( (iReason!=OPTICAL_DEVICE_CHANGED) && (iReason!=NEW_OPTICAL_DEVICE) && ((iReason!=LIGHT_OFF_AXIS_CHANGED))) 34 | return; 35 | 36 | _bBlockSignals=true; 37 | 38 | ImageQuality pIQ=pDevice->get_image_quality(); 39 | bool bInfinite=pIQ.isImageInfinite; 40 | int iNbAngles=pIQ.nb_angles(); 41 | 42 | QStringList qsl; 43 | qsl+="Angle(deg)"; 44 | 45 | if(bInfinite) 46 | qsl+="OutAngle(deg)"; 47 | else 48 | qsl+="Dist(mm)"; 49 | 50 | if(bInfinite) 51 | qsl+="SpotSize(deg)"; 52 | else 53 | qsl+="SpotSize(µm)"; 54 | 55 | 56 | if(bInfinite) 57 | qsl+="Spot/EyeLimit"; 58 | else 59 | qsl+="Spot/Airy"; 60 | 61 | qsl+="Vignetting"; 62 | 63 | ui->tableWidget->clearContents(); 64 | ui->tableWidget->setRowCount(iNbAngles); 65 | ui->tableWidget->setColumnCount(qsl.size()); 66 | ui->tableWidget->setHorizontalHeaderLabels(qsl); 67 | 68 | for(int i=0;itableWidget->setItem(i,0,new QTableWidgetItem(qsAngle)); 73 | 74 | double dDist=pIQ.vdDist[i]; 75 | QString qsDist=QString::number(dDist,'g',3); 76 | ui->tableWidget->setItem(i,1,new QTableWidgetItem(qsDist)); 77 | 78 | double dSpotSize=pIQ.vdSpotSize[i]; 79 | if(!bInfinite) 80 | dSpotSize*=1000.; //convert to microns 81 | 82 | QString qsSpotSize=QString::number(dSpotSize,'g',3); 83 | ui->tableWidget->setItem(i,2,new QTableWidgetItem(qsSpotSize)); 84 | 85 | double dSpotvsAiry=pIQ.vdSpotvsAiry[i]; 86 | QString qsSpotvsAiry=QString::number(dSpotvsAiry,'g',3); 87 | ui->tableWidget->setItem(i,3,new QTableWidgetItem(qsSpotvsAiry)); 88 | 89 | double dVignetting=pIQ.vdVignetting[i]; 90 | QString qsVignetting=QString::number(dVignetting,'f',1)+QString(" %"); 91 | ui->tableWidget->setItem(i,4,new QTableWidgetItem(qsVignetting)); 92 | 93 | 94 | //.... 95 | 96 | } 97 | 98 | // ui->tableWidget->setAlternatingRowColors(true); 99 | ui->tableWidget->resizeColumnsToContents(); 100 | 101 | if( iNbAngles!=0 ) 102 | { 103 | if(bInfinite) 104 | { 105 | ui->lAirySize->setText(QString::number(pIQ.dAirySize,'g',3)+QString(" deg")); 106 | ui->lFNumber->setText("n/a"); 107 | } 108 | else 109 | { 110 | ui->lAirySize->setText(QString::number(pIQ.dAirySize*1000.,'g',3)+QString(" µm")); 111 | ui->lFNumber->setText(QString::number(pIQ.dFNumber,'g',3)); 112 | } 113 | } 114 | else 115 | { 116 | ui->lAirySize->setText("n/a"); 117 | ui->lFNumber->setText("n/a"); 118 | } 119 | 120 | //update angle selected row 121 | double dPercentField; 122 | if( pDevice->get_parameter("showLightOffAxis",dPercentField) && (ui->tableWidget->rowCount()>1)) 123 | { 124 | ui->tableWidget->selectRow((int)(0.5+(ui->tableWidget->rowCount()-1)*dPercentField/100.)); 125 | } 126 | _bBlockSignals=false; 127 | } 128 | ////////////////////////////////////////////////////////////////////////////////// 129 | void DockImageQuality::on_tableWidget_currentCellChanged(int currentRow, int currentColumn, int previousRow, int previousColumn) 130 | { 131 | (void)currentColumn; 132 | (void)previousRow; 133 | (void)previousColumn; 134 | 135 | if(_bBlockSignals) 136 | return; 137 | 138 | assert(_pDevice); 139 | 140 | if(currentRow<0) 141 | return; 142 | 143 | if(ui->tableWidget->rowCount()>1.) 144 | { 145 | double dPercentField=(100.*currentRow)/(ui->tableWidget->rowCount()-1); 146 | 147 | assert(dPercentField>=0); 148 | assert(dPercentField<=100); 149 | 150 | _pDevice->set_parameter("showLightOffAxis",dPercentField); 151 | static_cast(parent())->device_changed(this,LIGHT_OFF_AXIS_CHANGED,false); 152 | } 153 | } 154 | ////////////////////////////////////////////////////////////////////////////////// 155 | -------------------------------------------------------------------------------- /src/DockImageQuality.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | DockImageQuality 4 | 5 | 6 | 7 | 0 8 | 0 9 | 362 10 | 270 11 | 12 | 13 | 14 | 15 | 0 16 | 0 17 | 18 | 19 | 20 | 21 | 362 22 | 205 23 | 24 | 25 | 26 | QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable 27 | 28 | 29 | ImageQuality 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | F-ratio: 39 | 40 | 41 | 42 | 43 | 44 | 45 | QFrame::Panel 46 | 47 | 48 | QFrame::Plain 49 | 50 | 51 | n/a 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | Airy Size: 66 | 67 | 68 | 69 | 70 | 71 | 72 | QFrame::Panel 73 | 74 | 75 | n/a 76 | 77 | 78 | 79 | 80 | 81 | 82 | Qt::Horizontal 83 | 84 | 85 | 86 | 40 87 | 20 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | QAbstractScrollArea::AdjustToContents 98 | 99 | 100 | false 101 | 102 | 103 | true 104 | 105 | 106 | Qt::SolidLine 107 | 108 | 109 | 4 110 | 111 | 112 | 4 113 | 114 | 115 | true 116 | 117 | 118 | 50 119 | 120 | 121 | true 122 | 123 | 124 | 20 125 | 126 | 127 | false 128 | 129 | 130 | false 131 | 132 | 133 | 20 134 | 135 | 136 | true 137 | 138 | 139 | 15 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | -------------------------------------------------------------------------------- /samples/others/two_mirror_optimizer.astree: -------------------------------------------------------------------------------- 1 | 0.diameter=400 2 | 0.radius_curvature=-2400 3 | 0.thick=-900 4 | 0.type=reflect 5 | 1.diameter=105.4689468 6 | 1.diameter.auto=1 7 | 1.radius_curvature=-800 8 | 1.thick=1165.117492 9 | 1.type=reflect 10 | 2.diameter=34.06167291 11 | 2.diameter.auto=1 12 | 2.radius_curvature=inf 13 | 2.thick=0 14 | 2.type=image 15 | 2.z.autofocus=1 16 | device.note=Optimizer sample: 17 | device.note= 18 | device.note=In the optimizer Panel, there is one line by parameter to optimize. 19 | device.note=For each line, : 20 | device.note= 21 | device.note=- Check Optimize if this parameter must be optimized 22 | device.note= 23 | device.note=- Select the surface number 24 | device.note= 25 | device.note=- Select the parameter, it can be conic, thick, RCurvature, etc. 26 | device.note= 27 | device.note=- Type the Min and Max possible parameter value if needed, left blank to let the optimizer guess 28 | device.note= 29 | device.note=Then select the image quality criteria: 30 | device.note= 31 | device.note=- Image center, optimize only for the image center 32 | device.note= 33 | device.note=- Mostly image center: optimise mainly for the image center 34 | device.note= 35 | device.note=- Image mean, optimize for a mean criteria over all the image 36 | device.note= 37 | device.note=- Image Max, optimize to reduce the worse quality in the image field 38 | device.note= 39 | device.note=Then click on Optimize, the result are: 40 | device.note= 41 | device.note=- Better solution found, the optimizer enhanced the design 42 | device.note= 43 | device.note=- Solution on edge, a better design has been found but parameter range need to be enlarged 44 | device.note= 45 | device.note=- No better solution found: there is no better solution than the actual design 46 | device.note= 47 | device.note= 48 | device.note=This desing have, at start , all conic set to zero. 49 | device.note=You can: 50 | device.note= 51 | device.note=-design a Cassegrain by seeting the conic of the first mirror to -1 ( parabolic), disable the parameter in the Optimize panel and then optimise secondary conic for image center only (solution is -2.77) 52 | device.note= 53 | device.note=-design a Ritchey-Chretien by optimizing all conics for max image defautl (solution is -1.04 and -3.15) 54 | device.note= 55 | device.note=... 56 | device.note= 57 | device.note=Optionally, you can add the "auto" keyword to the RCurv field of the 3rd row, for automatic field curvature computation 58 | device.note= 59 | device.note= 60 | device.note= 61 | device.note= 62 | device.note= 63 | device.note= 64 | device.note= 65 | device.note= 66 | device.relative_convention=1 67 | image.autocurvature=0 68 | image.autofocus=1 69 | light.colors=YellowBlack. 70 | light.half_field_of_view=0.2 71 | light.nbsteps=5 72 | note=Optimizer sample: 73 | note= 74 | note=In the optimizer Panel, there is one line by parameter to optimize. 75 | note=For each line, : 76 | note= 77 | note=- Check Optimize if this parameter must be optimized 78 | note= 79 | note=- Select the surface number 80 | note= 81 | note=- Select the parameter, it can be conic, thick, RCurvature, etc. 82 | note= 83 | note=- Type the Min and Max possible parameter value if needed, left blank to let the optimizer guess 84 | note= 85 | note=Then select the image quality criteria: 86 | note= 87 | note=- Image center, optimize only for the image center 88 | note= 89 | note=- Mostly image center: optimise mainly for the image center 90 | note= 91 | note=- Image mean, optimize for a mean criteria over all the image 92 | note= 93 | note=- Image Max, optimize to reduce the worse quality in the image field 94 | note= 95 | note=Then click on Optimize, the result are: 96 | note= 97 | note=- Better solution found, the optimizer enhanced the design 98 | note= 99 | note=- Solution on edge, a better design has been found but parameter range need to be enlarged 100 | note= 101 | note=- No better solution found: there is no better solution than the actual design 102 | note= 103 | note= 104 | note=This desing have, at start , all conic set to zero. 105 | note=You can: 106 | note= 107 | note=-design a Cassegrain by seeting the conic of the first mirror to -1 ( parabolic), disable the parameter in the Optimize panel and then optimise secondary conic for image center only (solution is -2.77) 108 | note= 109 | note=-design a Ritchey-Chretien by optimizing all conics for max image defautl (solution is -1.04 and -3.15) 110 | note= 111 | note=... 112 | note= 113 | note=Optionally, you can add the "auto" keyword to the RCurv field of the 3rd row, for automatic field curvature computation 114 | note= 115 | note= 116 | note= 117 | note= 118 | note= 119 | note= 120 | note= 121 | note= 122 | parameter.optimizer.0.checked=1 123 | parameter.optimizer.0.parameter=Conic 124 | parameter.optimizer.0.surface=1 125 | parameter.optimizer.1.checked=1 126 | parameter.optimizer.1.parameter=Conic 127 | parameter.optimizer.1.surface=2 128 | parameter.optimizer.2.checked=0 129 | parameter.optimizer.3.checked=0 130 | parameter.optimizer.4.checked=0 131 | parameter.optimizer.5.checked=0 132 | parameter.optimizer.6.checked=0 133 | parameter.optimizer.7.checked=0 134 | parameter.optimizer.8.checked=0 135 | parameter.optimizer.9.checked=0 136 | -------------------------------------------------------------------------------- /src/OpticalDevice.h: -------------------------------------------------------------------------------- 1 | // this file is covered by the General Public License version 2 or later 2 | // please see GPL.html for more details and licensing issues 3 | // copyright Etienne de Foras ( the author ) mailto: etienne.deforas@gmail.com 4 | 5 | #ifndef OpticalDevice_ 6 | #define OpticalDevice_ 7 | 8 | #include 9 | #include 10 | #include 11 | using namespace std; 12 | 13 | #include "ImageQuality.h" 14 | #include "Surface.h" 15 | class Light; 16 | 17 | #define RADIUS_CURVATURE_INFINITY 9e99 18 | #define FD_VALID_MAX 1e10 19 | #define SPOT_SIZE_INFINITY 9e99 20 | 21 | enum eSurfaceParameter //to be used with get/set functions below 22 | { 23 | DIAMETER, 24 | AUTO_DIAMETER, // set with 0 or 1 25 | INNER_DIAMETER, 26 | AUTO_INNER_DIAMETER, // set with 0 or 1 27 | CONIC, 28 | RADIUS_CURVATURE, //in mm 29 | CURVATURE, //inverse of radius curvature, unit is 1/mm 30 | Z, //absolute coordinate 31 | THICK, //relative coordinate 32 | R4, //surface polynomial coef of r4 33 | R6, //surface polynomial coef of r6 34 | R8, //surface polynomial coef of r8 35 | R10 //surface polynomial coef of r10 36 | }; 37 | 38 | struct SurfaceParameterClone 39 | { 40 | eSurfaceParameter param; 41 | int iSurface; 42 | int iRefSurface; 43 | double dGain; 44 | }; 45 | 46 | class OpticalDevice 47 | { 48 | public: 49 | OpticalDevice(); 50 | OpticalDevice(const OpticalDevice &rDevice); 51 | OpticalDevice& operator=(const OpticalDevice& rDevice); 52 | virtual ~OpticalDevice(); 53 | 54 | // surface management 55 | void insert_surface(int iPos); 56 | void delete_surface(int iPos); 57 | int nb_surface() const; 58 | 59 | // surface type management 60 | void set_type(int iSurf,string sType); 61 | string type(int iSurf) const; 62 | 63 | // note management 64 | void set_note(string sNote); 65 | string note() const; 66 | 67 | // surface data accessor 68 | void set(int iSurface,eSurfaceParameter eParam,double dParam); 69 | double get(int iSurface,eSurfaceParameter eParam,bool bUpdate=true); //not const due to lazy computation 70 | 71 | // surface parameter cloning 72 | void set_clone(int iSurface, eSurfaceParameter eParam, int iRefSurface, double dGain); //set iRefSurface=-1 to remove 73 | bool is_clone(int iSurface,eSurfaceParameter eParam) const; //return false if no clone for iSurface eParam 74 | bool get_clone(int iSurface, eSurfaceParameter eParam, int& iRefSurface, double &dGain) const; //return false if no exist 75 | 76 | // global properties getter 77 | bool has_aspheric() const; 78 | bool has_inner_diameter() const; 79 | bool has_auto() const; 80 | bool is_image_infinite() const; 81 | 82 | // z settings 83 | void set_relative_convention(bool bRelativeConvention); 84 | bool relative_convention() const; 85 | 86 | void set_autofocus(bool bAutofocus); 87 | bool get_autofocus() const; 88 | void set_image_autocurvature(bool bAutoCurvature); 89 | bool get_image_autocurvature() const; 90 | 91 | bool compute_surface_profile(int iSurface,double dX,double dY,double& dZ); //TODO add slope computation 92 | 93 | // comment settings 94 | void set_comment(int iSurface,string sComment); 95 | string comment(int iSurface) const; 96 | bool has_comment() const; 97 | 98 | // input light properties 99 | void set_half_field_of_view(double dHalfFov); 100 | double half_field_of_view() const; 101 | int nb_intermediate_angles() const; 102 | void set_nb_intermediate_angles(int iNbAngles); 103 | void set_light_colors(const string & _sLightColors); 104 | string light_colors() const; 105 | void set_light_grid(int iGridX,int iGridY); 106 | 107 | // light computation 108 | void compute_light(Light* pLight,int iSurface, double dTilt, int iGridX, int iGridY); 109 | const ImageQuality get_image_quality(); 110 | 111 | //other parameters, not used in computation, saved in files 112 | void set_parameter(const string& sKey,double dValue); 113 | void set_parameter(const string& sKey,const string& sValue); 114 | bool get_parameter(const string& sKey,double & dValue) const; 115 | bool get_parameter(const string& sKey,string & sValue) const; 116 | const map& all_parameters() const; 117 | 118 | private: 119 | void initialize_light(Light *pLight, double dTilt, int iGridX, int iGridY); 120 | void ray_trace(); 121 | void ray_trace_step(Light &light, double dTilt, bool bAutofocus, bool bAutocurvature); 122 | void update_z(); 123 | void update_thicks(); 124 | 125 | vector _vdThicks; 126 | vector _vSurfaces; 127 | bool _bRelativeConvention; 128 | bool _bAutoCurvature; 129 | bool _bAutoFocus; 130 | 131 | string _sNote; 132 | 133 | double _dHalfFov; 134 | int _iGridX,_iGridY; 135 | int _iNbAngles; 136 | string _sLightColors; 137 | bool _bMustRetrace; 138 | 139 | ImageQuality _imageQuality; 140 | 141 | // other parameters 142 | map _otherParameters; 143 | 144 | //surface clone parameters 145 | vector _surfParamsClone; 146 | }; 147 | 148 | #endif 149 | -------------------------------------------------------------------------------- /src/LightAutoFocus.cpp: -------------------------------------------------------------------------------- 1 | // this file is covered by the General Public License version 2 or later 2 | // please see GPL.html for more details and licensing issues 3 | // copyright Etienne de Foras ( the author ) mailto: etienne.deforas@gmail.com 4 | 5 | #include "LightAutofocus.h" 6 | #include "Light.h" 7 | #include "Photon.h" 8 | 9 | #define SPOT_SIZE_INFINITY 1.e99 10 | 11 | //////////////////////////////////////////////////////////////////////////////// 12 | LightAutofocus::LightAutofocus() 13 | { 14 | _xCenter=0.; 15 | _yCenter=0.; 16 | } 17 | //////////////////////////////////////////////////////////////////////////////// 18 | double LightAutofocus::autofocus(const Light& l) 19 | { 20 | double dB=0.; 21 | double dA=dB-1000.; 22 | double dC=dB+1000.; 23 | double dZStep=1.e-9; 24 | 25 | // find a point that is valid for initial start 26 | int iScale=0; 27 | double dQA, dQC, dQB=compute_spot_size(l,dB); 28 | while((iScale<11) && (dQB>=SPOT_SIZE_INFINITY/2)) //2km max 29 | { 30 | dA=dB-2*(dB-dA); //look at left 31 | dQA=compute_spot_size(l,dA); 32 | 33 | if(dQA=SPOT_SIZE_INFINITY/2) 50 | return 0.; //unable to find a valid start point 51 | 52 | // find valid dA and dB and such as dA>=dB and dC>=dB 53 | dA=dB-1000.; 54 | dC=dB+1000.; 55 | dQA=compute_spot_size(l,dA); 56 | dQC=compute_spot_size(l,dC); 57 | 58 | //1st part: expand A and C, so B became a minimum 59 | iScale=0; 60 | while((iScale<11) && (dQA<=dQB)) //2km max 61 | { 62 | dA=dB-2*(dB-dA); 63 | dQA=compute_spot_size(l,dA); 64 | iScale++; 65 | } 66 | 67 | iScale=0; 68 | while((iScale<11) && (dQC<=dQB)) //2km max 69 | { 70 | dC=dB-2*(dB-dC); 71 | dQC=compute_spot_size(l,dC); 72 | iScale++; 73 | } 74 | 75 | //exit if no solution 76 | if( (dQA<=dQB) || (dQC<=dQB) ) 77 | return 0.; 78 | 79 | // reduce interval around solution using dichotomy 1.5 80 | while (dC-dA>dZStep) 81 | { 82 | double dAB=(dA+dB)/2.; 83 | double dQAB=compute_spot_size(l,dAB); 84 | 85 | if (dQAB& photons=l.photons(); 136 | 137 | for(unsigned int i=0;ixMax) 165 | xMax=x; 166 | 167 | if(xyMax) 171 | yMax=y; 172 | 173 | if(yyMax-yMin) 184 | return xMax-xMin; 185 | else 186 | return yMax-yMin; 187 | } 188 | ////////////////////////////////////////////////////////////////////////////// 189 | void LightAutofocus::get_center(double& xCenter,double& yCenter) const 190 | { 191 | xCenter=_xCenter; 192 | yCenter=_yCenter; 193 | } 194 | ////////////////////////////////////////////////////////////////////////////// 195 | -------------------------------------------------------------------------------- /src/DockOptimizer.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | DockOptimizer 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 300 11 | 12 | 13 | 14 | QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable 15 | 16 | 17 | Optimizer 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | Keep vignetting over 27 | 28 | 29 | 30 | 31 | 32 | 33 | 100 34 | 35 | 36 | 37 | 38 | 39 | 40 | % 41 | 42 | 43 | 44 | 45 | 46 | 47 | Qt::Horizontal 48 | 49 | 50 | 51 | 40 52 | 20 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | QAbstractItemView::AllEditTriggers 63 | 64 | 65 | false 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | Refine 75 | 76 | 77 | 78 | 79 | 80 | 81 | Optimize 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 75 90 | true 91 | 92 | 93 | 94 | true 95 | 96 | 97 | ... 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | Criteria 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | Image Center Only 117 | 118 | 119 | 120 | 121 | Mostly Center 122 | 123 | 124 | 125 | 126 | Full Frame Mean 127 | 128 | 129 | 130 | 131 | Full Frame Max 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | Qt::Horizontal 140 | 141 | 142 | 143 | 40 144 | 20 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | Method 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | Nelder-Mead (default) 165 | 166 | 167 | 168 | 169 | Monte-Carlo MultiScale 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | Qt::Horizontal 178 | 179 | 180 | 181 | 40 182 | 20 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | --------------------------------------------------------------------------------