ITK  6.0.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 * https://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
23namespace itk
24{
60template <typename TVRef, typename TFRef, typename TPrimalData, typename TDualData, bool PrimalDual = true>
61class ITK_TEMPLATE_EXPORT GeometricalQuadEdge : public QuadEdge
62{
63public:
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
86public:
90
109
110public:
115 operator=(const 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 }
202 bool
203 IsOriginSet() const;
204
205 bool
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 }
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 }
264 inline bool
266 {
267 return (m_DataSet);
268 }
269 inline bool
271 {
272 return (this->GetRot()->IsPrimalDataSet());
273 }
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
303 {
304 return (this->IsLeftSet() && this->IsRightSet());
305 }
306
307 bool
309
310 bool
311 IsLnextSharingSameFace(int maxSize = 100);
312
313 bool
315
316 bool
318
319 bool
321
322 Self *
324
325 bool
327
328 bool
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 }
349 void
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
363public:
364 // Reserved OriginRefType designated to represent the absence of Origin
366
367protected:
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.
371 LineCellIdentifier m_LineCellIdent{};
372};
373} // namespace itk
374
375#ifndef ITK_MANUAL_INSTANTIATION
376# include "itkGeometricalQuadEdge.hxx"
377#endif
378
379#endif
This class extends the QuadEdge by adding a reference to the Origin.
const OriginRefType GetOrigin() const
bool IsOriginInternal() const
bool IsInLnextRing(Self *)
Self * GetNextBorderEdgeWithUnsetLeft(Self *edgeTest=nullptr)
void SetRight(const DualOriginRefType v)
itkQEDefineIteratorGeomMethodsMacro(InvRnext)
itkQEDefineIteratorGeomMethodsMacro(InvDnext)
itkQEDefineIteratorGeomMethodsMacro(Rprev)
itkQEDefineIteratorGeomMethodsMacro(Lprev)
itkQEDefineIteratorGeomMethodsMacro(InvOnext)
~GeometricalQuadEdge() override=default
itkQEDefineIteratorGeomMethodsMacro(Lnext)
itkQEDefineIteratorGeomMethodsMacro(Rnext)
void SetDualData(const DualDataType data)
itkQEDefineIteratorGeomMethodsMacro(Onext)
itkQEDefineIteratorGeomMethodsMacro(InvLnext)
const OriginRefType GetDestination() const
bool IsDestinationSet() const
itkQEDefineIteratorGeomMethodsMacro(Dnext)
void SetPrimalData(const PrimalDataType data)
GeometricalQuadEdge(GeometricalQuadEdge &&)=default
void SetDestination(const OriginRefType v)
itkQEDefineIteratorGeomMethodsMacro(Dprev)
bool InsertAfterNextBorderEdgeWithUnsetLeft(Self *isol, Self *hint=nullptr)
static const OriginRefType m_NoPoint
bool SetLnextRingWithSameLeftFace(const DualOriginRefType faceGeom, int maxSize=100)
itkQEDefineIteratorGeomMethodsMacro(Oprev)
GeometricalQuadEdge & operator=(GeometricalQuadEdge &&)=default
const DualOriginRefType GetRight() const
bool IsLnextSharingSameFace(int maxSize=100)
bool ReorderOnextRingBeforeAddFace(Self *second)
void SetLeft(const DualOriginRefType v)
const DualOriginRefType GetLeft() const
GeometricalQuadEdge & operator=(const GeometricalQuadEdge &)=default
itkQEAccessorsMacro(Superclass, Self, DualType)
GeometricalQuadEdge(const GeometricalQuadEdge &)=default
void SetIdent(const LineCellIdentifier &User_Value)
void SetOrigin(const OriginRefType v)
bool IsInOnextRing(Self *)
Non const geometrical iterator.
Base class for the implementation of a quad-edge data structure as proposed in "Guibas and Stolfi 198...
Definition: itkQuadEdge.h:137
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....