traversor2.hpp 15 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
29
30
31
32
33
34
* Contact information: cgogn@unistra.fr                                        *
*                                                                              *
*******************************************************************************/

namespace CGoGN
{

/*******************************************************************************
					VERTEX CENTERED TRAVERSALS
*******************************************************************************/

// Traversor2VE

template <typename MAP>
Sylvain Thery's avatar
Sylvain Thery committed
35
36
37
38
39
40
41
42
Traversor2VE<MAP>::Traversor2VE(MAP& map, Dart dart) : m(map), start(dart),m_QLT(NULL)
{
	AttributeMultiVector<NoTypeNameAttribute<std::vector<Dart> > >* quickTraversal = map.template getQuickLocalIncidentTraversal<VERTEX,EDGE>() ;
	if (quickTraversal != NULL)
	{
		m_QLT  = &(quickTraversal->operator[](map.template getEmbedding<VERTEX>(dart)));
	}
}
Pierre Kraemer's avatar
Pierre Kraemer committed
43
44
45
46

template <typename MAP>
Dart Traversor2VE<MAP>::begin()
{
Sylvain Thery's avatar
Sylvain Thery committed
47
48
49
50
51
52
	if(m_QLT != NULL)
	{
		m_ItDarts = m_QLT->begin();
		return *m_ItDarts++;
	}

Pierre Kraemer's avatar
Pierre Kraemer committed
53
54
55
56
57
58
59
60
61
62
63
64
65
	current = start ;
	return current ;
}

template <typename MAP>
Dart Traversor2VE<MAP>::end()
{
	return NIL ;
}

template <typename MAP>
Dart Traversor2VE<MAP>::next()
{
Sylvain Thery's avatar
Sylvain Thery committed
66
67
68
69
70
	if(m_QLT != NULL)
	{
		return *m_ItDarts++;
	}

Pierre Kraemer's avatar
Pierre Kraemer committed
71
72
	if(current != NIL)
	{
Sylvain Thery's avatar
Sylvain Thery committed
73
74
//		current = m.alpha1(current) ;
		current = m.phi2(m.phi_1(current)) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
75
76
77
78
79
80
81
82
83
		if(current == start)
			current = NIL ;
	}
	return current ;
}

// Traversor2VF

template <typename MAP>
Sylvain Thery's avatar
Sylvain Thery committed
84
Traversor2VF<MAP>::Traversor2VF(MAP& map, Dart dart) : m(map), start(dart),m_QLT(NULL)
Pierre Kraemer's avatar
Pierre Kraemer committed
85
{
Sylvain Thery's avatar
Sylvain Thery committed
86
87
88
89
90
91
92
93
94
95
	AttributeMultiVector<NoTypeNameAttribute<std::vector<Dart> > >* quickTraversal = map.template getQuickLocalIncidentTraversal<VERTEX,FACE>() ;
	if (quickTraversal != NULL)
	{
		m_QLT  = &(quickTraversal->operator[](map.template getEmbedding<VERTEX>(dart)));
	}
	else
	{
		if(m.isBoundaryMarked2(start)) // jump over a boundary face
			start = m.phi2(m.phi_1(start)) ;
	}
Pierre Kraemer's avatar
Pierre Kraemer committed
96
97
98
99
100
}

template <typename MAP>
Dart Traversor2VF<MAP>::begin()
{
Sylvain Thery's avatar
Sylvain Thery committed
101
102
103
104
105
106
	if(m_QLT != NULL)
	{
		m_ItDarts = m_QLT->begin();
		return *m_ItDarts++;
	}

Pierre Kraemer's avatar
Pierre Kraemer committed
107
108
109
110
111
112
113
114
115
116
117
118
119
	current = start ;
	return current ;
}

template <typename MAP>
Dart Traversor2VF<MAP>::end()
{
	return NIL ;
}

template <typename MAP>
Dart Traversor2VF<MAP>::next()
{
Sylvain Thery's avatar
Sylvain Thery committed
120
121
122
123
	if(m_QLT != NULL)
	{
		return *m_ItDarts++;
	}
Pierre Kraemer's avatar
Pierre Kraemer committed
124
125
	if(current != NIL)
	{
Sylvain Thery's avatar
Sylvain Thery committed
126
		current = m.phi2(m.phi_1(current)) ;
Thery Sylvain's avatar
Thery Sylvain committed
127
		if(m.isBoundaryMarked2(current)) // jump over a boundary face
Sylvain Thery's avatar
Sylvain Thery committed
128
			current = m.phi2(m.phi_1(current)) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
129
130
131
132
133
134
135
136
137
		if(current == start)
			current = NIL ;
	}
	return current ;
}

// Traversor2VVaE

template <typename MAP>
Sylvain Thery's avatar
Sylvain Thery committed
138
Traversor2VVaE<MAP>::Traversor2VVaE(MAP& map, Dart dart) : m(map),m_QLT(NULL)
Pierre Kraemer's avatar
Pierre Kraemer committed
139
{
Sylvain Thery's avatar
Sylvain Thery committed
140
141
142
143
144
145
146
147
148
	AttributeMultiVector<NoTypeNameAttribute<std::vector<Dart> > >* quickTraversal = map.template getQuickLocalAdjacentTraversal<VERTEX,EDGE>() ;
	if (quickTraversal != NULL)
	{
		m_QLT  = &(quickTraversal->operator[](map.template getEmbedding<VERTEX>(dart)));
	}
	else
	{
		start = m.phi2(dart) ;
	}
Pierre Kraemer's avatar
Pierre Kraemer committed
149
150
151
152
153
}

template <typename MAP>
Dart Traversor2VVaE<MAP>::begin()
{
Sylvain Thery's avatar
Sylvain Thery committed
154
155
156
157
158
159
	if(m_QLT != NULL)
	{
		m_ItDarts = m_QLT->begin();
		return *m_ItDarts++;
	}

Pierre Kraemer's avatar
Pierre Kraemer committed
160
161
162
163
164
165
166
167
168
169
170
171
172
	current = start ;
	return current ;
}

template <typename MAP>
Dart Traversor2VVaE<MAP>::end()
{
	return NIL ;
}

template <typename MAP>
Dart Traversor2VVaE<MAP>::next()
{
Sylvain Thery's avatar
Sylvain Thery committed
173
174
175
176
	if(m_QLT != NULL)
	{
		return *m_ItDarts++;
	}
Pierre Kraemer's avatar
Pierre Kraemer committed
177
178
179
180
181
182
183
184
185
186
187
188
	if(current != NIL)
	{
		current = m.phi_1(m.phi2(current)) ;
		if(current == start)
			current = NIL ;
	}
	return current ;
}

// Traversor2VVaF

template <typename MAP>
Sylvain Thery's avatar
Sylvain Thery committed
189
Traversor2VVaF<MAP>::Traversor2VVaF(MAP& map, Dart dart) : m(map),m_QLT(NULL)
Pierre Kraemer's avatar
Pierre Kraemer committed
190
{
Sylvain Thery's avatar
Sylvain Thery committed
191
192
193
194
195
196
197
198
199
200
201
202
203
204
	AttributeMultiVector<NoTypeNameAttribute<std::vector<Dart> > >* quickTraversal = map.template getQuickLocalAdjacentTraversal<VERTEX,FACE>() ;
	if (quickTraversal != NULL)
	{
		m_QLT  = &(quickTraversal->operator[](map.template getEmbedding<VERTEX>(dart)));
	}
	else
	{
		if(m.isBoundaryMarked2(dart))
			dart = m.phi2(m.phi_1(dart)) ;
		start = m.phi1(m.phi1(dart)) ;
		if(start == dart)
			start = m.phi1(dart) ;
		stop = dart ;
	}
Pierre Kraemer's avatar
Pierre Kraemer committed
205
206
207
208
209
}

template <typename MAP>
Dart Traversor2VVaF<MAP>::begin()
{
Sylvain Thery's avatar
Sylvain Thery committed
210
211
212
213
214
215
	if(m_QLT != NULL)
	{
		m_ItDarts = m_QLT->begin();
		return *m_ItDarts++;
	}

Pierre Kraemer's avatar
Pierre Kraemer committed
216
217
218
219
220
221
222
223
224
225
226
227
228
	current = start ;
	return current ;
}

template <typename MAP>
Dart Traversor2VVaF<MAP>::end()
{
	return NIL ;
}

template <typename MAP>
Dart Traversor2VVaF<MAP>::next()
{
Sylvain Thery's avatar
Sylvain Thery committed
229
230
231
232
	if(m_QLT != NULL)
	{
		return *m_ItDarts++;
	}
Pierre Kraemer's avatar
Pierre Kraemer committed
233
234
235
236
237
	if(current != NIL)
	{
		current = m.phi1(current) ;
		if(current == stop)
		{
Sylvain Thery's avatar
Sylvain Thery committed
238
			Dart d = m.phi2(m.phi_1(current)) ;
Thery Sylvain's avatar
Thery Sylvain committed
239
			if(m.isBoundaryMarked2(d)) // jump over a boundary face
240
			{
Sylvain Thery's avatar
Sylvain Thery committed
241
				d = m.phi2(m.phi_1(d)) ;
242
243
244
245
				current = m.phi1(d);
			}
			else
				current = m.phi1(m.phi1(d)) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
			if(current == d)
				current = m.phi1(d) ;
			stop = d ;
		}
		if(current == start)
			current = NIL ;
	}
	return current ;
}

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

// Traversor2EV

template <typename MAP>
Sylvain Thery's avatar
Sylvain Thery committed
263
264
265
266
267
268
269
Traversor2EV<MAP>::Traversor2EV(MAP& map, Dart dart) : m(map), start(dart),m_QLT(NULL)
{	AttributeMultiVector<NoTypeNameAttribute<std::vector<Dart> > >* quickTraversal = map.template getQuickLocalIncidentTraversal<EDGE,VERTEX>() ;
	if (quickTraversal != NULL)
	{
		m_QLT  = &(quickTraversal->operator[](map.template getEmbedding<EDGE>(dart)));
	}
}
Pierre Kraemer's avatar
Pierre Kraemer committed
270
271
272
273

template <typename MAP>
Dart Traversor2EV<MAP>::begin()
{
Sylvain Thery's avatar
Sylvain Thery committed
274
275
276
277
278
279
	if(m_QLT != NULL)
	{
		m_ItDarts = m_QLT->begin();
		return *m_ItDarts++;
	}

Pierre Kraemer's avatar
Pierre Kraemer committed
280
281
282
283
284
285
286
287
288
289
290
291
292
	current = start ;
	return current ;
}

template <typename MAP>
Dart Traversor2EV<MAP>::end()
{
	return NIL ;
}

template <typename MAP>
Dart Traversor2EV<MAP>::next()
{
Sylvain Thery's avatar
Sylvain Thery committed
293
294
295
296
	if(m_QLT != NULL)
	{
		return *m_ItDarts++;
	}
Pierre Kraemer's avatar
Pierre Kraemer committed
297
298
299
300
301
302
303
304
305
306
307
308
	if(current != NIL)
	{
		current = m.phi2(current) ;
		if(current == start)
			current = NIL ;
	}
	return current ;
}

// Traversor2EF

template <typename MAP>
Sylvain Thery's avatar
Sylvain Thery committed
309
Traversor2EF<MAP>::Traversor2EF(MAP& map, Dart dart) : m(map), start(dart),m_QLT(NULL)
Pierre Kraemer's avatar
Pierre Kraemer committed
310
{
Sylvain Thery's avatar
Sylvain Thery committed
311
312
313
314
315
316
317
318
319
320
	AttributeMultiVector<NoTypeNameAttribute<std::vector<Dart> > >* quickTraversal = map.template getQuickLocalIncidentTraversal<EDGE,FACE>() ;
	if (quickTraversal != NULL)
	{
		m_QLT  = &(quickTraversal->operator[](map.template getEmbedding<EDGE>(dart)));
	}
	else
	{
		if(m.isBoundaryMarked2(start))
			start = m.phi2(current) ;
	}
Pierre Kraemer's avatar
Pierre Kraemer committed
321
322
323
324
325
}

template <typename MAP>
Dart Traversor2EF<MAP>::begin()
{
Sylvain Thery's avatar
Sylvain Thery committed
326
327
328
329
330
331
	if(m_QLT != NULL)
	{
		m_ItDarts = m_QLT->begin();
		return *m_ItDarts++;
	}

Pierre Kraemer's avatar
Pierre Kraemer committed
332
333
334
335
336
337
338
339
340
341
342
343
344
	current = start ;
	return current ;
}

template <typename MAP>
Dart Traversor2EF<MAP>::end()
{
	return NIL ;
}

template <typename MAP>
Dart Traversor2EF<MAP>::next()
{
Sylvain Thery's avatar
Sylvain Thery committed
345
346
347
348
	if(m_QLT != NULL)
	{
		return *m_ItDarts++;
	}
Pierre Kraemer's avatar
Pierre Kraemer committed
349
350
351
	if(current != NIL)
	{
		current = m.phi2(current) ;
Thery Sylvain's avatar
Thery Sylvain committed
352
		if(current == start || m.isBoundaryMarked2(current)) // do not consider a boundary face
Pierre Kraemer's avatar
Pierre Kraemer committed
353
354
355
356
357
358
359
360
			current = NIL ;
	}
	return current ;
}

// Traversor2EEaV

template <typename MAP>
Sylvain Thery's avatar
Sylvain Thery committed
361
Traversor2EEaV<MAP>::Traversor2EEaV(MAP& map, Dart dart) : m(map),m_QLT(NULL)
Pierre Kraemer's avatar
Pierre Kraemer committed
362
{
Sylvain Thery's avatar
Sylvain Thery committed
363
364
365
366
367
368
369
370
371
372
373
	AttributeMultiVector<NoTypeNameAttribute<std::vector<Dart> > >* quickTraversal = map.template getQuickLocalAdjacentTraversal<EDGE,VERTEX>() ;
	if (quickTraversal != NULL)
	{
		m_QLT  = &(quickTraversal->operator[](map.template getEmbedding<EDGE>(dart)));
	}
	else
	{
		start = m.phi2(m.phi_1(dart)) ;
		stop1 = dart ;
		stop2 = m.phi2(dart) ;
	}
Pierre Kraemer's avatar
Pierre Kraemer committed
374
375
376
377
378
}

template <typename MAP>
Dart Traversor2EEaV<MAP>::begin()
{
Sylvain Thery's avatar
Sylvain Thery committed
379
380
381
382
383
384
	if(m_QLT != NULL)
	{
		m_ItDarts = m_QLT->begin();
		return *m_ItDarts++;
	}

Pierre Kraemer's avatar
Pierre Kraemer committed
385
386
387
388
389
390
391
392
393
394
395
396
397
	current = start ;
	return current ;
}

template <typename MAP>
Dart Traversor2EEaV<MAP>::end()
{
	return NIL ;
}

template <typename MAP>
Dart Traversor2EEaV<MAP>::next()
{
Sylvain Thery's avatar
Sylvain Thery committed
398
399
400
401
	if(m_QLT != NULL)
	{
		return *m_ItDarts++;
	}
Pierre Kraemer's avatar
Pierre Kraemer committed
402
403
	if(current != NIL)
	{
Sylvain Thery's avatar
Sylvain Thery committed
404
		current = m.phi2(m.phi_1(current)) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
405
		if(current == stop1)
Sylvain Thery's avatar
Sylvain Thery committed
406
			current = m.phi2(m.phi_1(stop2)) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
407
408
409
410
411
412
413
414
415
		else if(current == stop2)
			current = NIL ;
	}
	return current ;
}

// Traversor2EEaF

template <typename MAP>
Sylvain Thery's avatar
Sylvain Thery committed
416
Traversor2EEaF<MAP>::Traversor2EEaF(MAP& map, Dart dart) : m(map),m_QLT(NULL)
Pierre Kraemer's avatar
Pierre Kraemer committed
417
{
Sylvain Thery's avatar
Sylvain Thery committed
418
419
420
421
422
423
424
425
426
427
428
	AttributeMultiVector<NoTypeNameAttribute<std::vector<Dart> > >* quickTraversal = map.template getQuickLocalAdjacentTraversal<EDGE,FACE>() ;
	if (quickTraversal != NULL)
	{
		m_QLT  = &(quickTraversal->operator[](map.template getEmbedding<EDGE>(dart)));
	}
	else
	{
		start = m.phi1(dart) ;
		stop1 = dart ;
		stop2 = m.phi2(dart) ;
	}
Pierre Kraemer's avatar
Pierre Kraemer committed
429
430
431
432
433
}

template <typename MAP>
Dart Traversor2EEaF<MAP>::begin()
{
Sylvain Thery's avatar
Sylvain Thery committed
434
435
436
437
438
439
	if(m_QLT != NULL)
	{
		m_ItDarts = m_QLT->begin();
		return *m_ItDarts++;
	}

Pierre Kraemer's avatar
Pierre Kraemer committed
440
441
442
443
444
445
446
447
448
449
450
451
452
	current = start ;
	return current ;
}

template <typename MAP>
Dart Traversor2EEaF<MAP>::end()
{
	return NIL ;
}

template <typename MAP>
Dart Traversor2EEaF<MAP>::next()
{
Sylvain Thery's avatar
Sylvain Thery committed
453
454
455
456
	if(m_QLT != NULL)
	{
		return *m_ItDarts++;
	}
Pierre Kraemer's avatar
Pierre Kraemer committed
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
	if(current != NIL)
	{
		current = m.phi1(current) ;
		if(current == stop1)
			current = m.phi1(stop2) ;
		else if(current == stop2)
			current = NIL ;
	}
	return current ;
}

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

// Traversor2FV

template <typename MAP>
Sylvain Thery's avatar
Sylvain Thery committed
475
476
477
478
479
480
481
482
Traversor2FV<MAP>::Traversor2FV(MAP& map, Dart dart) : m(map), start(dart),m_QLT(NULL)
{
	AttributeMultiVector<NoTypeNameAttribute<std::vector<Dart> > >* quickTraversal = map.template getQuickLocalIncidentTraversal<FACE,VERTEX>() ;
	if (quickTraversal != NULL)
	{
		m_QLT  = &(quickTraversal->operator[](map.template getEmbedding<FACE>(dart)));
	}
}
Pierre Kraemer's avatar
Pierre Kraemer committed
483
484
485
486

template <typename MAP>
Dart Traversor2FV<MAP>::begin()
{
Sylvain Thery's avatar
Sylvain Thery committed
487
488
489
490
491
492
	if(m_QLT != NULL)
	{
		m_ItDarts = m_QLT->begin();
		return *m_ItDarts++;
	}

Pierre Kraemer's avatar
Pierre Kraemer committed
493
494
495
496
497
498
499
500
501
502
503
504
505
	current = start ;
	return current ;
}

template <typename MAP>
Dart Traversor2FV<MAP>::end()
{
	return NIL ;
}

template <typename MAP>
Dart Traversor2FV<MAP>::next()
{
Sylvain Thery's avatar
Sylvain Thery committed
506
507
508
509
	if(m_QLT != NULL)
	{
		return *m_ItDarts++;
	}
Pierre Kraemer's avatar
Pierre Kraemer committed
510
511
512
513
514
515
516
517
518
519
520
521
	if(current != NIL)
	{
		current = m.phi1(current) ;
		if(current == start)
			current = NIL ;
	}
	return current ;
}

// Traversor2FFaV

template <typename MAP>
Sylvain Thery's avatar
Sylvain Thery committed
522
Traversor2FFaV<MAP>::Traversor2FFaV(MAP& map, Dart dart) : m(map),m_QLT(NULL)
Pierre Kraemer's avatar
Pierre Kraemer committed
523
{
Sylvain Thery's avatar
Sylvain Thery committed
524
525
	AttributeMultiVector<NoTypeNameAttribute<std::vector<Dart> > >* quickTraversal = map.template getQuickLocalAdjacentTraversal<FACE,VERTEX>() ;
	if (quickTraversal != NULL)
Pierre Kraemer's avatar
Pierre Kraemer committed
526
	{
Sylvain Thery's avatar
Sylvain Thery committed
527
528
529
530
531
532
533
534
535
536
537
538
539
540
		m_QLT  = &(quickTraversal->operator[](map.template getEmbedding<FACE>(dart)));
	}
	else
	{
		start = m.phi2(m.phi_1(m.phi2(m.phi_1(dart)))) ;
		current = start ;
		if(start == dart)
		{
			stop = m.phi2(m.phi_1(dart)) ;
			start = next() ;
		}
		stop = dart ;
		if(m.isBoundaryMarked2(start))
			start = next() ;
Pierre Kraemer's avatar
Pierre Kraemer committed
541
542
543
544
545
546
	}
}

template <typename MAP>
Dart Traversor2FFaV<MAP>::begin()
{
Sylvain Thery's avatar
Sylvain Thery committed
547
548
549
550
551
552
	if(m_QLT != NULL)
	{
		m_ItDarts = m_QLT->begin();
		return *m_ItDarts++;
	}

Pierre Kraemer's avatar
Pierre Kraemer committed
553
554
555
556
557
558
559
560
561
562
563
564
565
	current = start ;
	return current ;
}

template <typename MAP>
Dart Traversor2FFaV<MAP>::end()
{
	return NIL ;
}

template <typename MAP>
Dart Traversor2FFaV<MAP>::next()
{
Sylvain Thery's avatar
Sylvain Thery committed
566
567
568
569
	if(m_QLT != NULL)
	{
		return *m_ItDarts++;
	}
Pierre Kraemer's avatar
Pierre Kraemer committed
570
571
	if(current != NIL)
	{
Sylvain Thery's avatar
Sylvain Thery committed
572
		current = m.phi2(m.phi_1(current)) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
573
574
575
		if(current == stop)
		{
			Dart d = m.phi1(current) ;
Sylvain Thery's avatar
Sylvain Thery committed
576
			current = m.phi2(m.phi_1(m.phi2(m.phi_1(d)))) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
577
578
			if(current == d)
			{
Sylvain Thery's avatar
Sylvain Thery committed
579
				stop = m.phi2(m.phi_1(d)) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
580
581
582
				return next() ;
			}
			stop = d ;
Thery Sylvain's avatar
Thery Sylvain committed
583
			if(m.isBoundaryMarked2(current))
Pierre Kraemer's avatar
Pierre Kraemer committed
584
585
586
587
588
589
590
591
592
593
594
				return next() ;
		}
		if(current == start)
			current = NIL ;
	}
	return current ;
}

// Traversor2FFaE

template <typename MAP>
Sylvain Thery's avatar
Sylvain Thery committed
595
Traversor2FFaE<MAP>::Traversor2FFaE(MAP& map, Dart dart) : m(map),m_QLT(NULL)
Pierre Kraemer's avatar
Pierre Kraemer committed
596
{
Sylvain Thery's avatar
Sylvain Thery committed
597
598
	AttributeMultiVector<NoTypeNameAttribute<std::vector<Dart> > >* quickTraversal = map.template getQuickLocalAdjacentTraversal<FACE,EDGE>() ;
	if (quickTraversal != NULL)
Pierre Kraemer's avatar
Pierre Kraemer committed
599
	{
Sylvain Thery's avatar
Sylvain Thery committed
600
601
602
603
604
605
606
607
608
609
610
		m_QLT  = &(quickTraversal->operator[](map.template getEmbedding<FACE>(dart)));
	}
	else
	{
		start = m.phi2(dart) ;
		while(start != NIL && m.isBoundaryMarked2(start))
		{
			start = m.phi2(m.phi1(m.phi2(start))) ;
			if(start == m.phi2(dart))
				start = NIL ;
		}
Pierre Kraemer's avatar
Pierre Kraemer committed
611
612
613
614
615
616
	}
}

template <typename MAP>
Dart Traversor2FFaE<MAP>::begin()
{
Sylvain Thery's avatar
Sylvain Thery committed
617
618
619
620
621
622
	if(m_QLT != NULL)
	{
		m_ItDarts = m_QLT->begin();
		return *m_ItDarts++;
	}

Pierre Kraemer's avatar
Pierre Kraemer committed
623
624
625
626
627
628
629
630
631
632
633
634
635
	current = start ;
	return current ;
}

template <typename MAP>
Dart Traversor2FFaE<MAP>::end()
{
	return NIL ;
}

template <typename MAP>
Dart Traversor2FFaE<MAP>::next()
{
Sylvain Thery's avatar
Sylvain Thery committed
636
637
638
639
	if(m_QLT != NULL)
	{
		return *m_ItDarts++;
	}
Pierre Kraemer's avatar
Pierre Kraemer committed
640
641
642
643
644
	if(current != NIL)
	{
		do
		{
			current = m.phi2(m.phi1(m.phi2(current))) ;
Thery Sylvain's avatar
Thery Sylvain committed
645
		} while(m.isBoundaryMarked2(current)) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
646
647
648
649
650
651
		if(current == start)
			current = NIL ;
	}
	return current ;
}

Sylvain Thery's avatar
Sylvain Thery committed
652

653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
//
//template<typename MAP>
//Traversor2<MAP>* Traversor2<MAP>::createIncident(MAP& map, Dart dart, unsigned int orbX, unsigned int orbY)
//{
//	int code = 0x100*(orbX-VERTEX) + orbY-VERTEX;
//
//	switch(code)
//	{
//	case 0x0001:
//		return new Traversor2VE<MAP>(map,dart);
//		break;
//	case 0x0002:
//		return new Traversor2VF<MAP>(map,dart);
//		break;
//	case 0x0100:
//		return new Traversor2EV<MAP>(map,dart);
//		break;
//	case 0x0102:
//		return new Traversor2EF<MAP>(map,dart);
//		break;
//	case 0x0200:
//		return new Traversor2FV<MAP>(map,dart);
//		break;
//	case 0x0201:
//		return new Traversor2FE<MAP>(map,dart);
//		break;
//	default:
//		return NULL;
//		break;
//	}
//	return NULL;
//}
//
//template<typename MAP>
//Traversor2<MAP>* Traversor2<MAP>::createAdjacent(MAP& map, Dart dart, unsigned int orbX, unsigned int orbY)
//{
//	int code = 0x100*(orbX-VERTEX) + orbY-VERTEX;
//	switch(code)
//	{
//	case 0x0001:
//		return new Traversor2VVaE<MAP>(map,dart);
//		break;
//	case 0x0002:
//		return new Traversor2VVaF<MAP>(map,dart);
//		break;
//	case 0x0100:
//		return new Traversor2EEaV<MAP>(map,dart);
//		break;
//	case 0x0102:
//		return new Traversor2EEaF<MAP>(map,dart);
//		break;
//	case 0x0200:
//		return new Traversor2FFaV<MAP>(map,dart);
//		break;
//	case 0x0201:
//		return new Traversor2FFaE<MAP>(map,dart);
//		break;
//	default:
//		return NULL;
//		break;
//	}
//	return NULL;
//}
Sylvain Thery's avatar
Sylvain Thery committed
716

Pierre Kraemer's avatar
Pierre Kraemer committed
717
} // namespace CGoGN