Coupure prévue mercredi 4 Août pour maintenance du serveur. Nous faisons au mieux pour que celle-ci soit la plus brève possible.

lerp.h 19.3 KB
Newer Older
untereiner's avatar
untereiner committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps  *
* version 0.1                                                                  *
* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg           *
*                                                                              *
* 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.           *
*                                                                              *
* Web site: http://cgogn.unistra.fr/                                           *
* Contact information: cgogn@unistra.fr                                        *
*                                                                              *
*******************************************************************************/

#ifndef __3MR_LERP_FILTER__
#define __3MR_LERP_FILTER__

#include <cmath>
#include "Algo/Geometry/centroid.h"
#include "Algo/Modelisation/tetrahedralization.h"
31
#include "Algo/Modelisation/polyhedron.h"
untereiner's avatar
untereiner committed
32
33
34
35
36
37
38
39
#include "Algo/Multiresolution/filter.h"

namespace CGoGN
{

namespace Algo
{

40
41
42
namespace Volume
{

untereiner's avatar
untereiner committed
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
namespace MR
{

namespace Primal
{

namespace Filters
{

/*********************************************************************************
 *                           SYNTHESIS FILTERS
 *********************************************************************************/

/* Linear Interpolation
 *********************************************************************************/
58
59
60


template <typename PFP>
61
class LerpQuadOddSynthesisFilter : public Algo::MR::Filter
62
63
64
65
66
67
{
protected:
	typename PFP::MAP& m_map ;
	VertexAttribute<typename PFP::VEC3>& m_position ;

public:
68
	LerpQuadOddSynthesisFilter(typename PFP::MAP& m, VertexAttribute<typename PFP::VEC3>& p) : m_map(m), m_position(p)
69
70
71
72
	{}

	void operator() ()
	{
73
74
75
		TraversorW<typename PFP::MAP> travW(m_map) ;
		for (Dart d = travW.begin(); d != travW.end(); d = travW.next())
		{
76
			typename PFP::VEC3 vc = Algo::Surface::Geometry::volumeCentroid<PFP>(m_map, d, m_position);
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105

			unsigned int count = 0;
			typename PFP::VEC3 ec(0.0);
			Traversor3WE<typename PFP::MAP> travWE(m_map, d);
			for (Dart dit = travWE.begin(); dit != travWE.end(); dit = travWE.next())
			{
				m_map.incCurrentLevel();
				ec += m_position[m_map.phi1(dit)];
				m_map.decCurrentLevel();
				++count;
			}
			ec /= count;
			ec *= 3;

			count = 0;
			typename PFP::VEC3 fc(0.0);
			Traversor3WF<typename PFP::MAP> travWF(m_map, d);
			for (Dart dit = travWF.begin(); dit != travWF.end(); dit = travWF.next())
			{
				m_map.incCurrentLevel();
				fc += m_position[m_map.phi1(m_map.phi1(dit))];
				m_map.decCurrentLevel();
				++count;
			}
			fc /= count;
			fc *= 3;

			m_map.incCurrentLevel() ;
			Dart midV = m_map.phi_1(m_map.phi2(m_map.phi1(d)));
untereiner's avatar
untereiner committed
106
			m_position[midV] += vc + ec + fc;
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
			m_map.decCurrentLevel() ;
		}

		TraversorF<typename PFP::MAP> travF(m_map) ;
		for (Dart d = travF.begin(); d != travF.end(); d = travF.next())
		{
			typename PFP::VEC3 vf(0.0);
			typename PFP::VEC3 ef(0.0);

			unsigned int count = 0;
			Traversor3FE<typename PFP::MAP> travFE(m_map, d);
			for (Dart dit = travFE.begin(); dit != travFE.end(); dit = travFE.next())
			{
				vf += m_position[dit];
				m_map.incCurrentLevel();
				ef += m_position[m_map.phi1(dit)];
				m_map.decCurrentLevel();
				++count;
			}
			ef /= count;
			ef *= 2.0;

			vf /= count;

			m_map.incCurrentLevel() ;
			Dart midF = m_map.phi1(m_map.phi1(d));
untereiner's avatar
untereiner committed
133
			m_position[midF] += vf + ef ;
134
135
136
			m_map.decCurrentLevel() ;
		}

untereiner's avatar
untereiner committed
137
138
		TraversorE<typename PFP::MAP> travE(m_map) ;
		for (Dart d = travE.begin(); d != travE.end(); d = travE.next())
139
		{
140
			typename PFP::VEC3 ve = (m_position[d] + m_position[m_map.phi1(d)]) * typename PFP::REAL(0.5);
141
142

			m_map.incCurrentLevel() ;
143
			Dart midE = m_map.phi1(d) ;
untereiner's avatar
untereiner committed
144
			m_position[midE] += ve;
145
146
147
148
149
150
151
			m_map.decCurrentLevel() ;
		}
	}

};


152
153


154
template <typename PFP>
155
class LerpQuadOddAnalysisFilter : public Algo::MR::Filter
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
{
protected:
	typename PFP::MAP& m_map ;
	VertexAttribute<typename PFP::VEC3>& m_position ;

public:
	LerpQuadOddAnalysisFilter(typename PFP::MAP& m, VertexAttribute<typename PFP::VEC3>& p) : m_map(m), m_position(p)
	{}

	void operator() ()
	{
		TraversorE<typename PFP::MAP> travE(m_map) ;
		for (Dart d = travE.begin(); d != travE.end(); d = travE.next())
		{
			typename PFP::VEC3 ve = (m_position[d] + m_position[m_map.phi1(d)]) * typename PFP::REAL(0.5);

			m_map.incCurrentLevel() ;
			Dart midE = m_map.phi1(d) ;
			m_position[midE] -= ve;
175
176
177
			m_map.decCurrentLevel() ;
		}

untereiner's avatar
untereiner committed
178
179
		TraversorF<typename PFP::MAP> travF(m_map) ;
		for (Dart d = travF.begin(); d != travF.end(); d = travF.next())
180
		{
181
182
			typename PFP::VEC3 vf(0.0);
			typename PFP::VEC3 ef(0.0);
183

184
185
186
187
188
189
190
191
192
193
194
195
			unsigned int count = 0;
			Traversor3FE<typename PFP::MAP> travFE(m_map, d);
			for (Dart dit = travFE.begin(); dit != travFE.end(); dit = travFE.next())
			{
				vf += m_position[dit];
				m_map.incCurrentLevel();
				ef += m_position[m_map.phi1(dit)];
				m_map.decCurrentLevel();
				++count;
			}
			ef /= count;
			ef *= 2.0;
196

197
			vf /= count;
198

199
200
201
			m_map.incCurrentLevel() ;
			Dart midF = m_map.phi1(m_map.phi1(d));
			m_position[midF] -= vf;// + ef ;
202
203
204
			m_map.decCurrentLevel() ;
		}

untereiner's avatar
untereiner committed
205
206
		TraversorW<typename PFP::MAP> travW(m_map) ;
		for (Dart d = travW.begin(); d != travW.end(); d = travW.next())
207
		{
208
			typename PFP::VEC3 vc = Algo::Surface::Geometry::volumeCentroid<PFP>(m_map, d, m_position);
209

210
211
212
213
214
215
216
217
218
219
220
221
			unsigned int count = 0;
			typename PFP::VEC3 ec(0.0);
			Traversor3WE<typename PFP::MAP> travWE(m_map, d);
			for (Dart dit = travWE.begin(); dit != travWE.end(); dit = travWE.next())
			{
				m_map.incCurrentLevel();
				ec += m_position[m_map.phi1(dit)];
				m_map.decCurrentLevel();
				++count;
			}
			ec /= count;
			ec *= 3;//12 * m_a * m_a;
222

223
224
225
226
227
228
229
230
231
			count = 0;
			typename PFP::VEC3 fc(0.0);
			Traversor3WF<typename PFP::MAP> travWF(m_map, d);
			for (Dart dit = travWF.begin(); dit != travWF.end(); dit = travWF.next())
			{
				m_map.incCurrentLevel();
				fc += m_position[m_map.phi1(m_map.phi1(dit))];
				m_map.decCurrentLevel();
				++count;
232
			}
233
234
235
236
237
238
239
			fc /= count;
			fc *= 3;//6 * m_a;

			m_map.incCurrentLevel() ;
			Dart midV = m_map.phi_1(m_map.phi2(m_map.phi1(d)));
			m_position[midV] -= vc;// + ec + fc;
			m_map.decCurrentLevel() ;
240
241
242
243
244
245
246
		}
	}

};



247
248


249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
template <typename PFP>
class LerpTriOddSynthesisFilter : public Algo::MR::Filter
{
protected:
    typename PFP::MAP& m_map ;
    VertexAttribute<typename PFP::VEC3>& m_position ;

public:
    LerpTriOddSynthesisFilter(typename PFP::MAP& m, VertexAttribute<typename PFP::VEC3>& p) : m_map(m), m_position(p)
    {}

