ITK  5.2.0
Insight Toolkit
itkGeometricalQuadEdge.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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 {
60 template <typename TVRef, typename TFRef, typename TPrimalData, typename TDualData, bool PrimalDual = true>
61 class ITK_TEMPLATE_EXPORT GeometricalQuadEdge : public QuadEdge
62 {
63 public:
64 
68  using RawPointer = Self *;
69 
76 
78  using OriginRefType = TVRef;
79  using DualOriginRefType = TFRef;
80  using PrimalDataType = TPrimalData;
81  using DualDataType = TDualData;
82  // Line Cell Id in Mesh Cell Container
83  // used to go up to LineCell level
84  using LineCellIdentifier = TFRef;
85 
86 public:
90 
101  inline itkQEDefineIteratorGeomMethodsMacro(InvOnext);
102  inline itkQEDefineIteratorGeomMethodsMacro(InvLnext);
103  inline itkQEDefineIteratorGeomMethodsMacro(InvRnext);
104  inline itkQEDefineIteratorGeomMethodsMacro(InvDnext);
106 
109 
110 public:
112  GeometricalQuadEdge(const GeometricalQuadEdge &) = default;
115  operator=(const GeometricalQuadEdge &) = default;
117  operator=(GeometricalQuadEdge &&) = default;
118  ~GeometricalQuadEdge() override = default;
119 
121  inline void
123  {
124  m_Origin = v;
125  }
126 
127  inline void
129  {
130  this->GetSym()->SetOrigin(v);
131  }
132 
133  inline void
135  {
136  this->GetRot()->SetOrigin(v);
137  }
138 
139  inline void
141  {
142  this->GetInvRot()->SetOrigin(v);
143  }
144 
152  bool
153  SetLnextRingWithSameLeftFace(const DualOriginRefType faceGeom, int maxSize = 100);
154 
155  inline void
157  {
158  m_Origin = m_NoPoint;
159  }
160  inline void
162  {
163  this->GetSym()->UnsetOrigin();
164  }
165  inline void
167  {
168  this->GetRot()->UnsetOrigin();
169  }
170  inline void
172  {
173  this->GetInvRot()->UnsetOrigin();
174  }
175 
177  // ORIENTATION_NOTE: this definition of GetLeft (or GetRight)
178  // implicitly assumes that the Onext order is counter-clockwise !
179  inline const OriginRefType
180  GetOrigin() const
181  {
182  return (m_Origin);
183  }
184  inline const OriginRefType
186  {
187  return (GetSym()->GetOrigin());
188  }
189  inline const DualOriginRefType
190  GetRight() const
191  {
192  return (GetRot()->GetOrigin());
193  }
194  inline const DualOriginRefType
195  GetLeft() const
196  {
197  return (GetInvRot()->GetOrigin());
198  }
200 
202  bool
203  IsOriginSet() const;
204 
205  bool
206  IsDestinationSet() const;
207 
208  bool
209  IsRightSet() const;
210 
211  bool
212  IsLeftSet() const;
213 
215  inline void
217  {
218  m_Data = data;
219  this->SetPrimalData();
220  }
221  inline void
223  {
224  this->GetRot()->SetPrimalData(data);
225  }
227 
228  inline void
230  {
231  m_DataSet = true;
232  }
233  inline void
235  {
236  this->GetRot()->SetPrimalData();
237  }
238 
239  inline void
241  {
242  m_Data = false;
243  }
244  inline void
246  {
247  this->GetRot()->UnsetPrimalData();
248  }
249 
251  inline PrimalDataType
253  {
254  return (m_Data);
255  }
256  inline DualDataType
258  {
259  return (this->GetRot()->GetPrimalData());
260  }
262 
264  inline bool
266  {
267  return (m_DataSet);
268  }
269  inline bool
271  {
272  return (this->GetRot()->IsPrimalDataSet());
273  }
275 
280  inline bool
282  {
283  return (!(this->IsLeftSet()) && !(this->IsRightSet()));
284  }
285 
291  inline bool
293  {
294  return ((this->IsLeftSet() && !this->IsRightSet()) || (!this->IsLeftSet() && this->IsRightSet()));
295  }
296 
301  inline bool
302  IsInternal() const
303  {
304  return (this->IsLeftSet() && this->IsRightSet());
305  }
306 
307  bool
308  IsOriginInternal() const;
309 
310  bool
311  IsLnextSharingSameFace(int maxSize = 100);
312 
313  bool
314  IsLnextOfTriangle();
315 
316  bool
317  IsInOnextRing(Self *);
318 
319  bool
320  IsInLnextRing(Self *);
321 
322  Self *
323  GetNextBorderEdgeWithUnsetLeft(Self * edgeTest = nullptr);
324 
325  bool
326  InsertAfterNextBorderEdgeWithUnsetLeft(Self * isol, Self * hint = nullptr);
327 
328  bool
329  ReorderOnextRingBeforeAddFace(Self * second);
330 
332  inline bool
334  {
335  return (this == this->GetOnext());
336  }
337  inline bool
339  {
340  return (this->GetSym()->IsOriginDisconnected());
341  }
342  inline bool
344  {
345  return (this->IsOriginDisconnected() && this->IsDestinationDisconnected());
346  }
348 
349  void
350  Disconnect();
351 
352  inline void
353  SetIdent(const LineCellIdentifier & User_Value)
354  {
355  this->m_LineCellIdent = User_Value;
356  }
357  inline LineCellIdentifier
359  {
360  return (this->m_LineCellIdent);
361  }
362 
363 public:
364  // Reserved OriginRefType designated to represent the absence of Origin
365  static const OriginRefType m_NoPoint;
366 
367 protected:
368  OriginRefType m_Origin; // Geometrical information
369  PrimalDataType m_Data; // User data associated to this edge.
370  bool m_DataSet{ false }; // Indicates if the data is set.
372 };
373 } // namespace itk
374 
375 #ifndef ITK_MANUAL_INSTANTIATION
376 # include "itkGeometricalQuadEdge.hxx"
377 #endif
378 
379 #endif
itk::GeometricalQuadEdge::IsInternal
bool IsInternal() const
Definition: itkGeometricalQuadEdge.h:302
itk::GeometricalQuadEdge::SetLeft
void SetLeft(const DualOriginRefType v)
Definition: itkGeometricalQuadEdge.h:140
itk::GeometricalQuadEdge::IsDisconnected
bool IsDisconnected()
Definition: itkGeometricalQuadEdge.h:343
itk::GeometricalQuadEdge
This class extends the QuadEdge by adding a reference to the Origin.
Definition: itkGeometricalQuadEdge.h:61
itk::GeometricalQuadEdge::UnsetOrigin
void UnsetOrigin()
Definition: itkGeometricalQuadEdge.h:156
itk::GeometricalQuadEdge::IsPrimalDataSet
bool IsPrimalDataSet()
Definition: itkGeometricalQuadEdge.h:265
itk::GeometricalQuadEdge::IsDestinationDisconnected
bool IsDestinationDisconnected()
Definition: itkGeometricalQuadEdge.h:338
itk::GeometricalQuadEdge::PrimalDataType
TPrimalData PrimalDataType
Definition: itkGeometricalQuadEdge.h:80
itk::GeometricalQuadEdge::UnsetDualData
void UnsetDualData()
Definition: itkGeometricalQuadEdge.h:245
itk::GeometricalQuadEdge::GetOrigin
const OriginRefType GetOrigin() const
Definition: itkGeometricalQuadEdge.h:180
itk::GeometricalQuadEdge::OriginRefType
TVRef OriginRefType
Definition: itkGeometricalQuadEdge.h:78
itk::GeometricalQuadEdge::DualOriginRefType
TFRef DualOriginRefType
Definition: itkGeometricalQuadEdge.h:79
itk::GeometricalQuadEdge::IsWire
bool IsWire()
Definition: itkGeometricalQuadEdge.h:281
itk::GeometricalQuadEdge::SetIdent
void SetIdent(const LineCellIdentifier &User_Value)
Definition: itkGeometricalQuadEdge.h:353
itk::GeometricalQuadEdge::SetPrimalData
void SetPrimalData(const PrimalDataType data)
Definition: itkGeometricalQuadEdge.h:216
itk::GeometricalQuadEdge::SetRight
void SetRight(const DualOriginRefType v)
Definition: itkGeometricalQuadEdge.h:134
itk::GeometricalQuadEdge::UnsetLeft
void UnsetLeft()
Definition: itkGeometricalQuadEdge.h:171
itkQEAccessorsMacro
#define itkQEAccessorsMacro(st, pt, dt)
Definition: itkQuadEdge.h:57
itk::GeometricalQuadEdge::GetRight
const DualOriginRefType GetRight() const
Definition: itkGeometricalQuadEdge.h:190
itk::GeometricalQuadEdge::m_LineCellIdent
LineCellIdentifier m_LineCellIdent
Definition: itkGeometricalQuadEdge.h:371
itk::GeometricalQuadEdge::SetPrimalData
void SetPrimalData()
Definition: itkGeometricalQuadEdge.h:229
itk::GeometricalQuadEdge::m_NoPoint
static const OriginRefType m_NoPoint
Definition: itkGeometricalQuadEdge.h:365
itk::GeometricalQuadEdge::SetOrigin
void SetOrigin(const OriginRefType v)
Definition: itkGeometricalQuadEdge.h:122
itk::GeometricalQuadEdge::DualDataType
TDualData DualDataType
Definition: itkGeometricalQuadEdge.h:81
itk::GeometricalQuadEdge::GetDestination
const OriginRefType GetDestination() const
Definition: itkGeometricalQuadEdge.h:185
itk::GeometricalQuadEdge::SetDualData
void SetDualData()
Definition: itkGeometricalQuadEdge.h:234
itk::GeometricalQuadEdge::UnsetPrimalData
void UnsetPrimalData()
Definition: itkGeometricalQuadEdge.h:240
itk::QuadEdgeMeshIteratorGeom
Non const geometrical iterator.
Definition: itkQuadEdgeMeshBaseIterator.h:289
itk::GeometricalQuadEdge::UnsetRight
void UnsetRight()
Definition: itkGeometricalQuadEdge.h:166
itk::GeometricalQuadEdge::m_Origin
OriginRefType m_Origin
Definition: itkGeometricalQuadEdge.h:368
itk::GeometricalQuadEdge::SetDualData
void SetDualData(const DualDataType data)
Definition: itkGeometricalQuadEdge.h:222
itkQuadEdge.h
itkQEDefineIteratorGeomMethodsMacro
#define itkQEDefineIteratorGeomMethodsMacro(Op)
Definition: itkQuadEdgeMeshBaseIterator.h:35
itk::GeometricalQuadEdge::GetIdent
LineCellIdentifier GetIdent()
Definition: itkGeometricalQuadEdge.h:358
itk::GeometricalQuadEdge::GetDualData
DualDataType GetDualData()
Definition: itkGeometricalQuadEdge.h:257
itk::GeometricalQuadEdge::GetPrimalData
PrimalDataType GetPrimalData()
Definition: itkGeometricalQuadEdge.h:252
itk::QuadEdge
Base class for the implementation of a quad-edge data structure as proposed in "Guibas and Stolfi 198...
Definition: itkQuadEdge.h:136
itk::GeometricalQuadEdge::IsAtBorder
bool IsAtBorder()
Definition: itkGeometricalQuadEdge.h:292
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::QuadEdgeMeshConstIteratorGeom
Const geometrical iterator.
Definition: itkQuadEdgeMeshBaseIterator.h:365
itk::GeometricalQuadEdge::UnsetDestination
void UnsetDestination()
Definition: itkGeometricalQuadEdge.h:161
itk::GeometricalQuadEdge::LineCellIdentifier
TFRef LineCellIdentifier
Definition: itkGeometricalQuadEdge.h:84
itk::GeometricalQuadEdge::SetDestination
void SetDestination(const OriginRefType v)
Definition: itkGeometricalQuadEdge.h:128
itk::GeometricalQuadEdge::IsDualDataSet
bool IsDualDataSet()
Definition: itkGeometricalQuadEdge.h:270
itk::GeometricalQuadEdge::IsOriginDisconnected
bool IsOriginDisconnected()
Definition: itkGeometricalQuadEdge.h:333
itk::GeometricalQuadEdge::m_Data
PrimalDataType m_Data
Definition: itkGeometricalQuadEdge.h:369
itk::GeometricalQuadEdge::GetLeft
const DualOriginRefType GetLeft() const
Definition: itkGeometricalQuadEdge.h:195