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: 2008-02-07 15:58:06 $
00007   Version:   $Revision: 1.15 $
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   // Line Cell Id in Mesh Cell Container
00085   // used to go up to LineCell level
00086   typedef TFRef  LineCellIdentifier;
00087 
00088 public:
00089 
00091   typedef QuadEdgeMeshIteratorGeom< Self >      IteratorGeom;
00092   typedef QuadEdgeMeshConstIteratorGeom< Self > ConstIteratorGeom;
00093 
00095   itkQEDefineIteratorGeomMethodsMacro( Onext );
00096   itkQEDefineIteratorGeomMethodsMacro( Sym );
00097   itkQEDefineIteratorGeomMethodsMacro( Lnext );
00098   itkQEDefineIteratorGeomMethodsMacro( Rnext );
00099   itkQEDefineIteratorGeomMethodsMacro( Dnext );
00100   itkQEDefineIteratorGeomMethodsMacro( Oprev );
00101   itkQEDefineIteratorGeomMethodsMacro( Lprev );
00102   itkQEDefineIteratorGeomMethodsMacro( Rprev );
00103   itkQEDefineIteratorGeomMethodsMacro( Dprev );
00104   itkQEDefineIteratorGeomMethodsMacro( InvOnext );
00105   itkQEDefineIteratorGeomMethodsMacro( InvLnext );
00106   itkQEDefineIteratorGeomMethodsMacro( InvRnext );
00107   itkQEDefineIteratorGeomMethodsMacro( InvDnext );
00109 
00110 
00112   itkQEAccessorsMacro( Superclass, Self, DualType );
00113 
00114 public:
00116   GeometricalQuadEdge();
00117   virtual ~GeometricalQuadEdge() {};
00119 
00121   void SetOrigin( const OriginRefType v )
00122     { m_Origin = v; }
00123 
00124   void SetDestination( const OriginRefType v )
00125     { this->GetSym()->SetOrigin( v ); }
00126 
00127   void SetRight( const DualOriginRefType v )
00128     { this->GetRot()->SetOrigin( v ); }
00129 
00130   void SetLeft( const DualOriginRefType v )
00131     { this->GetInvRot()->SetOrigin( v ); }
00132 
00140   bool SetLnextRingWithSameLeftFace( const DualOriginRefType faceGeom,
00141                                      int maxSize = 100 );
00142 
00143   void UnsetOrigin()   { m_Origin = m_NoPoint; }
00144   void UnsetDestination()  { this->GetSym()->UnsetOrigin(); }
00145   void UnsetRight() { this->GetRot()->UnsetOrigin(); }
00146   void UnsetLeft()  { this->GetInvRot()->UnsetOrigin(); }
00147 
00149   //ORIENTATION_NOTE: this definition of GetLeft (or GetRight)
00150   // implicitely assumes that the Onext order is counter-clockwise !
00151   const OriginRefType GetOrigin() const  { return( m_Origin ); }
00152   const OriginRefType GetDestination()  const { return( GetSym()->GetOrigin() ); }
00153   const DualOriginRefType GetRight() const { return( GetRot()->GetOrigin() ); }
00154   const DualOriginRefType GetLeft() const  { return( GetInvRot()->GetOrigin() ); }
00156 
00158   bool IsOriginSet() const;
00159   bool IsDestinationSet() const;
00160   bool IsRightSet() const;
00161   bool IsLeftSet() const;
00163 
00165   void SetPrimalData( const PrimalDataType data )
00166   { m_Data = data; this->SetPrimalData(); }
00167   void SetDualData( const DualDataType data )
00168   { this->GetRot()->SetPrimalData( data ); }
00170 
00171   void SetPrimalData() { m_DataSet = true; }
00172   void SetDualData()   { this->GetRot()->SetPrimalData(); }
00173 
00174   void UnsetPrimalData() { m_Data = false; }
00175   void UnsetDualData()   { this->GetRot()->UnsetPrimalData(); }
00176 
00178   PrimalDataType GetPrimalData() { return( m_Data ); }
00179   DualDataType   GetDualData()
00180     { return( this->GetRot()->GetPrimalData() ); }
00182 
00184   bool IsPrimalDataSet() { return( m_DataSet ); }
00185   bool IsDualDataSet()
00186     { return( this->GetRot()->IsPrimalDataSet() ); }
00188 
00193   bool IsWire()
00194     { return( !( this->IsLeftSet() ) && !( this->IsRightSet() ) ); }
00195 
00201   bool IsAtBorder()
00202     {
00203     return( ( this->IsLeftSet() && !this->IsRightSet() ) ||
00204             ( !this->IsLeftSet() && this->IsRightSet() ) );
00205     }
00206 
00211   bool IsInternal() const
00212     { return( this->IsLeftSet() && this->IsRightSet() ); }
00213 
00214   bool IsOriginInternal() const;
00215   bool IsLnextSharingSameFace( int maxSize = 100 );
00216   bool IsLnextOfTriangle();
00217   bool IsInOnextRing( Self* );
00218   bool IsInLnextRing( Self* );
00219 
00220   Self* GetNextBorderEdgeWithUnsetLeft( Self* edgeTest = 0 );
00221 
00222   bool InsertAfterNextBorderEdgeWithUnsetLeft( Self* isol,
00223                                                Self* hint = 0 );
00224 
00225   bool ReorderOnextRingBeforeAddFace( Self* second );
00226 
00228   bool IsOriginDisconnected()
00229     { return( this == this->GetOnext() ); }
00230   bool IsDestinationDisconnected()
00231     { return( this->GetSym()->IsOriginDisconnected() ); }
00232   bool IsDisconnected()
00233     { return( this->IsOriginDisconnected() &&
00234               this->IsDestinationDisconnected() ); }
00235   void Disconnect();
00237 
00238   void SetIdent( const LineCellIdentifier& User_Value ) { this->m_LineCellIdent = User_Value; };
00239   LineCellIdentifier GetIdent( ) { return( this->m_LineCellIdent ); };
00240 
00241 public:
00242   // Reserved OriginRefType designated to represent the absence of Origin
00243   static const OriginRefType m_NoPoint;
00244 
00245 protected:
00246   OriginRefType      m_Origin;    // Geometrical information
00247   PrimalDataType     m_Data;      // User data associated to this edge.
00248   bool               m_DataSet;   // Indicates if the data is set.
00249   LineCellIdentifier m_LineCellIdent;
00250 
00251 };
00252 
00253 } 
00254 
00255 #ifndef ITK_MANUAL_INSTANTIATION
00256 #include "itkGeometricalQuadEdge.txx"
00257 #endif
00258 
00259 #endif 
00260 

Generated at Mon Apr 14 12:33:21 2008 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000