Création d'un compte pour un collaborateur extérieur au laboratoire depuis l'intranet ICube : https://intranet.icube.unistra.fr/fr/labs/member/profile

traversor2.h 7.23 KB
Newer Older
Pierre Kraemer's avatar
Pierre Kraemer committed
1
2
3
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps  *
* version 0.1                                                                  *
4
* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg           *
Pierre Kraemer's avatar
Pierre Kraemer committed
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
*                                                                              *
* This library is free software; you can redistribute it and/or modify it      *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your     *
* option) any later version.                                                   *
*                                                                              *
* This library is distributed in the hope that it will be useful, but WITHOUT  *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or        *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License  *
* for more details.                                                            *
*                                                                              *
* You should have received a copy of the GNU Lesser General Public License     *
* along with this library; if not, write to the Free Software Foundation,      *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.           *
*                                                                              *
20
* Web site: http://cgogn.unistra.fr/                                           *
Pierre Kraemer's avatar
Pierre Kraemer committed
21
22
23
24
25
26
27
28
* Contact information: cgogn@unistra.fr                                        *
*                                                                              *
*******************************************************************************/

#ifndef __TRAVERSOR2_H__
#define __TRAVERSOR2_H__

#include "Topology/generic/dart.h"
Sylvain Thery's avatar
Sylvain Thery committed
29
//#include "Topology/generic/traversorGen.h"
Pierre Kraemer's avatar
Pierre Kraemer committed
30
31
32

