Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

conic_section.h

Go to the documentation of this file.
00001 /*
00002 Arroyo - software for the simulation of electromagnetic wave propagation
00003 through turbulence and optics.
00004 
00005 Copyright (c) 2000-2004 California Institute of Technology.  Written by
00006 Dr. Matthew Britton.  For comments or questions about this software,
00007 please contact the author at mbritton@astro.caltech.edu.
00008 
00009 This program is free software; you can redistribute it and/or modify it
00010 under the terms of the GNU General Public License as  published by the
00011 Free Software Foundation; either version 2 of the License, or (at your
00012 option) any later version.
00013 
00014 This program is provided "as is" and distributed in the hope that it
00015 will be useful, but WITHOUT ANY WARRANTY; without even the implied
00016 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  In no
00017 event shall California Institute of Technology be liable to any party
00018 for direct, indirect, special, incidental or consequential damages,
00019 including lost profits, arising out of the use of this software and its
00020 documentation, even if the California Institute of Technology has been
00021 advised of the possibility of such damage.   The California Institute of
00022 Technology has no obligation to provide maintenance, support, updates,
00023 enhancements or modifications.  See the GNU General Public License for
00024 more details.
00025 
00026 You should have received a copy of the GNU General Public License along
00027 with this program; if not, write to the Free Software
00028 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
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     // Plane wave flag
00056     bool plane_wave;
00057 
00058     // The vertex of the conic section
00059     three_point vertex;
00060 
00061     // The focus of the conic section closest to the vertex
00062     three_point focus;
00063 
00064     // The eccentricity:
00065     // For a spherical mirror, eccentricity = 0
00066     // For an elliptical mirror, 0 < eccentricity < 1
00067     // For a parabolic mirror, eccentricity = 1
00068     // For a hyperbolic mirror, eccentricity > 1
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   

Generated on Thu Nov 29 17:16:28 2007 for arroyo by  doxygen 1.3.9.1