00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #ifndef CONIC_SECTION_H
00032 #define CONIC_SECTION_H
00033
00034 #include "AO_sim_base.h"
00035 #include "three_frame.h"
00036
00037 namespace Arroyo {
00038
00042 class conic_section :
00043 virtual public AO_sim_base {
00044
00045 private:
00046
00047 static const bool factory_registration;
00048
00051 string unique_name() const {return(string("conic section"));};
00052
00053 protected:
00054
00055
00056 bool plane_wave;
00057
00058
00059 three_point vertex;
00060
00061
00062 three_point focus;
00063
00064
00065
00066
00067
00068
00069 double eccentricity;
00070
00071 public:
00072
00075 conic_section(){
00076 this->eccentricity = -1;
00077 };
00078
00081 conic_section(const conic_section & cmr);
00082
00085 conic_section(const char * filename);
00086
00089 conic_section(const iofits & iof);
00090
00107 conic_section(const three_point & vertex,
00108 const three_point & focus,
00109 double eccty);
00110
00113 ~conic_section(){};
00114
00117 conic_section & operator=(const conic_section & cmr);
00118
00121 void read(const char * filename);
00122
00125 void read(const iofits & iof);
00126
00129 void write(const char * filename) const;
00130
00133 void write(iofits & iof) const;
00134
00137 void print(ostream & os, const char * prefix="") const;
00138
00141 double get_eccentricity() const {
00142 return(this->eccentricity);
00143 };
00144
00147 three_point get_vertex() const {
00148 return(this->vertex);
00149 };
00150
00153 three_point get_near_focus() const {
00154 return(this->focus);
00155 };
00156
00159 three_point get_far_focus() const {
00160 if(this->eccentricity==1){
00161 cerr << "conic_section::get_far_focus error - this instance is a parabola, and the focus is at infinity\n";
00162 throw(string("conic_section::get_far_focus"));
00163 }
00164 double dist = this->get_latus_rectum()/2./(1-this->eccentricity);
00165 three_vector unit_vector = this->focus - this->vertex;
00166 unit_vector = (1/unit_vector.length())*unit_vector;
00167 return(this->vertex + dist*unit_vector);
00168 };
00169
00172 double get_latus_rectum() const {
00173 return(2*(this->focus - this->vertex).length()*(1+this->eccentricity));
00174 };
00175
00178 double get_local_curvature(three_point & tp) const;
00179
00182 bool on_conic(const three_point & tp) const;
00183
00200 void raytrace(const three_point & tp,
00201 const three_vector & tv,
00202 double & distance_to_conic,
00203 three_point & point_of_intersection,
00204 three_vector & conic_unit_normal,
00205 double & R_squared,
00206 double & V) const;
00207
00210 static int verbose_level;
00211
00212 };
00213
00214 }
00215
00216 #endif
00217