IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
Mesh3dVertexEdgeConstCirculator.h
1 // Mesh3dVertexEdgeConstCirculator.h:
3 // ----------------------------------
4 //
15 
16 #ifndef __IPSDKGEOMETRY_MESH3DVERTEXEDGECONSTCIRCULATOR_H__
17 #define __IPSDKGEOMETRY_MESH3DVERTEXEDGECONSTCIRCULATOR_H__
18 
19 // suppression warnings
20 //
21 #pragma warning (push)
22 //#pragma warning (disable : 4251)
23 
28 
29 namespace ipsdk {
30 namespace geom {
31 
34 
35 template <typename MeshType>
37 {
38 // predefined public types
39 public:
41  typedef typename MeshType::DataType T;
42 
44  typedef typename MeshType::VertexType VertexType;
45 
48 
50  typedef std::input_iterator_tag iterator_category;
51 
54 
55  // difference type for iterator
56  typedef ipUInt32 difference_type;
57 
59  typedef const Mesh3dHalfEdge* pointer;
60 
61  // reference type associated to iterator
62  typedef const Mesh3dHalfEdge& reference;
63 
64 public:
68  _pMesh(0),
71 
72  {
73  }
74  Mesh3dVertexEdgeConstCirculator(const MeshType* pMesh,
75  const ipUInt32 startVertexIdx) :
76  _pMesh(pMesh),
77  _startHalfEdgeIdx(_pMesh->getVertexToHalfEdgeColl()[startVertexIdx]),
79  {
80 
81  }
82  Mesh3dVertexEdgeConstCirculator(const Iterator& iter) :
83  _pMesh(iter._pMesh),
86  {
87  }
88  Mesh3dVertexEdgeConstCirculator& operator= (const Iterator& iter)
89  {
90  _pMesh = iter._pMesh;
91  _startHalfEdgeIdx = iter._startHalfEdgeIdx;
92  _curHalfEdgeIdx = iter._curHalfEdgeIdx;
93  }
94  ~Mesh3dVertexEdgeConstCirculator()
95  {
96  }
98 
99 // methods
100 public:
102  const ipUInt32 getStartHalfEdgeIdx() const;
103 
105  const ipUInt32 getCurHalfEdgeIdx() const;
106 
108  const VertexType& getStartVertex() const;
109 
111  inline Iterator& operator++();
112 
115  inline bool operator==(const Iterator& iter) const;
116  inline bool operator!=(const Iterator& iter) const;
118 
120  inline const Mesh3dHalfEdge* operator->() const;
121 
123  inline const Mesh3dHalfEdge& operator*() const;
124 
126  void swap(Iterator& iter);
127 
128 // attributes
129 protected:
131  const MeshType* _pMesh;
132 
135 
139 };
140 
143 
144 template <typename MeshType>
145 IPSDK_FORCEINLINE const ipUInt32
147 {
148  return _startHalfEdgeIdx;
149 }
150 
151 template <typename MeshType>
152 IPSDK_FORCEINLINE const ipUInt32
154 {
155  return _curHalfEdgeIdx;
156 }
157 
158 template <typename MeshType>
159 IPSDK_FORCEINLINE const typename Mesh3dVertexEdgeConstCirculator<MeshType>::VertexType&
161 {
162  const Mesh3dHalfEdge& startHalfEdge = _pMesh->getHalfEdgeColl()[_startHalfEdgeIdx];
163  const VertexType& startVertex = _pMesh->getVertexColl()[startHalfEdge._startVertexIdx];
164 
165  return startVertex;
166 }
167 
168 template <typename MeshType>
169 IPSDK_FORCEINLINE typename Mesh3dVertexEdgeConstCirculator<MeshType>::Iterator&
171 {
172  // search for next half edge
173  const Mesh3dHalfEdge& curHalfEdge = _pMesh->getHalfEdgeColl()[_curHalfEdgeIdx];
174  const Mesh3dHalfEdge& oppositeHalfEdge = _pMesh->getHalfEdgeColl()[curHalfEdge._oppositeHalfEdgeIdx];
175  _curHalfEdgeIdx = oppositeHalfEdge._nextHalfEdgeIdx;
176  if (_curHalfEdgeIdx == _startHalfEdgeIdx)
177  _curHalfEdgeIdx = NumericLimits<ipUInt32>::max();
178 
179  return *this;
180 }
181 
182 template <typename MeshType>
183 IPSDK_FORCEINLINE bool
185 {
186  return _curHalfEdgeIdx == iter._curHalfEdgeIdx;
187 }
188 
189 template <typename MeshType>
190 IPSDK_FORCEINLINE bool
192 {
193  return _curHalfEdgeIdx != iter._curHalfEdgeIdx;
194 }
195 
196 template <typename MeshType>
197 IPSDK_FORCEINLINE const Mesh3dHalfEdge*
199 {
200  const Mesh3dHalfEdge& curHalfEdge = _pMesh->getHalfEdgeColl()[_curHalfEdgeIdx];
201 
202  return &curHalfEdge;
203 }
204 
205 template <typename MeshType>
206 IPSDK_FORCEINLINE const Mesh3dHalfEdge&
208 {
209  const Mesh3dHalfEdge& curHalfEdge = _pMesh->getHalfEdgeColl()[_curHalfEdgeIdx];
210 
211  return curHalfEdge;
212 }
213 
214 template <typename MeshType>
215 inline void
217 {
218  std::swap(_pMesh, iter._pMesh);
219  std::swap(_startHalfEdgeIdx, iter._startHalfEdgeIdx);
220  std::swap(_curHalfEdgeIdx, iter._curHalfEdgeIdx);
221 }
222 
225 
226 } // end of namespace geom
227 } // end of namespace ipsdk
228 
229 #pragma warning (pop)
230 
231 #endif // __IPSDKGEOMETRY_MESH3DVERTEXEDGECONSTCIRCULATOR_H__
const Mesh3dHalfEdge * pointer
pointer type for iterator
Definition: Mesh3dVertexEdgeConstCirculator.h:59
ipUInt32 _curHalfEdgeIdx
Definition: Mesh3dVertexEdgeConstCirculator.h:138
Defines the IPSDK_FORCEINLINE.
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
const VertexType & getStartVertex() const
retrieve starting vertex associated to circulator
Definition: Mesh3dVertexEdgeConstCirculator.h:160
Mesh3dHalfEdge value_type
value type associated to iterator
Definition: Mesh3dVertexEdgeConstCirculator.h:53
Iterator class allowing to circulate over half edges starting from a given vertex.
Definition: Mesh3dVertexEdgeConstCirculator.h:36
const MeshType * _pMesh
reference to mesh 3d associated to iterator
Definition: Mesh3dVertexEdgeConstCirculator.h:131
bool operator==(const Iterator &iter) const
iterator comparison
Definition: Mesh3dVertexEdgeConstCirculator.h:184
Definition: Mesh3dTypes.h:52
Definition: NumericLimits.h:27
bool operator!=(const Iterator &iter) const
iterator comparison
Definition: Mesh3dVertexEdgeConstCirculator.h:191
const Mesh3dHalfEdge * operator->() const
retrieve current triangle associated to iterator position
Definition: Mesh3dVertexEdgeConstCirculator.h:198
Mesh3dVertexEdgeConstCirculator< MeshType > Iterator
iterator type
Definition: Mesh3dVertexEdgeConstCirculator.h:47
IPSDK_FORCEINLINE PackT max(const PackT &in1, const PackT &in2)
returns the maximum of 2 packs
Definition: max.h:40
Predefined types for mesh 3d management.
Definition of import/export macro for library.
Iterator & operator++()
increment of iterator
Definition: Mesh3dVertexEdgeConstCirculator.h:170
const ipUInt32 getCurHalfEdgeIdx() const
retrieve current half edge index associated to circulator
Definition: Mesh3dVertexEdgeConstCirculator.h:153
std::input_iterator_tag iterator_category
iterator category
Definition: Mesh3dVertexEdgeConstCirculator.h:50
ipUInt64 _oppositeHalfEdgeIdx
Definition: Mesh3dTypes.h:62
void swap(Iterator &iter)
swap between iterators
Definition: Mesh3dVertexEdgeConstCirculator.h:216
Vector DataType
data type used for estimation
Definition: EstimationTypes.h:58
MeshType::VertexType VertexType
underlying mesh 3d vertex type
Definition: Mesh3dVertexEdgeConstCirculator.h:44
ipUInt64 _startVertexIdx
index of start vertex for half edge
Definition: Mesh3dTypes.h:55
MeshType::DataType T
underlying mesh 3d data type
Definition: Mesh3dVertexEdgeConstCirculator.h:41
const Mesh3dHalfEdge & operator*() const
retrieve current triangle associated to iterator position
Definition: Mesh3dVertexEdgeConstCirculator.h:207
ipUInt32 _startHalfEdgeIdx
starting half edge index
Definition: Mesh3dVertexEdgeConstCirculator.h:134
const ipUInt32 getStartHalfEdgeIdx() const
retrieve starting half edge index associated to circulator
Definition: Mesh3dVertexEdgeConstCirculator.h:146
ipUInt64 _nextHalfEdgeIdx
index of next half edge inside left triangle
Definition: Mesh3dTypes.h:65
uint32_t ipUInt32
Base types definition.
Definition: BaseTypes.h:53