    void operator() ()
    {
        TraversorW<typename PFP::MAP> travW(m_map) ;
        for (Dart d = travW.begin(); d != travW.end(); d = travW.next())
        {
            if(!Algo::Volume::Modelisation::Tetrahedralization::isTetrahedron<PFP>(m_map,d))
            {
                typename PFP::VEC3 vc = Algo::Surface::Geometry::volumeCentroid<PFP>(m_map, d, m_position);

                unsigned int count = 0;
                typename PFP::VEC3 ec(0.0);
                Traversor3WE<typename PFP::MAP> travWE(m_map, d);
                for (Dart dit = travWE.begin(); dit != travWE.end(); dit = travWE.next())
                {
                    m_map.incCurrentLevel();
                    ec += m_position[m_map.phi1(dit)];
                    m_map.decCurrentLevel();
                    ++count;
                }
                ec /= count;
                ec *= 3;

                count = 0;
                typename PFP::VEC3 fc(0.0);
                Traversor3WF<typename PFP::MAP> travWF(m_map, d);
                for (Dart dit = travWF.begin(); dit != travWF.end(); dit = travWF.next())
                {
                    m_map.incCurrentLevel();
                    fc += m_position[m_map.phi1(m_map.phi1(dit))];
                    m_map.decCurrentLevel();
                    ++count;
                }
                fc /= count;
                fc *= 3;

                m_map.incCurrentLevel() ;
                Dart midV = m_map.phi_1(m_map.phi2(m_map.phi1(d)));
                m_position[midV] += vc + ec + fc;
                m_map.decCurrentLevel() ;
            }
        }

        TraversorE<typename PFP::MAP> travE(m_map) ;
        for (Dart d = travE.begin(); d != travE.end(); d = travE.next())
        {
            typename PFP::VEC3 ve = (m_position[d] + m_position[m_map.phi1(d)]) * typename PFP::REAL(0.5);

            m_map.incCurrentLevel() ;
            Dart midE = m_map.phi1(d) ;
            m_position[midE] += ve;
            m_map.decCurrentLevel() ;
        }
    }

};




template <typename PFP>
class LerpTriOddAnalysisFilter : public Algo::MR::Filter
{
protected:
    typename PFP::MAP& m_map ;
    VertexAttribute<typename PFP::VEC3>& m_position ;

public:
    LerpTriOddAnalysisFilter(typename PFP::MAP& m, VertexAttribute<typename PFP::VEC3>& p) : m_map(m), m_position(p)
    {}

