ITK  4.2.0
Insight Segmentation and Registration Toolkit
itkGeometricalQuadEdge.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef __itkGeometricalQuadEdge_h
19 #define __itkGeometricalQuadEdge_h
20 
21 #include "itkQuadEdge.h"
22 
23 namespace itk
24 {
59 template< typename TVRef, typename TFRef,
60  typename TPrimalData, typename TDualData,
61  bool PrimalDual = true >
63 {
64 public:
68  typedef Self * RawPointer;
69 
75  typedef GeometricalQuadEdge< TFRef, TVRef,
76  TDualData, TPrimalData, !PrimalDual > DualType;
77 
79  typedef TVRef OriginRefType;
80  typedef TFRef DualOriginRefType;
81  typedef TPrimalData PrimalDataType;
82  typedef TDualData DualDataType;
83  // Line Cell Id in Mesh Cell Container
84  // used to go up to LineCell level
85  typedef TFRef LineCellIdentifier;
86 public:
87 
91 
102  inline itkQEDefineIteratorGeomMethodsMacro(InvOnext);
103  inline itkQEDefineIteratorGeomMethodsMacro(InvLnext);
104  inline itkQEDefineIteratorGeomMethodsMacro(InvRnext);
105  inline itkQEDefineIteratorGeomMethodsMacro(InvDnext);
107 
110 public:
111 
114  virtual ~GeometricalQuadEdge() {}
115 
117  inline void SetOrigin(const OriginRefType v)
118  { m_Origin = v; }
119 
120  inline void SetDestination(const OriginRefType v)
121  { this->GetSym()->SetOrigin(v); }
122 
123  inline void SetRight(const DualOriginRefType v)
124  { this->GetRot()->SetOrigin(v); }
125 
126  inline void SetLeft(const DualOriginRefType v)
127  { this->GetInvRot()->SetOrigin(v); }
128 
137  int maxSize = 100);
138 
139  inline void UnsetOrigin() { m_Origin = m_NoPoint; }
140  inline void UnsetDestination() { this->GetSym()->UnsetOrigin(); }
141  inline void UnsetRight() { this->GetRot()->UnsetOrigin(); }
142  inline void UnsetLeft() { this->GetInvRot()->UnsetOrigin(); }
143 
145  //ORIENTATION_NOTE: this definition of GetLeft (or GetRight)
146  // implicitely assumes that the Onext order is counter-clockwise !
147  inline const OriginRefType GetOrigin() const { return ( m_Origin ); }
148  inline const OriginRefType GetDestination() const { return ( GetSym()->GetOrigin() ); }
149  inline const DualOriginRefType GetRight() const { return ( GetRot()->GetOrigin() ); }
150  inline const DualOriginRefType GetLeft() const { return ( GetInvRot()->GetOrigin() ); }
152 
154  bool IsOriginSet() const;
155 
156  bool IsDestinationSet() const;
157 
158  bool IsRightSet() const;
159 
160  bool IsLeftSet() const;
161 
163  inline void SetPrimalData(const PrimalDataType data)
164  { m_Data = data; this->SetPrimalData(); }
165  inline void SetDualData(const DualDataType data)
166  { this->GetRot()->SetPrimalData(data); }
168 
169  inline void SetPrimalData() { m_DataSet = true; }
170  inline void SetDualData() { this->GetRot()->SetPrimalData(); }
171 
172  inline void UnsetPrimalData() { m_Data = false; }
173  inline void UnsetDualData() { this->GetRot()->UnsetPrimalData(); }
174 
176  inline PrimalDataType GetPrimalData() { return ( m_Data ); }
178  { return ( this->GetRot()->GetPrimalData() ); }
180 
182  inline bool IsPrimalDataSet() { return ( m_DataSet ); }
183  inline bool IsDualDataSet()
184  { return ( this->GetRot()->IsPrimalDataSet() ); }
186 
191  inline bool IsWire()
192  { return ( !( this->IsLeftSet() ) && !( this->IsRightSet() ) ); }
193 
199  inline bool IsAtBorder()
200  {
201  return ( ( this->IsLeftSet() && !this->IsRightSet() )
202  || ( !this->IsLeftSet() && this->IsRightSet() ) );
203  }
204 
209  inline bool IsInternal() const
210  { return ( this->IsLeftSet() && this->IsRightSet() ); }
211 
212  bool IsOriginInternal() const;
213 
214  bool IsLnextSharingSameFace(int maxSize = 100);
215 
216  bool IsLnextOfTriangle();
217 
218  bool IsInOnextRing(Self *);
219 
220  bool IsInLnextRing(Self *);
221 
222  Self * GetNextBorderEdgeWithUnsetLeft(Self *edgeTest = 0);
223 
225  Self *hint = 0);
226 
227  bool ReorderOnextRingBeforeAddFace(Self *second);
228 
230  inline bool IsOriginDisconnected()
231  { return ( this == this->GetOnext() ); }
233  { return ( this->GetSym()->IsOriginDisconnected() ); }
234  inline bool IsDisconnected()
235  {
236  return ( this->IsOriginDisconnected()
237  && this->IsDestinationDisconnected() );
238  }
240 
241  void Disconnect();
242 
243  inline void SetIdent(const LineCellIdentifier & User_Value) { this->m_LineCellIdent = User_Value; }
244  inline LineCellIdentifier GetIdent() { return ( this->m_LineCellIdent ); }
245 public:
246  // Reserved OriginRefType designated to represent the absence of Origin
247  static const OriginRefType m_NoPoint;
248 protected:
249  OriginRefType m_Origin; // Geometrical information
250  PrimalDataType m_Data; // User data associated to this edge.
251  bool m_DataSet; // Indicates if the data is set.
253 };
254 }
255 
256 #ifndef ITK_MANUAL_INSTANTIATION
257 #include "itkGeometricalQuadEdge.hxx"
258 #endif
259 
260 #endif
261