00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __itkQuadEdge_h
00019 #define __itkQuadEdge_h
00020
00021 #include "itkQuadEdgeMeshBaseIterator.h"
00022
00023 #include "itkMacro.h"
00024
00025
00026
00027
00028
00029 #define itkQEDebugMacro( x ) \
00030 { \
00031 OStringStream itkmsg; \
00032 itkmsg << "Debug: In " __FILE__ ", line " << __LINE__ << "\n" \
00033 << " (" << this << "): " x \
00034 << "\n\n"; \
00035 OutputWindowDisplayDebugText( itkmsg.str( ).c_str( ) ); \
00036 }
00037 #define itkQEWarningMacro( x ) \
00038 { \
00039 OStringStream itkmsg; \
00040 itkmsg << "WARNING: In " __FILE__ ", line " << __LINE__ << "\n" \
00041 << " (" << this << "): " x \
00042 << "\n\n"; \
00043 OutputWindowDisplayWarningText( itkmsg.str( ).c_str( ) ); \
00044 }
00045
00046
00047
00056 #define itkQEAccessorsMacro( st, pt, dt ) \
00057 pt* GetOnext() \
00058 { \
00059 return( dynamic_cast< pt* >( this->st::GetOnext() ) ); \
00060 } \
00061 \
00062 dt* GetRot() \
00063 { \
00064 return( dynamic_cast< dt* >( this->st::GetRot() ) ); \
00065 } \
00066 \
00067 pt* GetSym() \
00068 { \
00069 return( dynamic_cast< pt* >( this->st::GetSym() ) ); \
00070 } \
00071 \
00072 pt* GetLnext() \
00073 { \
00074 return( dynamic_cast< pt* >( this->st::GetLnext() ) ); \
00075 } \
00076 \
00077 pt* GetRnext() \
00078 { \
00079 return( dynamic_cast< pt* >( this->st::GetRnext() ) ); \
00080 } \
00081 \
00082 pt* GetDnext() \
00083 { \
00084 return( dynamic_cast< pt* >( this->st::GetDnext() ) ); \
00085 } \
00086 \
00087 pt* GetOprev() \
00088 { \
00089 return( dynamic_cast< pt* >( this->st::GetOprev() ) ); \
00090 } \
00091 \
00092 pt* GetLprev() \
00093 { \
00094 return( dynamic_cast< pt* >( this->st::GetLprev() ) ); \
00095 } \
00096 \
00097 pt* GetRprev() \
00098 { \
00099 return( dynamic_cast< pt* >( this->st::GetRprev() ) ); \
00100 } \
00101 \
00102 pt* GetDprev() \
00103 { \
00104 return( dynamic_cast< pt* >( this->st::GetDprev() ) ); \
00105 } \
00106 \
00107 dt* GetInvRot() \
00108 { \
00109 return( dynamic_cast< dt* >( this->st::GetInvRot() ) ); \
00110 } \
00111 \
00112 pt* GetInvOnext() \
00113 { \
00114 return( dynamic_cast< pt* >( this->st::GetInvOnext() ) ); \
00115 } \
00116 \
00117 pt* GetInvLnext() \
00118 { \
00119 return( dynamic_cast< pt* >( this->st::GetInvLnext() ) ); \
00120 } \
00121 \
00122 pt* GetInvRnext() \
00123 { \
00124 return( dynamic_cast< pt* >( this->st::GetInvRnext() ) ); \
00125 } \
00126 \
00127 pt* GetInvDnext() \
00128 { \
00129 return( dynamic_cast< pt* >( this->st::GetInvDnext() ) ); \
00130 } \
00131 const pt* GetOnext() const \
00132 { \
00133 return( dynamic_cast< const pt* >( this->st::GetOnext() ) ); \
00134 } \
00135 \
00136 const dt* GetRot() const \
00137 { \
00138 return( dynamic_cast< const dt* >( this->st::GetRot() ) ); \
00139 } \
00140 \
00141 const pt* GetSym() const \
00142 { \
00143 return( dynamic_cast< const pt* >( this->st::GetSym() ) ); \
00144 } \
00145 \
00146 const pt* GetLnext() const \
00147 { \
00148 return( dynamic_cast< const pt* >( this->st::GetLnext() ) ); \
00149 } \
00150 \
00151 const pt* GetRnext() const \
00152 { \
00153 return( dynamic_cast< const pt* >( this->st::GetRnext() ) ); \
00154 } \
00155 \
00156 const pt* GetDnext() const \
00157 { \
00158 return( dynamic_cast< const pt* >( this->st::GetDnext() ) ); \
00159 } \
00160 \
00161 const pt* GetOprev() const \
00162 { \
00163 return( dynamic_cast< const pt* >( this->st::GetOprev() ) ); \
00164 } \
00165 \
00166 const pt* GetLprev() const \
00167 { \
00168 return( dynamic_cast< const pt* >( this->st::GetLprev() ) ); \
00169 } \
00170 \
00171 const pt* GetRprev() const \
00172 { \
00173 return( dynamic_cast< const pt* >( this->st::GetRprev() ) ); \
00174 } \
00175 \
00176 const pt* GetDprev() const \
00177 { \
00178 return( dynamic_cast< const pt* >( this->st::GetDprev() ) ); \
00179 } \
00180 \
00181 const dt* GetInvRot() const \
00182 { \
00183 return( dynamic_cast< const dt* >( this->st::GetInvRot() ) ); \
00184 } \
00185 \
00186 const pt* GetInvOnext() const \
00187 { \
00188 return( dynamic_cast< const pt* >( this->st::GetInvOnext() ) ); \
00189 } \
00190 \
00191 const pt* GetInvLnext() const \
00192 { \
00193 return( dynamic_cast< const pt* >( this->st::GetInvLnext() ) ); \
00194 } \
00195 \
00196 const pt* GetInvRnext() const \
00197 { \
00198 return( dynamic_cast< const pt* >( this->st::GetInvRnext() ) ); \
00199 } \
00200 \
00201 const pt* GetInvDnext() const \
00202 { \
00203 return( dynamic_cast< const pt* >( this->st::GetInvDnext() ) ); \
00204 }
00205
00206
00207 namespace itk
00208 {
00209
00223 class QuadEdge
00224 {
00225 public:
00227 typedef QuadEdge Self;
00228
00230 typedef QuadEdgeMeshIterator< Self > Iterator;
00231 typedef QuadEdgeMeshConstIterator< Self > ConstIterator;
00232
00234 itkQEDefineIteratorMethodsMacro( Onext );
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00248
00250 QuadEdge();
00251 virtual ~QuadEdge();
00253
00255 void SetOnext( Self* onext );
00256 void SetRot( Self* rot );
00258
00262 Self* GetOnext();
00263 Self* GetRot();
00264 const Self* GetOnext() const;
00265 const Self* GetRot() const;
00267
00285 void Splice( Self* b );
00286
00287
00288
00289
00292 Self* GetSym();
00293 const Self* GetSym() const;
00295
00298 Self* GetLnext();
00299 const Self* GetLnext() const;
00301
00305 Self* GetRnext();
00306 const Self* GetRnext() const;
00308
00312 Self* GetDnext();
00313 const Self* GetDnext() const;
00315
00318 Self* GetOprev();
00319 const Self* GetOprev() const;
00321
00325 Self* GetLprev();
00326 const Self* GetLprev() const;
00328
00332 Self* GetRprev();
00333 const Self* GetRprev() const;
00335
00339 Self* GetDprev();
00340 const Self* GetDprev() const;
00342
00344 Self * GetInvRot();
00345 Self * GetInvOnext();
00346 Self * GetInvLnext();
00347 Self * GetInvRnext();
00348 Self * GetInvDnext();
00349 const Self * GetInvRot() const;
00350 const Self * GetInvOnext() const;
00351 const Self * GetInvLnext() const;
00352 const Self * GetInvRnext() const;
00353 const Self * GetInvDnext() const;
00355
00357 bool IsHalfEdge() const;
00358 bool IsIsolated() const;
00359 bool IsEdgeInOnextRing( Self* testEdge ) const;
00360 bool IsLnextGivenSizeCyclic( const int size ) const;
00361 unsigned int GetOrder() const;
00363
00364 private:
00365 Self* m_Onext;
00366 Self* m_Rot;
00367 };
00368
00369 }
00370
00371 #endif
00372