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

region_base.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 REGION_BASE_H
00032 #define REGION_BASE_H
00033 
00034 #include <iostream>
00035 #include <string>
00036 #include "three_point.h"
00037 
00038 namespace Arroyo {
00039 
00040   class three_point;
00041 
00042   using std::string;
00043   using std::ostream;
00044   using std::vector;
00045 
00049 
00050   class region_base {
00051 
00052   public:
00053   
00056     region_base(){};
00057 
00060     virtual ~region_base(){};
00061 
00064     virtual void print(ostream & os, const char * prefix = "",
00065                                         long precision = 6) const = 0;
00066 
00069     virtual void print(ostream & os, const three_frame & tf,
00070                 const char * prefix = "", long precision = 6) const = 0;
00071     
00077 
00079     static int verbose_level;
00080 
00081   };
00082 
00086 
00087   class rectangular_region :
00088     public region_base {
00089 
00091     vector<three_point> corners;
00092 
00103     string region_status(const rectangular_region & rec_region) const;
00104 
00111     void sort_corners();
00112 
00113     public:
00114 
00117     rectangular_region(){};
00118     
00121     rectangular_region(const rectangular_region & rec_region);
00122     
00127     rectangular_region(const vector<three_point> & in_corners);
00128     
00132     rectangular_region(const three_frame & tf, vector<long> axes, double pix);
00133     
00166     rectangular_region(const rectangular_region & rec_region,
00167                         const three_vector & nrml, bool along_nrml);
00168     
00177     rectangular_region(const rectangular_region & rec_region,
00178                        double pix);
00179     
00182     ~rectangular_region(){};
00183     
00186     rectangular_region & operator=(const rectangular_region & rec_region);
00187 
00195     bool aligned(const rectangular_region & rec_region) const;
00196 
00202     bool contains(const rectangular_region & rec_region) const;
00203 
00209     bool is_contained(const rectangular_region & rec_region) const;
00210 
00216     bool is_disjoint(const rectangular_region & rec_region) const;
00217 
00221     vector<three_point> get_corners() const;
00222 
00226     three_point get_center() const;    
00227 
00230     void print(ostream & os, const char * prefix = "", long precision = 6) const;
00231 
00234     void print(ostream & os, const three_frame & tf,
00235                 const char * prefix = "", long precision = 6) const;
00236 
00244     friend rectangular_region region_union(const rectangular_region & rec_region1,
00245                                            const rectangular_region & rec_region2);
00246 
00254     friend rectangular_region region_intersection(
00255                         const rectangular_region & rec_region1,
00256                         const rectangular_region & rec_region2);
00257 
00260     friend bool operator==(const rectangular_region & rec_region1,
00261                            const rectangular_region & rec_region2);
00262 
00263   };
00264 
00265   bool operator!=(const rectangular_region & rec_region1,
00266                   const rectangular_region & rec_region2);
00267 
00268 }
00269 
00270 #endif

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