namespace CGoGN
{
33

Pierre Kraemer's avatar
Pierre Kraemer committed
34
35
36
37
/*******************************************************************************
					VERTEX CENTERED TRAVERSALS
*******************************************************************************/

Pierre Kraemer's avatar
Pierre Kraemer committed
38
39
// Traverse the edges incident to a given vertex
template <typename MAP>
Sylvain Thery's avatar
Sylvain Thery committed
40
class Traversor2VE//: public Traversor<MAP>
Pierre Kraemer's avatar
Pierre Kraemer committed
41
42
{
private:
Sylvain Thery's avatar
Sylvain Thery committed
43
	const MAP& m ;
Pierre Kraemer's avatar
Pierre Kraemer committed
44
45
	Dart start ;
	Dart current ;
Sylvain Thery's avatar
Sylvain Thery committed
46
47
	const std::vector<Dart>* m_QLT;
	std::vector<Dart>::const_iterator m_ItDarts;
Pierre Kraemer's avatar
Pierre Kraemer committed
48
public:
Sylvain Thery's avatar
Sylvain Thery committed
49
	Traversor2VE(const MAP& map, Dart dart) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
50

51
52
53
	inline Dart begin() ;
	inline Dart end() ;
	inline Dart next() ;
Pierre Kraemer's avatar
Pierre Kraemer committed
54
55
56
57
} ;

// Traverse the faces incident to a given vertex
template <typename MAP>
Sylvain Thery's avatar
Sylvain Thery committed
58
class Traversor2VF //: public Traversor<MAP>
Pierre Kraemer's avatar
Pierre Kraemer committed
59
60
{
private:
Sylvain Thery's avatar
Sylvain Thery committed
61
	const MAP& m ;
Pierre Kraemer's avatar
Pierre Kraemer committed
62
63
	Dart start ;
	Dart current ;
Sylvain Thery's avatar
Sylvain Thery committed
64
65
	const std::vector<Dart>* m_QLT;
	std::vector<Dart>::const_iterator m_ItDarts;
Pierre Kraemer's avatar
Pierre Kraemer committed
66
public:
Sylvain Thery's avatar
Sylvain Thery committed
67
	Traversor2VF(const MAP& map, Dart dart) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
68

69
70
71
	inline Dart begin() ;
	inline Dart end() ;
	inline Dart next() ;
Pierre Kraemer's avatar
Pierre Kraemer committed
72
73
74
75
} ;

// Traverse the vertices adjacent to a given vertex through sharing a common edge
template <typename MAP>
Sylvain Thery's avatar
Sylvain Thery committed
76
class Traversor2VVaE //: public Traversor<MAP>
Pierre Kraemer's avatar
Pierre Kraemer committed
77
78
{
private:
Sylvain Thery's avatar
Sylvain Thery committed
79
	const MAP& m ;
Pierre Kraemer's avatar
Pierre Kraemer committed
80
81
	Dart start ;
	Dart current ;
Sylvain Thery's avatar
Sylvain Thery committed
82
83
	const std::vector<Dart>* m_QLT;
	std::vector<Dart>::const_iterator m_ItDarts;
Pierre Kraemer's avatar
Pierre Kraemer committed
84
public:
Sylvain Thery's avatar
Sylvain Thery committed
85
	Traversor2VVaE(const MAP& map, Dart dart) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
86

87
88
89
	inline Dart begin() ;
	inline Dart end() ;
	inline Dart next() ;
Pierre Kraemer's avatar
Pierre Kraemer committed
90
91
92
93
} ;

// Traverse the vertices adjacent to a given vertex through sharing a common face
template <typename MAP>
Sylvain Thery's avatar
Sylvain Thery committed
94
class Traversor2VVaF //: public Traversor<MAP>
Pierre Kraemer's avatar
Pierre Kraemer committed
95
96
{
private:
Sylvain Thery's avatar
Sylvain Thery committed
97
	const MAP& m ;
Pierre Kraemer's avatar
Pierre Kraemer committed
98
99
100
101
	Dart start ;
	Dart current ;

	Dart stop ;
Sylvain Thery's avatar
Sylvain Thery committed
102
103
	const std::vector<Dart>* m_QLT;
	std::vector<Dart>::const_iterator m_ItDarts;
Pierre Kraemer's avatar
Pierre Kraemer committed
104
public:
Sylvain Thery's avatar
Sylvain Thery committed
105
	Traversor2VVaF(const MAP& map, Dart dart) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
106

107
108
109
	inline Dart begin() ;
	inline Dart end() ;
	inline Dart next() ;
Pierre Kraemer's avatar
Pierre Kraemer committed
110
111
112
113
114
115
116
117
} ;

/*******************************************************************************
					EDGE CENTERED TRAVERSALS
*******************************************************************************/

// Traverse the vertices incident to a given edge
template <typename MAP>
Sylvain Thery's avatar
Sylvain Thery committed
118
class Traversor2EV //: public Traversor<MAP>
Pierre Kraemer's avatar
Pierre Kraemer committed
119
120
{
private:
Sylvain Thery's avatar
Sylvain Thery committed
121
	const MAP& m ;
Pierre Kraemer's avatar
Pierre Kraemer committed
122
123
	Dart start ;
	Dart current ;
Sylvain Thery's avatar
Sylvain Thery committed
124
125
	const std::vector<Dart>* m_QLT;
	std::vector<Dart>::const_iterator m_ItDarts;
Pierre Kraemer's avatar
Pierre Kraemer committed
126
public:
Sylvain Thery's avatar
Sylvain Thery committed
127
	Traversor2EV(const MAP& map, Dart dart) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
128

129
130
131
	inline Dart begin() ;
	inline Dart end() ;
	inline Dart next() ;
Pierre Kraemer's avatar
Pierre Kraemer committed
132
133
134
135
} ;

// Traverse the faces incident to a given edge
template <typename MAP>
Sylvain Thery's avatar
Sylvain Thery committed
136
class Traversor2EF //: public Traversor<MAP>
Pierre Kraemer's avatar
Pierre Kraemer committed
137
138
{
private:
Sylvain Thery's avatar
Sylvain Thery committed
139
	const MAP& m ;
Pierre Kraemer's avatar
Pierre Kraemer committed
140
141
	Dart start ;
	Dart current ;
Sylvain Thery's avatar
Sylvain Thery committed
142
143
	const std::vector<Dart>* m_QLT;
	std::vector<Dart>::const_iterator m_ItDarts;
Pierre Kraemer's avatar
Pierre Kraemer committed
144
public:
Sylvain Thery's avatar
Sylvain Thery committed
145
	Traversor2EF(const MAP& map, Dart dart) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
146

147
148
149
	inline Dart begin() ;
	inline Dart end() ;
	inline Dart next() ;
Pierre Kraemer's avatar
Pierre Kraemer committed
150
151
152
153
} ;

// Traverse the edges adjacent to a given edge through sharing a common vertex
template <typename MAP>
Sylvain Thery's avatar
Sylvain Thery committed
154
class Traversor2EEaV //: public Traversor<MAP>
Pierre Kraemer's avatar
Pierre Kraemer committed
155
156
{
private:
Sylvain Thery's avatar
Sylvain Thery committed
157
	const MAP& m ;
Pierre Kraemer's avatar
Pierre Kraemer committed
158
159
160
161
	Dart start ;
	Dart current ;

	Dart stop1, stop2 ;
Sylvain Thery's avatar
Sylvain Thery committed
162
163
	const std::vector<Dart>* m_QLT;
	std::vector<Dart>::const_iterator m_ItDarts;
Pierre Kraemer's avatar
Pierre Kraemer committed
164
public:
Sylvain Thery's avatar
Sylvain Thery committed
165
	Traversor2EEaV(const MAP& map, Dart dart) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
166

167
168
169
	inline Dart begin() ;
	inline Dart end() ;
	inline Dart next() ;
Pierre Kraemer's avatar
Pierre Kraemer committed
170
171
172
173
} ;

// Traverse the edges adjacent to a given edge through sharing a common face
template <typename MAP>
Sylvain Thery's avatar
Sylvain Thery committed
174
class Traversor2EEaF //: public Traversor<MAP>
Pierre Kraemer's avatar
Pierre Kraemer committed
175
176
{
private:
Sylvain Thery's avatar
Sylvain Thery committed
177
	const MAP& m ;
Pierre Kraemer's avatar
Pierre Kraemer committed
178
179
180
181
	Dart start ;
	Dart current ;

	Dart stop1, stop2 ;
Sylvain Thery's avatar
Sylvain Thery committed
182
183
	const std::vector<Dart>* m_QLT;
	std::vector<Dart>::const_iterator m_ItDarts;
Pierre Kraemer's avatar
Pierre Kraemer committed
184
public:
Sylvain Thery's avatar
Sylvain Thery committed
185
	Traversor2EEaF(const MAP& map, Dart dart) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
186

187
188
189
	inline Dart begin() ;
	inline Dart end() ;
	inline Dart next() ;
Pierre Kraemer's avatar
Pierre Kraemer committed
190
191
192
193
194
195
196
197
} ;

/*******************************************************************************
					FACE CENTERED TRAVERSALS
*******************************************************************************/

// Traverse the vertices incident to a given face
template <typename MAP>
Sylvain Thery's avatar
Sylvain Thery committed
198
class Traversor2FV //: public Traversor<MAP>
Pierre Kraemer's avatar
Pierre Kraemer committed
199
200
{
private:
Sylvain Thery's avatar
Sylvain Thery committed
201
	const MAP& m ;
Pierre Kraemer's avatar
Pierre Kraemer committed
202
203
	Dart start ;
	Dart current ;
Sylvain Thery's avatar
Sylvain Thery committed
204
205
	const std::vector<Dart>* m_QLT;
	std::vector<Dart>::const_iterator m_ItDarts;
Pierre Kraemer's avatar
Pierre Kraemer committed
206
public:
Sylvain Thery's avatar
Sylvain Thery committed
207
	Traversor2FV(const MAP& map, Dart dart) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
208

209
210
211
	inline Dart begin() ;
	inline Dart end() ;
	inline Dart next() ;
Pierre Kraemer's avatar
Pierre Kraemer committed
212
213
} ;

214
215

// Traverse the edges incident to a given face (equivalent to vertices)
Pierre Kraemer's avatar
Pierre Kraemer committed
216
template <typename MAP>
Sylvain Thery's avatar
Sylvain Thery committed
217
class Traversor2FE: public Traversor2FV<MAP>
Pierre Kraemer's avatar
Pierre Kraemer committed
218
219
{
public:
Sylvain Thery's avatar
Sylvain Thery committed
220
	Traversor2FE(const MAP& map, Dart dart):Traversor2FV<MAP>(map,dart){}
Pierre Kraemer's avatar
Pierre Kraemer committed
221
222
223
224
} ;

// Traverse the faces adjacent to a given face through sharing a common vertex
template <typename MAP>
Sylvain Thery's avatar
Sylvain Thery committed
225
class Traversor2FFaV //: public Traversor<MAP>
Pierre Kraemer's avatar
Pierre Kraemer committed
226
227
{
private:
Sylvain Thery's avatar
Sylvain Thery committed
228
	const MAP& m ;
Pierre Kraemer's avatar
Pierre Kraemer committed
229
230
231
232
	Dart start ;
	Dart current ;

	Dart stop ;
Sylvain Thery's avatar
Sylvain Thery committed
233
234
	const std::vector<Dart>* m_QLT;
	std::vector<Dart>::const_iterator m_ItDarts;
Pierre Kraemer's avatar
Pierre Kraemer committed
235
public:
Sylvain Thery's avatar
Sylvain Thery committed
236
	Traversor2FFaV(const MAP& map, Dart dart) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
237

238
239
240
	inline Dart begin() ;
	inline Dart end() ;
	inline Dart next() ;
Pierre Kraemer's avatar
Pierre Kraemer committed
241
242
} ;

Pierre Kraemer's avatar
Pierre Kraemer committed
243
// Traverse the faces adjacent to a given face through sharing a common edge
thery's avatar
thery committed
244
// Warning mult-incidence is not managed (some faces can be send several times)
Pierre Kraemer's avatar
Pierre Kraemer committed
245
template <typename MAP>
Sylvain Thery's avatar
Sylvain Thery committed
246
class Traversor2FFaE //: public Traversor<MAP>
Pierre Kraemer's avatar
Pierre Kraemer committed
247
248
{
private:
Sylvain Thery's avatar
Sylvain Thery committed
249
	const MAP& m ;
Pierre Kraemer's avatar
Pierre Kraemer committed
250
251
	Dart start ;
	Dart current ;
Sylvain Thery's avatar
Sylvain Thery committed
252
253
	const std::vector<Dart>* m_QLT;
	std::vector<Dart>::const_iterator m_ItDarts;
Pierre Kraemer's avatar
Pierre Kraemer committed
254
public:
Sylvain Thery's avatar
Sylvain Thery committed
255
	Traversor2FFaE(const MAP& map, Dart dart) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
256

257
258
259
	inline Dart begin() ;
	inline Dart end() ;
	inline Dart next() ;
Pierre Kraemer's avatar
Pierre Kraemer committed
260
261
} ;

Pierre Kraemer's avatar
Pierre Kraemer committed
262
263
} // namespace CGoGN

Pierre Kraemer's avatar
Pierre Kraemer committed
264
265
#include "Topology/generic/traversor2.hpp"

Pierre Kraemer's avatar
Pierre Kraemer committed
266
#endif