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 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