Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkGeometricalQuadEdge.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkGeometricalQuadEdge.h,v $
00005   Language:  C++
00006   Date:      $Date: 2007/02/25 15:03:11 $
00007   Version:   $Revision: 1.11 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00014      PURPOSE.  See the above copyright notices for more information.
00015 
00016 =========================================================================*/
00017 
00018 #ifndef __itkGeometricalQuadEdge_h
00019 #define __itkGeometricalQuadEdge_h
00020 
00021 #include "itkQuadEdge.h"
00022 
00023 namespace itk
00024 {
00025 
00060 template< typename TVRef,  typename TFRef,
00061           typename TPrimalData, typename TDualData, 
00062           bool PrimalDual = true >
00063 class GeometricalQuadEdge : public QuadEdge
00064 {
00065 public:
00067   typedef GeometricalQuadEdge   Self;
00068   typedef QuadEdge              Superclass;
00069   typedef Self*                 RawPointer;
00070 
00076   typedef GeometricalQuadEdge< TFRef, TVRef, 
00077     TDualData, TPrimalData, !PrimalDual >         DualType;
00078 
00080   typedef TVRef               OriginRefType;
00081   typedef TFRef               DualOriginRefType;
00082   typedef TPrimalData         PrimalDataType;
00083   typedef TDualData           DualDataType;
00084 
00085 public:
00086 
00088   typedef QuadEdgeMeshIteratorGeom< Self >      IteratorGeom;
00089   typedef QuadEdgeMeshConstIteratorGeom< Self > ConstIteratorGeom;
00090 
00092   itkQEDefineIteratorGeomMethodsMacro( Onext );
00093   itkQEDefineIteratorGeomMethodsMacro( Sym );
00094   itkQEDefineIteratorGeomMethodsMacro( Lnext );
00095   itkQEDefineIteratorGeomMethodsMacro( Rnext );
00096   itkQEDefineIteratorGeomMethodsMacro( Dnext );
00097   itkQEDefineIteratorGeomMethodsMacro( Oprev );
00098   itkQEDefineIteratorGeomMethodsMacro( Lprev );
00099   itkQEDefineIteratorGeomMethodsMacro( Rprev );
00100   itkQEDefineIteratorGeomMethodsMacro( Dprev );
00101   itkQEDefineIteratorGeomMethodsMacro( InvOnext );
00102   itkQEDefineIteratorGeomMethodsMacro( InvLnext );
00103   itkQEDefineIteratorGeomMethodsMacro( InvRnext );
00104   itkQEDefineIteratorGeomMethodsMacro( InvDnext );
00106 
00107 
00109   itkQEAccessorsMacro( Superclass, Self, DualType );
00110 
00111 public:
00113   GeometricalQuadEdge();
00114   virtual ~GeometricalQuadEdge();
00116 
00118   void SetOrigin( const OriginRefType v )
00119     { m_Origin = v; }
00120 
00121   void SetDestination( const OriginRefType v )
00122     { this->GetSym()->SetOrigin( v ); }
00123 
00124   void SetRight( const DualOriginRefType v )
00125     { this->GetRot()->SetOrigin( v ); }
00126 
00127   void SetLeft( const DualOriginRefType v )
00128     { this->GetInvRot()->SetOrigin( v ); }
00129 
00137   bool SetLnextRingWithSameLeftFace( const DualOriginRefType faceGeom,
00138                                      int maxSize = 100 );
00139 
00140   void UnsetOrigin()   { m_Origin = m_NoPoint; }
00141   void UnsetDestination()  { this->GetSym()->UnsetOrigin(); }
00142   void UnsetRight() { this->GetRot()->UnsetOrigin(); }
00143   void UnsetLeft()  { this->GetInvRot()->UnsetOrigin(); }
00144 
00146   //ORIENTATION_NOTE: this definition of GetLeft (or GetRight)
00147   // implicitely assumes that the Onext order is counter-clockwise !
00148   OriginRefType     GetOrigin()   { return( m_Origin ); }
00149   OriginRefType     GetDestination()  { return( this->GetSym()->GetOrigin() ); }
00150   DualOriginRefType GetRight() { return( this->GetRot()->GetOrigin() ); }
00151   DualOriginRefType GetLeft()  { return( this->GetInvRot()->GetOrigin() ); }
00153 
00155   bool IsOriginSet() const;
00156   bool IsDestinationSet() const;
00157   bool IsRightSet() const;
00158   bool IsLeftSet() const;
00160 
00162   void SetPrimalData( const PrimalDataType data )
00163   { m_Data = data; this->SetPrimalData(); }
00164   void SetDualData( const DualDataType data )
00165   { this->GetRot()->SetPrimalData( data ); }
00167 
00168   void SetPrimalData() { m_DataSet = true; }
00169   void SetDualData()   { this->GetRot()->SetPrimalData(); }
00170 
00171   void UnsetPrimalData() { m_Data = false; }
00172   void UnsetDualData()   { this->GetRot()->UnsetPrimalData(); }
00173 
00175   PrimalDataType GetPrimalData() { return( m_Data ); }
00176   DualDataType   GetDualData()
00177     { return( this->GetRot()->GetPrimalData() ); }
00179 
00181   bool IsPrimalDataSet() { return( m_DataSet ); }
00182   bool IsDualDataSet()
00183     { return( this->GetRot()->IsPrimalDataSet() ); }
00185 
00190   bool IsWire()
00191     { return( !( this->IsLeftSet() ) && !( this->IsRightSet() ) ); }
00192 
00198   bool IsAtBorder()
00199     {
00200     return( ( this->IsLeftSet() && !this->IsRightSet() ) ||
00201             ( !this->IsLeftSet() && this->IsRightSet() ) );
00202     }
00203 
00208   bool IsInternal() const
00209     { return( this->IsLeftSet() && this->IsRightSet() ); }
00210 
00211   bool IsOriginInternal() const;
00212   bool IsLnextSharingSameFace( int maxSize = 100 );
00213   bool IsLnextOfTriangle();
00214   bool IsInOnextRing( Self* );
00215   bool IsInLnextRing( Self* );
00216 
00217   Self* GetNextBorderEdgeWithUnsetLeft( Self* edgeTest = 0 );
00218 
00219   bool InsertAfterNextBorderEdgeWithUnsetLeft( Self* isol,
00220                                                Self* hint = 0 );
00221 
00222   bool ReorderOnextRingBeforeAddFace( Self* second );
00223 
00225   bool IsOriginDisconnected()
00226     { return( this == this->GetOnext() ); }
00227   bool IsDestinationDisconnected()
00228     { return( this->GetSym()->IsOriginDisconnected() ); }
00229   bool IsDisconnected()
00230     { return( this->IsOriginDisconnected() &&
00231               this->IsDestinationDisconnected() ); }
00232   void Disconnect();
00234 
00235 public:
00236   // Reserved OriginRefType designated to represent the absence of Origin
00237   static const OriginRefType m_NoPoint;
00238 
00239 protected:
00240   OriginRefType     m_Origin;    // Geometrical information
00241   PrimalDataType    m_Data;      // User data associated to this edge.
00242   bool              m_DataSet;   // Indicates if the data is set.
00243 };
00244 
00245 } 
00246 
00247 #ifndef ITK_MANUAL_INSTANTIATION
00248 #include "itkGeometricalQuadEdge.txx"
00249 #endif
00250 
00251 #endif 
00252 

Generated at Mon Mar 12 00:28:53 2007 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000