    void operator() ()
    {
        TraversorE<typename PFP::MAP> travE(m_map) ;
        for (Dart d = travE.begin(); d != travE.end(); d = travE.next())
        {
            typename PFP::VEC3 ve = (m_position[d] + m_position[m_map.phi1(d)]) * typename PFP::REAL(0.5);

            m_map.incCurrentLevel() ;
            Dart midE = m_map.phi1(d) ;
            m_position[midE] -= ve;
            m_map.decCurrentLevel() ;
        }

        TraversorW<typename PFP::MAP> travW(m_map) ;
        for (Dart d = travW.begin(); d != travW.end(); d = travW.next())
        {
            if(!Algo::Volume::Modelisation::Tetrahedralization::isTetrahedron<PFP>(m_map,d))
            {
                typename PFP::VEC3 vc = Algo::Surface::Geometry::volumeCentroid<PFP>(m_map, d, m_position);

                unsigned int count = 0;
                typename PFP::VEC3 ec(0.0);
                Traversor3WE<typename PFP::MAP> travWE(m_map, d);
                for (Dart dit = travWE.begin(); dit != travWE.end(); dit = travWE.next())
                {
                    m_map.incCurrentLevel();
                    ec += m_position[m_map.phi1(dit)];
                    m_map.decCurrentLevel();
                    ++count;
                }
                ec /= count;
                ec *= 3;

                count = 0;
                typename PFP::VEC3 fc(0.0);
                Traversor3WF<typename PFP::MAP> travWF(m_map, d);
                for (Dart dit = travWF.begin(); dit != travWF.end(); dit = travWF.next())
                {
                    m_map.incCurrentLevel();
                    fc += m_position[m_map.phi1(m_map.phi1(dit))];
                    m_map.decCurrentLevel();
                    ++count;
                }
                fc /= count;
                fc *= 3;

                m_map.incCurrentLevel() ;
                Dart midV = m_map.phi_1(m_map.phi2(m_map.phi1(d)));
                m_position[midV] -= vc + ec + fc;
                m_map.decCurrentLevel() ;
          }
        }
    }

};


















/*****************************************************************************************/
404
405


untereiner's avatar
untereiner committed
406
template <typename PFP>
407
class LerpEdgeSynthesisFilter : public Algo::MR::Filter
untereiner's avatar
untereiner committed
408
409
410
411
412
413
414
415
416
417
418
419
420
421
{
protected:
	typename PFP::MAP& m_map ;
	VertexAttribute<typename PFP::VEC3>& m_position ;

public:
	LerpEdgeSynthesisFilter(typename PFP::MAP& m, VertexAttribute<typename PFP::VEC3>& p) : m_map(m), m_position(p)
	{}

	void operator() ()
	{
		TraversorE<typename PFP::MAP> trav(m_map) ;
		for (Dart d = trav.begin(); d != trav.end(); d = trav.next())
		{
422
			typename PFP::VEC3 p = (m_position[d] + m_position[m_map.phi1(d)]) * typename PFP::REAL(0.5);
untereiner's avatar
untereiner committed
423
424
425
426
427
428
429
430
431
432
433
434

			m_map.incCurrentLevel() ;

			Dart midV = m_map.phi2(d) ;
			m_position[midV] = p ;

			m_map.decCurrentLevel() ;
		}
	}
} ;

template <typename PFP>
435
class LerpFaceSynthesisFilter : public Algo::MR::Filter
untereiner's avatar
untereiner committed
436
437
438
439
440
441
442
443
444
445
446
447
448
449
{
protected:
	typename PFP::MAP& m_map ;
	VertexAttribute<typename PFP::VEC3>& m_position ;

public:
	LerpFaceSynthesisFilter(typename PFP::MAP& m, VertexAttribute<typename PFP::VEC3>& p) : m_map(m), m_position(p)
	{}

	void operator() ()
	{
		TraversorF<typename PFP::MAP> trav(m_map) ;
		for (Dart d = trav.begin(); d != trav.end(); d = trav.next())
		{
450
			typename PFP::VEC3 p = Algo::Surface::Geometry::faceCentroid<PFP>(m_map, d, m_position);
untereiner's avatar
untereiner committed
451
452

			m_map.incCurrentLevel() ;
453

454
			Dart midF = m_map.phi1(m_map.phi1(d));
455
456
			m_position[midF] = p ;

untereiner's avatar
untereiner committed
457
458
459
460
461
462
			m_map.decCurrentLevel() ;

		}
	}
} ;

463
template <typename PFP>
464
class LerpTriQuadFaceSynthesisFilter : public Algo::MR::Filter
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
{
protected:
	typename PFP::MAP& m_map ;
	VertexAttribute<typename PFP::VEC3>& m_position ;

public:
	LerpTriQuadFaceSynthesisFilter(typename PFP::MAP& m, VertexAttribute<typename PFP::VEC3>& p) : m_map(m), m_position(p)
	{}

	void operator() ()
	{
		TraversorF<typename PFP::MAP> trav(m_map) ;
		for (Dart d = trav.begin(); d != trav.end(); d = trav.next())
		{
			if(m_map.faceDegree(d) > 3)
			{
481
				typename PFP::VEC3 p = Algo::Surface::Geometry::faceCentroid<PFP>(m_map, d, m_position);
482
483
484

				m_map.incCurrentLevel() ;

485
				Dart midF = m_map.phi1(m_map.phi1(d));
486
487
488
489
490
491
492
493
				m_position[midF] = p ;

				m_map.decCurrentLevel() ;
			}
		}
	}
} ;

untereiner's avatar
untereiner committed
494
template <typename PFP>
495
class LerpVolumeSynthesisFilter : public Algo::MR::Filter
untereiner's avatar
untereiner committed
496
497
498
499
500
501
502
503
504
{
protected:
	typename PFP::MAP& m_map ;
	VertexAttribute<typename PFP::VEC3>& m_position ;

public:
	LerpVolumeSynthesisFilter(typename PFP::MAP& m, VertexAttribute<typename PFP::VEC3>& p) : m_map(m), m_position(p)
	{}

505
506
507
508
509
510
511
	void operator() ()
	{
		TraversorW<typename PFP::MAP> trav(m_map) ;
		for (Dart d = trav.begin(); d != trav.end(); d = trav.next())
		{
			typename PFP::VEC3 p = Algo::Surface::Geometry::volumeCentroid<PFP>(m_map, d, m_position);

untereiner's avatar
untereiner committed
512
513
514
			if(!Algo::Volume::Modelisation::Tetrahedralization::isTetrahedron<PFP>(m_map,d))
			{
				m_map.incCurrentLevel() ;
515

untereiner's avatar
untereiner committed
516
517
				Dart midV = m_map.phi_1(m_map.phi2(m_map.phi1(d)));
				m_position[midV] = p ;
518

untereiner's avatar
untereiner committed
519
520
				m_map.decCurrentLevel() ;
			}
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
		}
	}
} ;

template <typename PFP>
class LerpTriQuadVolumeSynthesisFilter : public Algo::MR::Filter
{
protected:
	typename PFP::MAP& m_map ;
	VertexAttribute<typename PFP::VEC3>& m_position ;

public:
	LerpTriQuadVolumeSynthesisFilter(typename PFP::MAP& m, VertexAttribute<typename PFP::VEC3>& p) : m_map(m), m_position(p)
	{}

untereiner's avatar
untereiner committed
536
537
538
539
540
	void operator() ()
	{
		TraversorW<typename PFP::MAP> trav(m_map) ;
		for (Dart d = trav.begin(); d != trav.end(); d = trav.next())
		{
541
542
543
			if(!Algo::Volume::Modelisation::Tetrahedralization::isTetrahedron<PFP>(m_map,d)
					&& !Algo::Surface::Modelisation::isPrism<PFP>(m_map,d)
					&& !Algo::Surface::Modelisation::isPyra<PFP>(m_map,d))
544
			{
545
				typename PFP::VEC3 p = Algo::Surface::Geometry::volumeCentroid<PFP>(m_map, d, m_position);
untereiner's avatar
untereiner committed
546

547
				m_map.incCurrentLevel() ;
untereiner's avatar
untereiner committed
548
549
550

				Dart midV = m_map.phi_1(m_map.phi2(m_map.phi1(d)));
				m_position[midV] = p ;
551

552
				m_map.decCurrentLevel() ;
553
			}
554
555
556
557
		}
	}
} ;

558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586

//template <typename PFP>
//bool isDartOfFaceAtLevel(typename PFP::MAP map, Dart d, unsigned int level)
//{
//	unsigned int cur = map.getCurrentLevel();
//	map.setCurrentLevel(level);
////	TraversorDartsOfOrbit<typename PFP::MAP, FACE> to(map,d);
////	for (Dart dit = to.begin(); dit != to.end(); dit = to.next())
////	{
////		if(d == dit)
////		{
////			map.setCurrentLevel(cur);
////			return true;
////		}
////	}
//	Dart dit = d;
//	do
//	{
//		if(d == dit)
//		{
//			map.setCurrentLevel(cur);
//			return true;
//		}
//		dit = map.phi1(dit);
//	}while(dit != d);

//	map.setCurrentLevel(cur);
//	return false;
//}
587
/*
588
template <typename PFP>
589
class LerpSqrt3VolumeSynthesisFilter : public Algo::MR::Filter
590
591
592
593
594
595
596
597
598
{
protected:
	typename PFP::MAP& m_map ;
	VertexAttribute<typename PFP::VEC3>& m_position ;

public:
	LerpSqrt3VolumeSynthesisFilter(typename PFP::MAP& m, VertexAttribute<typename PFP::VEC3>& p) : m_map(m), m_position(p)
	{}

599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
	Dart findDartOfCentralVertex(Dart d)
	{
		Dart olddart = NIL;
		TraversorDartsOfOrbit<typename PFP::MAP, VOLUME> to(m_map,d);
		for(Dart dit = to.begin() ; (olddart == NIL) && (dit != to.end()) ; dit = to.next())
		{
			m_map.incCurrentLevel();
			unsigned int emb = m_map.template getEmbedding<VERTEX>(dit);
			m_map.decCurrentLevel();
			if(!m_map.isBoundaryMarked3(m_map.phi3(dit)))
			{
				if(emb == EMBNULL)
					olddart = dit;
			}
		}

		std::cout << "findDartOfCentralVertex = " << olddart << std::endl;
		return olddart;
	}

619
620
	void operator() ()
	{
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
//		m_map.incCurrentLevel() ;

//		unsigned int cur = m_map.getCurrentLevel();

//		TraversorV<typename PFP::MAP> trav(m_map) ;
//		for (Dart d = trav.begin(); d != trav.end(); d = trav.next())
//		{
//			if(!m_map.isBoundaryVertex(d))
//			{
//				std::cout << "sommet" << std::endl;

//				//search an old dart
//				Dart olddart = NIL;
//				TraversorDartsOfOrbit<typename PFP::MAP, VERTEX> to(m_map,d);
//				for(Dart dit = to.begin() ; (olddart == NIL) && (dit != to.end()) ; dit = to.next())
//				{
//					if(m_map.getDartLevel(dit) == (cur - 1)) && isDartOfFaceAtLevel<PFP>(m_map,dit, cur-1))
//					{
//						olddart = dit;
//					}
//				}

//				if(olddart != NIL)
//				{
//					std::cout << "olddart = " << olddart << std::endl;

//					m_map.decCurrentLevel();
//					typename PFP::VEC3 p = Algo::Surface::Geometry::volumeCentroid<PFP>(m_map, olddart, m_position);
//					m_map.incCurrentLevel() ;
//					m_position[d] = p;
//				}
//			}
//		}
//		m_map.decCurrentLevel() ;





//		TraversorW<typename PFP::MAP> trav(m_map) ;
//		for (Dart d = trav.begin(); d != trav.end(); d = trav.next())
//		{

//			typename PFP::VEC3 p = Algo::Surface::Geometry::volumeCentroid<PFP>(m_map, d , m_position);

//			m_map.incCurrentLevel() ;

//			Dart midV = m_map.phi_1(m_map.phi2(d));
//			m_position[midV] = p;
//			//m_position[d] = p;

//			m_map.decCurrentLevel() ;
//		}


676
677
678
		TraversorW<typename PFP::MAP> trav(m_map) ;
		for (Dart d = trav.begin(); d != trav.end(); d = trav.next())
		{
679
			Dart dit = d;
680

Sylvain Thery's avatar
Tutos  
Sylvain Thery committed
681
			if(m_map.isBoundaryAdjacentVolume(d))
682
683
684
685
686
			{
				dit = findDartOfCentralVertex(d);
			}

			typename PFP::VEC3 p = Algo::Surface::Geometry::volumeCentroid<PFP>(m_map, d, m_position);
687

688
			//Dart midV = m_map.phi1(dit);
689

690
691
			m_map.incCurrentLevel() ;
			m_position[dit] = p;
untereiner's avatar
untereiner committed
692
693
			m_map.decCurrentLevel() ;
		}
694
695
696
697
698
699
700
701
702
703
704
705
706
707

		TraversorF<typename PFP::MAP> tf(m_map);
		for(Dart dit = tf.begin() ; dit != tf.end() ; dit = tf.next())
		{
			if(m_map.isBoundaryFace(dit))
			{
				typename PFP::VEC3 p = Algo::Surface::Geometry::faceCentroid<PFP>(m_map, dit, m_position);
				m_map.incCurrentLevel();
				Dart midF = m_map.phi_1(dit);
				m_position[midF] = p;
				m_map.decCurrentLevel();
			}
		}

untereiner's avatar
untereiner committed
708
709
710
	}
} ;

711
*/
712

untereiner's avatar
untereiner committed
713
714
715
716
717
718
} // namespace Filters

} // namespace Primal

} // namespace MR

719
720
} // namespace Volume

untereiner's avatar
untereiner committed
721
722
723
724
725
} // namespace Algo

} // namespace CGoGN

#endif /* __3MR_FILTERS_PRIMAL__ */