Go to the documentation of this file.00001 #ifndef vil_chord_h_
00002 #define vil_chord_h_
00003
00004
00005
00006
00007
00008 #include <vcl_iostream.h>
00009 #include <vcl_vector.h>
00010
00011
00012
00013 struct vil_chord
00014 {
00015 unsigned ilo;
00016 unsigned ihi;
00017 unsigned j;
00018
00019
00020 vil_chord() : ilo(1),ihi(0),j(0) {}
00021
00022
00023 vil_chord(unsigned ilo1, unsigned ihi1, unsigned j1)
00024 : ilo(ilo1), ihi(ihi1), j(j1) {}
00025
00026
00027 unsigned length() const { return ihi+1-ilo; }
00028 };
00029
00030
00031 inline vcl_ostream& operator<<(vcl_ostream& os, vil_chord c)
00032 {
00033 return os<<"(["<<c.ilo<<','<<c.ihi<<"],"<<c.j<<')';
00034 }
00035
00036
00037 inline unsigned vil_area(const vcl_vector<vil_chord>& region)
00038 {
00039 unsigned A=0;
00040 for (unsigned i=0;i<region.size();++i) A+=region[i].length();
00041 return A;
00042 }
00043
00044 #endif // vil_chord_h_