Go to the documentation of this file.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
00057 #define itkQEAccessorsMacro( st, pt, dt ) \
00058 pt* GetOnext() \
00059 { \
00060 return( dynamic_cast< pt* >( this->st::GetOnext() ) ); \
00061 } \
00062 \
00063 dt* GetRot() \
00064 { \
00065 return( dynamic_cast< dt* >( this->st::GetRot() ) ); \
00066 } \
00067 \
00068 pt* GetSym() \
00069 { \
00070 return( dynamic_cast< pt* >( this->st::GetSym() ) ); \
00071 } \
00072 \
00073 pt* GetLnext() \
00074 { \
00075 return( dynamic_cast< pt* >( this->st::GetLnext() ) ); \
00076 } \
00077 \
00078 pt* GetRnext() \
00079 { \
00080 return( dynamic_cast< pt* >( this->st::GetRnext() ) ); \
00081 } \
00082 \
00083 pt* GetDnext() \
00084 { \
00085 return( dynamic_cast< pt* >( this->st::GetDnext() ) ); \
00086 } \
00087 \
00088 pt* GetOprev() \
00089 { \
00090 return( dynamic_cast< pt* >( this->st::GetOprev() ) ); \
00091 } \
00092 \
00093 pt* GetLprev() \
00094 { \
00095 return( dynamic_cast< pt* >( this->st::GetLprev() ) ); \
00096 } \
00097 \
00098 pt* GetRprev() \
00099 { \
00100 return( dynamic_cast< pt* >( this->st::GetRprev() ) ); \
00101 } \
00102 \
00103 pt* GetDprev() \
00104 { \
00105 return( dynamic_cast< pt* >( this->st::GetDprev() ) ); \
00106 } \
00107 \
00108 dt* GetInvRot() \
00109 { \
00110 return( dynamic_cast< dt* >( this->st::GetInvRot() ) ); \
00111 } \
00112 \
00113 pt* GetInvOnext() \
00114 { \
00115 return( dynamic_cast< pt* >( this->st::GetInvOnext() ) ); \
00116 } \
00117 \
00118 pt* GetInvLnext() \
00119 { \
00120 return( dynamic_cast< pt* >( this->st::GetInvLnext() ) ); \
00121 } \
00122 \
00123 pt* GetInvRnext() \
00124 { \
00125 return( dynamic_cast< pt* >( this->st::GetInvRnext() ) ); \
00126 } \
00127 \
00128 pt* GetInvDnext() \
00129 { \
00130 return( dynamic_cast< pt* >( this->st::GetInvDnext() ) ); \
00131 } \
00132 const pt* GetOnext() const \
00133 { \
00134 return( dynamic_cast< const pt* >( this->st::GetOnext() ) ); \
00135 } \
00136 \
00137 const dt* GetRot() const \
00138 { \
00139 return( dynamic_cast< const dt* >( this->st::GetRot() ) ); \
00140 } \
00141 \
00142 const pt* GetSym() const \
00143 { \
00144 return( dynamic_cast< const pt* >( this->st::GetSym() ) ); \
00145 } \
00146 \
00147 const pt* GetLnext() const \
00148 { \
00149 return( dynamic_cast< const pt* >( this->st::GetLnext() ) ); \
00150 } \
00151 \
00152 const pt* GetRnext() const \
00153 { \
00154 return( dynamic_cast< const pt* >( this->st::GetRnext() ) ); \
00155 } \
00156 \
00157 const pt* GetDnext() const \
00158 { \
00159 return( dynamic_cast< const pt* >( this->st::GetDnext() ) ); \
00160 } \
00161 \
00162 const pt* GetOprev() const \
00163 { \
00164 return( dynamic_cast< const pt* >( this->st::GetOprev() ) ); \
00165 } \
00166 \
00167 const pt* GetLprev() const \
00168 { \
00169 return( dynamic_cast< const pt* >( this->st::GetLprev() ) ); \
00170 } \
00171 \
00172 const pt* GetRprev() const \
00173 { \
00174 return( dynamic_cast< const pt* >( this->st::GetRprev() ) ); \
00175 } \
00176 \
00177 const pt* GetDprev() const \
00178 { \
00179 return( dynamic_cast< const pt* >( this->st::GetDprev() ) ); \
00180 } \
00181 \
00182 const dt* GetInvRot() const \
00183 { \
00184 return( dynamic_cast< const dt* >( this->st::GetInvRot() ) ); \
00185 } \
00186 \
00187 const pt* GetInvOnext() const \
00188 { \
00189 return( dynamic_cast< const pt* >( this->st::GetInvOnext() ) ); \
00190 } \
00191 \
00192 const pt* GetInvLnext() const \
00193 { \
00194 return( dynamic_cast< const pt* >( this->st::GetInvLnext() ) ); \
00195 } \
00196 \
00197 const pt* GetInvRnext() const \
00198 { \
00199 return( dynamic_cast< const pt* >( this->st::GetInvRnext() ) ); \
00200 } \
00201 \
00202 const pt* GetInvDnext() const \
00203 { \
00204 return( dynamic_cast< const pt* >( this->st::GetInvDnext() ) ); \
00205 }
00206
00207
00208 namespace itk
00209 {
00210
00224 class QuadEdge
00225 {
00226 public:
00228 typedef QuadEdge Self;
00229
00231 typedef QuadEdgeMeshIterator< Self > Iterator;
00232 typedef QuadEdgeMeshConstIterator< Self > ConstIterator;
00233
00235 inline itkQEDefineIteratorMethodsMacro( Onext );
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00249
00251 QuadEdge();
00252 virtual ~QuadEdge();
00254
00256 inline void SetOnext( Self* onext ) { this->m_Onext = onext; }
00257 inline void SetRot( Self* rot ) { this->m_Rot = rot; }
00259
00263 inline Self* GetOnext() {return this->m_Onext;}
00264 inline Self* GetRot() {return this->m_Rot;}
00265 inline const Self* GetOnext() const {return this->m_Onext;}
00266 inline const Self* GetRot() const {return this->m_Rot;}
00268
00285
00286
00287 inline void Splice( Self* b )
00288 {
00289 Self * aNext = this->GetOnext();
00290 Self * bNext = b->GetOnext();
00291 Self * alpha = aNext->GetRot();
00292 Self * beta = bNext->GetRot();
00293 Self * alphaNext = alpha->GetOnext();
00294 Self * betaNext = beta->GetOnext();
00296
00297 this->SetOnext( bNext );
00298 b->SetOnext( aNext );
00299 alpha->SetOnext( betaNext );
00300 beta->SetOnext( alphaNext );
00301 }
00302
00303
00304
00305
00308 inline Self* GetSym()
00309 {
00310 if(this->m_Rot)
00311 {
00312 return( this->m_Rot->m_Rot );
00313 }
00314 return( this->m_Rot );
00315 }
00316 inline const Self* GetSym() const
00317 {
00318 if( this->m_Rot)
00319 {
00320 return( this->m_Rot->m_Rot );
00321 }
00322 return( this->m_Rot );
00323 }
00325
00328 Self* GetLnext();
00329 const Self* GetLnext() const;
00331
00335 Self* GetRnext();
00336 const Self* GetRnext() const;
00338
00342 Self* GetDnext();
00343 const Self* GetDnext() const;
00345
00348 Self* GetOprev();
00349 const Self* GetOprev() const;
00351
00355 Self* GetLprev();
00356 const Self* GetLprev() const;
00358
00362 Self* GetRprev();
00363 const Self* GetRprev() const;
00365
00369 Self* GetDprev();
00370 const Self* GetDprev() const;
00372
00374 inline Self * GetInvRot()
00375 {
00376 #ifdef NDEBUG
00377 return( this->GetRot()->GetRot()->GetRot() );
00378 #else
00379 Self * p1 = this->GetRot();
00380 if( !p1 ) return NULL;
00381 Self * p2 = p1->GetRot();
00382 if( !p2 ) return NULL;
00383 Self * p3 = p2->GetRot();
00384 if( !p3 ) return NULL;
00385 return p3;
00386 #endif
00387 }
00388 inline Self * GetInvOnext() { return this->GetOprev(); }
00389 inline Self * GetInvLnext() { return this->GetLprev(); }
00390 inline Self * GetInvRnext() { return this->GetRprev(); }
00391 inline Self * GetInvDnext() { return this->GetDprev(); }
00392 inline const Self * GetInvRot() const
00393 {
00394 #ifdef NDEBUG
00395 return( this->GetRot()->GetRot()->GetRot() );
00396 #else
00397 const Self * p1 = this->GetRot();
00398 if( !p1 ) return NULL;
00399 const Self * p2 = p1->GetRot();
00400 if( !p2 ) return NULL;
00401 const Self * p3 = p2->GetRot();
00402 if( !p3 ) return NULL;
00403 return p3;
00404 #endif
00405 }
00406 inline const Self * GetInvOnext() const { return this->GetOprev(); }
00407 inline const Self * GetInvLnext() const { return this->GetLprev(); }
00408 inline const Self * GetInvRnext() const { return this->GetRprev(); }
00409 inline const Self * GetInvDnext() const { return this->GetDprev(); }
00411
00413 inline bool IsHalfEdge() const { return( ( m_Onext == this ) || ( m_Rot == NULL ) ); }
00414 inline bool IsIsolated() const { return( this == this->GetOnext() ); }
00415 bool IsEdgeInOnextRing( Self* testEdge ) const;
00416 bool IsLnextGivenSizeCyclic( const int size ) const;
00417 unsigned int GetOrder() const;
00419
00420 private:
00424 };
00425
00426 }
00427
00428 #endif
00429