proj home

Files   Classes   Functions   Hierarchy  

regionD2tess.h

Go to the documentation of this file.
00001 #ifndef REGIOND2TESS_H
00002 #define REGIOND2TESS_H
00003 
00004 #include <regionD2linked.h>
00005 
00016 template
00017 < 
00018   typename Vreg, 
00019   typename Vpts, 
00020   typename Indx = unsigned int 
00021 >
00022 class regionD2tess
00023 {
00024 
00025 public:
00026 
00028   Vreg vi;
00030   Vpts pts;
00031 
00033   regionD2tess( Vreg _vi, Vpts _pts)
00034     : vi(_vi), pts(_pts) {}
00035 
00037   boolc verify() const;
00038 
00040   void print() const;
00041 
00043   void printnumbered() const;
00044 
00045 };
00046 
00047 
00048 //---------------------------------------------------------
00049 // Implementation
00050 
00051 template< typename Vreg, typename Vpts, typename Indx >
00052 void regionD2tess<Vreg,Vpts,Indx>::printnumbered() const
00053 {
00054   // Preserve and later restore the setting.
00055   bool writesize = regionD2linked<Indx>::writesize;
00056   regionD2linked<Indx>::writesize = false;
00057 
00058   Indx const imax = vi.size();
00059   for (Indx i=0; i<imax; ++i)
00060   {
00061     cout << i << "  ";
00062     regionD2linked<Indx> & reg(vi[i]);
00063     if (reg.isnull())
00064     {
00065       cout << endl;
00066       continue;
00067     }
00068 
00069     cout << (string)reg << endl;
00070   }
00071 
00072   regionD2linked<Indx>::writesize = writesize;
00073 }
00074 
00075 template< typename Vreg, typename Vpts, typename Indx >
00076 void regionD2tess<Vreg,Vpts,Indx>::print() const
00077 {
00078   Indx const imax = vi.size();
00079   for (Indx i=0; i<imax; ++i)
00080   {
00081     regionD2linked<Indx> & reg(vi[i]);
00082     if (reg.isnull())
00083       continue;
00084 
00085     cout << (string)reg << endl;
00086   }
00087 }
00088 
00089 template< typename Vreg, typename Vpts, typename Indx >
00090 boolc regionD2tess<Vreg,Vpts,Indx>::verify() const
00091 {
00092   Indx const imax = vi.size();
00093   for (Indx i=0; i<imax; ++i)
00094   {
00095     regionD2linked<Indx> & reg(vi[i]);
00096     if (reg.isnull())
00097       continue;
00098 
00099     pnlinkiter<Indx> k(reg.start);
00100     for ( k.reset(); !k; ++k )
00101     {
00102       if (k->nlink>imax)
00103         return false;
00104       if (vi[k->nlink].start->niInverse(i) == 0)
00105         return false;
00106     }
00107   }
00108 
00109   return true;
00110 }
00111 
00112 
00113 
00114 
00115 #endif
00116 
00117 

Generated on Fri Mar 4 00:49:26 2011 for Chelton Evans Source by  doxygen 1.5.8