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

export.hpp 16.5 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-2011, 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.u-strasbg.fr/                                         *
Pierre Kraemer's avatar
Pierre Kraemer committed
21
22
23
24
25
26
* Contact information: cgogn@unistra.fr                                        *
*                                                                              *
*******************************************************************************/

#include "Topology/generic/attributeHandler.h"
#include "Topology/generic/autoAttributeHandler.h"
27
28
#include "Topology/generic/traversorCell.h"
#include "Topology/generic/traversor2.h"
Pierre Kraemer's avatar
Pierre Kraemer committed
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include "Topology/generic/cellmarker.h"
#include "openctm.h"

namespace CGoGN
{

namespace Algo
{

namespace Export
{

template <typename PFP>
bool exportPLY(typename PFP::MAP& map, const typename PFP::TVEC3& position, const char* filename, const FunctorSelect& good)
{
	typedef typename PFP::MAP MAP;
	typedef typename PFP::VEC3 VEC3;
	
	std::ofstream out(filename, std::ios::out) ;
	if (!out.good())
	{
50
		CGoGNerr << "Unable to open file " << CGoGNendl ;
Pierre Kraemer's avatar
Pierre Kraemer committed
51
52
53
54
55
56
57
58
59
60
61
62
63
		return false ;
	}

	unsigned int nbDarts = map.getNbDarts() ;
	std::vector<unsigned int> facesSize ;
	std::vector<std::vector<unsigned int> > facesIdx ;
	facesSize.reserve(nbDarts/3) ;
	facesIdx.reserve(nbDarts/3) ;
	std::map<unsigned int, unsigned int> vIndex ;
	unsigned int vCpt = 0 ;
	std::vector<unsigned int> vertices ;
	vertices.reserve(nbDarts/6) ;

64
	CellMarker markV(map, VERTEX) ;
65
66
	TraversorF<MAP> t(map) ;
	for(Dart d = t.begin(); d != t.end(); d = t.next())
Pierre Kraemer's avatar
Pierre Kraemer committed
67
	{
68
		if(good(d))
Pierre Kraemer's avatar
Pierre Kraemer committed
69
70
		{
			std::vector<unsigned int> fidx ;
71
72
73
74
			fidx.reserve(8) ;
			unsigned int degree = 0 ;
			Traversor2FV<typename PFP::MAP> tfv(map, d) ;
			for(Dart it = tfv.begin(); it != tfv.end(); it = tfv.next())
Pierre Kraemer's avatar
Pierre Kraemer committed
75
			{
76
77
78
				++degree ;
				unsigned int vNum = map.getEmbedding(VERTEX, it) ;
				if(!markV.isMarked(it))
Pierre Kraemer's avatar
Pierre Kraemer committed
79
				{
80
					markV.mark(it) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
81
82
83
84
					vIndex[vNum] = vCpt++ ;
					vertices.push_back(vNum) ;
				}
				fidx.push_back(vIndex[vNum]) ;
85
86
			}
			facesSize.push_back(degree) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
87
88
89
90
			facesIdx.push_back(fidx) ;
		}
	}

91
92
93
94
95
96
97
98
99
100
	out << "ply" << std::endl ;
	out << "format ascii 1.0" << std::endl ;
	out << "comment no comment" << std::endl ;
	out << "element vertex " << vertices.size() << std::endl ;
	out << "property float x" << std::endl ;
	out << "property float y" << std::endl ;
	out << "property float z" << std::endl ;
	out << "element face " << facesSize.size() << std::endl ;
	out << "property list uchar int vertex_indices" << std::endl ;
	out << "end_header" << std::endl ;
Pierre Kraemer's avatar
Pierre Kraemer committed
101
102
103
104

	for(unsigned int i = 0; i < vertices.size(); ++i)
	{
		const VEC3& v = position[vertices[i]] ;
105
		out << v[0] << " " << v[1] << " " << v[2] << std::endl ;
Pierre Kraemer's avatar
Pierre Kraemer committed
106
107
108
109
110
111
	}
	for(unsigned int i = 0; i < facesSize.size(); ++i)
	{
		out << facesSize[i] ;
		for(unsigned int j = 0; j < facesIdx[i].size(); ++j)
			out << " " << facesIdx[i][j] ;
112
		out << std::endl ;
Pierre Kraemer's avatar
Pierre Kraemer committed
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
	}

	out.close() ;
	return true ;
}

template <typename PFP>
bool exportOFF(typename PFP::MAP& map, const typename PFP::TVEC3& position, const char* filename, const FunctorSelect& good)
{
	typedef typename PFP::MAP MAP;
	typedef typename PFP::VEC3 VEC3;
	
	std::ofstream out(filename, std::ios::out) ;
	if (!out.good())
	{
128
		CGoGNerr << "Unable to open file " << CGoGNendl ;
Pierre Kraemer's avatar
Pierre Kraemer committed
129
130
131
132
133
134
135
136
137
138
139
140
141
		return false ;
	}

	unsigned int nbDarts = map.getNbDarts() ;
	std::vector<unsigned int> facesSize ;
	std::vector<std::vector<unsigned int> > facesIdx ;
	facesSize.reserve(nbDarts/3) ;
	facesIdx.reserve(nbDarts/3) ;
	std::map<unsigned int, unsigned int> vIndex ;
	unsigned int vCpt = 0 ;
	std::vector<unsigned int> vertices ;
	vertices.reserve(nbDarts/6) ;

142
	CellMarker markV(map, VERTEX) ;
143
144
	TraversorF<MAP> t(map) ;
	for(Dart d = t.begin(); d != t.end(); d = t.next())
Pierre Kraemer's avatar
Pierre Kraemer committed
145
	{
146
		if(good(d))
Pierre Kraemer's avatar
Pierre Kraemer committed
147
148
		{
			std::vector<unsigned int> fidx ;
149
150
151
152
			fidx.reserve(8) ;
			unsigned int degree = 0 ;
			Traversor2FV<typename PFP::MAP> tfv(map, d) ;
			for(Dart it = tfv.begin(); it != tfv.end(); it = tfv.next())
Pierre Kraemer's avatar
Pierre Kraemer committed
153
			{
154
155
156
				++degree ;
				unsigned int vNum = map.getEmbedding(VERTEX, it) ;
				if(!markV.isMarked(it))
Pierre Kraemer's avatar
Pierre Kraemer committed
157
				{
158
					markV.mark(it) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
159
160
161
162
					vIndex[vNum] = vCpt++ ;
					vertices.push_back(vNum) ;
				}
				fidx.push_back(vIndex[vNum]) ;
163
164
			}
			facesSize.push_back(degree) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
165
166
167
168
			facesIdx.push_back(fidx) ;
		}
	}

169
170
	out << "OFF" << std::endl ;
	out << vertices.size() << " " << facesSize.size() << " " << 0 << std::endl ;
Pierre Kraemer's avatar
Pierre Kraemer committed
171
172
173
174

	for(unsigned int i = 0; i < vertices.size(); ++i)
	{
		const VEC3& v = position[vertices[i]] ;
175
		out << v[0] << " " << v[1] << " " << v[2] << std::endl ;
Pierre Kraemer's avatar
Pierre Kraemer committed
176
177
178
179
180
181
	}
	for(unsigned int i = 0; i < facesSize.size(); ++i)
	{
		out << facesSize[i] ;
		for(unsigned int j = 0; j < facesIdx[i].size(); ++j)
			out << " " << facesIdx[i][j] ;
182
		out << std::endl ;
Pierre Kraemer's avatar
Pierre Kraemer committed
183
184
185
186
187
188
189
	}

	out.close() ;
	return true ;
}

template <typename PFP>
190
bool exportCTM(typename PFP::MAP& map, const typename PFP::TVEC3& position, const std::string& filename, const FunctorSelect& good)
Pierre Kraemer's avatar
Pierre Kraemer committed
191
192
193
194
{
	typedef typename PFP::MAP MAP;
	typedef typename PFP::VEC3 VEC3;

195
	AutoAttributeHandler<unsigned int> tableVertLab(map, VERTEX);
Pierre Kraemer's avatar
Pierre Kraemer committed
196

197
	unsigned int nbDarts = map.getNbDarts() ;
Pierre Kraemer's avatar
Pierre Kraemer committed
198
199
200
201
202
203

	std::vector<CTMfloat> verticesBuffer;
	std::vector<CTMuint> indicesBuffer;
	verticesBuffer.reserve(nbDarts/5);	// TODO non optimal reservation
	indicesBuffer.reserve(nbDarts/3);

204
205
206
207
	CellMarker markV(map,VERTEX);
	TraversorF<MAP> t(map) ;
	unsigned int lab = 0;
	for(Dart d = t.begin(); d != t.end(); d = t.next())
Pierre Kraemer's avatar
Pierre Kraemer committed
208
	{
209
		if(good(d))
Pierre Kraemer's avatar
Pierre Kraemer committed
210
		{
211
212
			Traversor2FV<typename PFP::MAP> tfv(map, d) ;
			for(Dart it = tfv.begin(); it != tfv.end(); it = tfv.next())
Pierre Kraemer's avatar
Pierre Kraemer committed
213
			{
214
				if (!markV.isMarked(it))
Pierre Kraemer's avatar
Pierre Kraemer committed
215
				{
216
217
218
					markV.mark(it);
					tableVertLab[it] = lab++;
					const VEC3& vert =  position[it];
Pierre Kraemer's avatar
Pierre Kraemer committed
219
220
221
222
					verticesBuffer.push_back(vert[0]);
					verticesBuffer.push_back(vert[1]);
					verticesBuffer.push_back(vert[2]);
				}
223
224
				indicesBuffer.push_back(tableVertLab[it]);
			}
Pierre Kraemer's avatar
Pierre Kraemer committed
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
		}
	}

	// Save the file using the OpenCTM API
	CTMexporter ctm;

	// Define mesh

	ctm.DefineMesh(&(verticesBuffer[0]) , verticesBuffer.size()/3,
			&(indicesBuffer[0]) , indicesBuffer.size()/3, NULL);


	ctm.VertexPrecisionRel(0.0001f);

	// Set compression method and level
	ctm.CompressionMethod(CTM_METHOD_MG2);
	ctm.CompressionLevel(9);

	// Export file
	ctm.Save(filename.c_str());

	return true ;
}

249
template <typename PFP>
Kenneth Vanhoey's avatar
Kenneth Vanhoey committed
250
bool exportPlyPTMgeneric(typename PFP::MAP& map, const char* filename, const typename PFP::TVEC3& position, const FunctorSelect& good)
251
252
253
{
	typedef typename PFP::MAP MAP;
	typedef typename PFP::VEC3 VEC3;
Kenneth Vanhoey's avatar
Kenneth Vanhoey committed
254
255
256
	typedef typename PFP::TVEC3 TVEC3;
	typedef typename PFP::REAL REAL;
	typedef typename PFP::TREAL TREAL;
257
258
259
260

	std::ofstream out(filename, std::ios::out) ;
	if (!out.good())
	{
261
		CGoGNerr << "Unable to open file " << filename << CGoGNendl ;
262
263
264
		return false ;
	}

265
	AutoAttributeHandler<unsigned int> tableVertLab(map, VERTEX);
266
267
268
269
270
271
272
273
274
275


	unsigned int nbDarts = map.getNbDarts() ;

	std::vector<unsigned int> vertices;
	std::vector<unsigned int> faces;

	vertices.reserve(nbDarts/5);	// TODO non optimal reservation
	faces.reserve(nbDarts/3);

276
277
	CellMarker markV(map, VERTEX);
	TraversorF<MAP> t(map) ;
278
279
	unsigned int lab = 0;
	unsigned int nbf = 0;
280
	for(Dart d = t.begin(); d != t.end(); d = t.next())
281
	{
282
		if(good(d))
283
284
		{
			std::vector<unsigned int> face ;
285
286
			Traversor2FV<typename PFP::MAP> tfv(map, d) ;
			for(Dart it = tfv.begin(); it != tfv.end(); it = tfv.next())
287
			{
288
				if (!markV.isMarked(it))
289
				{
290
291
292
					markV.mark(it);
					tableVertLab[it] = lab++;
					vertices.push_back(map.getEmbedding(VERTEX, it));
293
				}
294
295
				face.push_back(tableVertLab[it]);
			}
296
297
298
299
300
301
302
303
304

			faces.push_back(face.size()) ;
			for (unsigned int i = 0 ; i < face.size() ; ++i)
				faces.push_back(face.at(i)) ;

			++nbf;
		}
	}

Kenneth Vanhoey's avatar
Kenneth Vanhoey committed
305
306
307
308
309
310
311
312
313
314
315
316
	TVEC3 frame[3] ;
	TVEC3 colorPTM[15] ;

	frame[0] = map.template getAttribute<VEC3>(VERTEX, "frame_T") ;
	frame[1] = map.template getAttribute<VEC3>(VERTEX, "frame_B") ;
	frame[2] = map.template getAttribute<VEC3>(VERTEX, "frame_N") ;
	for (unsigned i = 0 ; i < 15 ; ++i)
	{
		std::stringstream name ;
		name << "colorPTM_a" << i ;
		colorPTM[i] = map.template getAttribute<VEC3>(VERTEX,name.str()) ;
	}
317
	const unsigned int nbCoefs = colorPTM[14].isValid() ? 15 : (colorPTM[9].isValid() ? 10 : 6) ;
Kenneth Vanhoey's avatar
Kenneth Vanhoey committed
318

319
320
	out << "ply" << std::endl ;
	out << "format ascii 1.0" << std::endl ;
321
	out << "comment ply PTM (K. Vanhoey generic format)" << std::endl ;
322
323
324
325
326
327
328
329
330
331
332
333
334
	out << "element vertex " << vertices.size() << std::endl ;
	out << "property float x" << std::endl ;
	out << "property float y" << std::endl ;
	out << "property float z" << std::endl ;
	out << "property float tx" << std::endl ;
	out << "property float ty" << std::endl ;
	out << "property float tz" << std::endl ;
	out << "property float bx" << std::endl ;
	out << "property float by" << std::endl ;
	out << "property float bz" << std::endl ;
	out << "property float nx" << std::endl ;
	out << "property float ny" << std::endl ;
	out << "property float nz" << std::endl ;
335
336
337
338
339
340
	for(unsigned int coefI = 0 ; coefI < nbCoefs ; ++coefI)
		out << "property float L1_a" << coefI << std::endl ;
	for(unsigned int coefI = 0 ; coefI < nbCoefs ; ++coefI)
		out << "property float L2_a" << coefI << std::endl ;
	for(unsigned int coefI = 0 ; coefI < nbCoefs ; ++coefI)
		out << "property float L3_a" << coefI << std::endl ;
Kenneth Vanhoey's avatar
Kenneth Vanhoey committed
341
342
343

	TREAL errL2 = map.template getAttribute<REAL>(VERTEX,"errL2") ;
	TREAL errLmax = map.template getAttribute<REAL>(VERTEX,"errLmax") ;
344
	TREAL stdDev = map.template getAttribute<REAL>(VERTEX,"stdDev") ;
345
346
347
348
349
350
	if (errL2.isValid())
		out << "property float errL2" << std::endl ;
	if (errLmax.isValid())
		out << "property float errLmax" << std::endl ;
	if (stdDev.isValid())
		out << "property float stdDev" << std::endl ;
351
352
353
354
355

	out << "element face " << nbf << std::endl ;
	out << "property list uchar int vertex_indices" << std::endl ;
	out << "end_header" << std::endl ;

356
357
358
	for(unsigned int i = 0; i < vertices.size(); ++i)
	{
		unsigned int vi = vertices[i];
359
360
		 // position
		for(unsigned int coord = 0 ; coord < 3 ; ++coord)
361
			out << position[vi][coord] << " " ;
362
363
364
		 // frame
		for(unsigned int axis = 0 ; axis < 3 ; ++axis)
			for (unsigned int coord = 0 ; coord < 3 ; ++coord)
365
				out << frame[axis][vi][coord] << " " ;
366
367
		 // coefficients
		for (unsigned int channel = 0 ; channel < 3 ; ++channel)
368
369
			for(unsigned int coefI = 0 ; coefI < nbCoefs ; ++coefI)
				out << colorPTM[coefI][vi][channel] << " "  ;
370
371
		 // fitting errors (if any)
		if (errL2.isValid())
372
373
374
375
376
377
			out << errL2[vi] << " " ;
		if (errLmax.isValid())
			out << errLmax[vi] << " " ;
		if (stdDev.isValid())
			out << stdDev[vi] << " " ;
		out << std::endl ;
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
	}

	std::vector<unsigned int>::iterator it = faces.begin();
	while (it != faces.end())
	{
		unsigned int nbe = *it++;
		out << nbe ;
		for(unsigned int j = 0; j < nbe; ++j)
			out << " " << *it++;
		out << std::endl ;
	}

	out.close() ;
	return true ;
}
393

Pierre Kraemer's avatar
Pierre Kraemer committed
394
template <typename PFP>
395
bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename PFP::TVEC3& position, const typename PFP::TVEC3 frame[3], const typename PFP::TVEC3 colorPTM[6], const FunctorSelect& good)
Pierre Kraemer's avatar
Pierre Kraemer committed
396
397
398
399
400
401
402
{
	typedef typename PFP::MAP MAP;
	typedef typename PFP::VEC3 VEC3;

	std::ofstream out(filename, std::ios::out) ;
	if (!out.good())
	{
403
		CGoGNerr << "Unable to open file " << CGoGNendl ;
Pierre Kraemer's avatar
Pierre Kraemer committed
404
405
406
		return false ;
	}

407
	AutoAttributeHandler<unsigned int> tableVertLab(map, VERTEX);
Pierre Kraemer's avatar
Pierre Kraemer committed
408
409
410
411
412
413
414
415
416

	unsigned int nbDarts = map.getNbDarts() ;

	std::vector<unsigned int> vertices;
	std::vector<unsigned int> faces;

	vertices.reserve(nbDarts/5);	// TODO non optimal reservation
	faces.reserve(nbDarts/3);

417
418
	CellMarker markV(map, VERTEX);
	TraversorF<MAP> t(map) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
419
420
	unsigned int lab = 0;
	unsigned int nbf = 0;
421
	for(Dart d = t.begin(); d != t.end(); d = t.next())
Pierre Kraemer's avatar
Pierre Kraemer committed
422
	{
423
		if(good(d))
Pierre Kraemer's avatar
Pierre Kraemer committed
424
		{
425
			std::vector<unsigned int> face ;
426
427
			Traversor2FV<typename PFP::MAP> tfv(map, d) ;
			for(Dart it = tfv.begin(); it != tfv.end(); it = tfv.next())
Pierre Kraemer's avatar
Pierre Kraemer committed
428
			{
429
				if (!markV.isMarked(it))
Pierre Kraemer's avatar
Pierre Kraemer committed
430
				{
431
432
433
					markV.mark(it);
					tableVertLab[it] = lab++;
					vertices.push_back(map.getEmbedding(VERTEX, it));
Pierre Kraemer's avatar
Pierre Kraemer committed
434
				}
435
436
				face.push_back(tableVertLab[it]);
			}
437
438
439
440
441
442

			faces.push_back(face.size()) ;
			for (unsigned int i = 0 ; i < face.size() ; ++i)
				faces.push_back(face.at(i)) ;

			++nbf;
Pierre Kraemer's avatar
Pierre Kraemer committed
443
444
445
		}
	}

446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
	out << "ply" << std::endl ;
	out << "format ascii 1.0" << std::endl ;
	out << "comment ply PTM (F. Larue format)" << std::endl ;
	out << "element vertex " << vertices.size() << std::endl ;
	out << "property float x" << std::endl ;
	out << "property float y" << std::endl ;
	out << "property float z" << std::endl ;
	out << "property float tx" << std::endl ;
	out << "property float ty" << std::endl ;
	out << "property float tz" << std::endl ;
	out << "property float bx" << std::endl ;
	out << "property float by" << std::endl ;
	out << "property float bz" << std::endl ;
	out << "property float nx" << std::endl ;
	out << "property float ny" << std::endl ;
	out << "property float nz" << std::endl ;
	out << "property float L1_a" << std::endl ;
	out << "property float L1_b" << std::endl ;
	out << "property float L1_c" << std::endl ;
	out << "property float L1_d" << std::endl ;
	out << "property float L1_e" << std::endl ;
	out << "property float L1_f" << std::endl ;
	out << "property float L2_a" << std::endl ;
	out << "property float L2_b" << std::endl ;
	out << "property float L2_c" << std::endl ;
	out << "property float L2_d" << std::endl ;
	out << "property float L2_e" << std::endl ;
	out << "property float L2_f" << std::endl ;
	out << "property float L3_a" << std::endl ;
	out << "property float L3_b" << std::endl ;
	out << "property float L3_c" << std::endl ;
	out << "property float L3_d" << std::endl ;
	out << "property float L3_e" << std::endl ;
	out << "property float L3_f" << std::endl ;
	out << "element face " << nbf << std::endl ;
	out << "property list uchar int vertex_indices" << std::endl ;
	out << "end_header" << std::endl ;
Pierre Kraemer's avatar
Pierre Kraemer committed
483
484
485
486

	for(unsigned int i = 0; i < vertices.size(); ++i)
	{
		unsigned int vi = vertices[i];
487
488
489
490
491
492
		out << position[vi][0] << " " << position[vi][1] << " " << position[vi][2] << " " ;
		out << frame[0][vi][0] << " " << frame[0][vi][1] << " " << frame[0][vi][2] << " " ;
		out << frame[1][vi][0] << " " << frame[1][vi][1] << " " << frame[1][vi][2] << " " ;
		out << frame[2][vi][0] << " " << frame[2][vi][1] << " " << frame[2][vi][2] << " " ;
		out << colorPTM[0][vi][0] << " " << colorPTM[1][vi][0] << " " << colorPTM[2][vi][0] << " " << colorPTM[3][vi][0] << " " << colorPTM[4][vi][0] << " " << colorPTM[5][vi][0] <<" " ;
		out << colorPTM[0][vi][1] << " " << colorPTM[1][vi][1] << " " << colorPTM[2][vi][1] << " " << colorPTM[3][vi][1] << " " << colorPTM[4][vi][1] << " " << colorPTM[5][vi][1] <<" " ;
493
		out << colorPTM[0][vi][2] << " " << colorPTM[1][vi][2] << " " << colorPTM[2][vi][2] << " " << colorPTM[3][vi][2] << " " << colorPTM[4][vi][2] << " " << colorPTM[5][vi][2] << std::endl ;
Pierre Kraemer's avatar
Pierre Kraemer committed
494
495
	}

496
	std::vector<unsigned int>::iterator it = faces.begin();
Pierre Kraemer's avatar
Pierre Kraemer committed
497
498
499
500
501
502
	while (it != faces.end())
	{
		unsigned int nbe = *it++;
		out << nbe ;
		for(unsigned int j = 0; j < nbe; ++j)
			out << " " << *it++;
503
		out << std::endl ;
Pierre Kraemer's avatar
Pierre Kraemer committed
504
505
506
507
	}

	out.close() ;
	return true ;
508
}
Pierre Kraemer's avatar
Pierre Kraemer committed
509

510
511
512
513
514
515
516
517
518
519
520
521
522
523
template <typename PFP>
bool exportInESS(typename PFP::MAP& map, const char *filename, const typename PFP::TVEC3& position)
{
	typedef typename PFP::MAP MAP;
	typedef typename PFP::VEC3 VEC3;

	std::ofstream out(filename, std::ios::out) ;
	if (!out.good())
	{
		CGoGNerr << "Unable to open file " << CGoGNendl ;
		return false ;
	}
}

Pierre Kraemer's avatar
Pierre Kraemer committed
524
525
526
527
528
} // namespace Export

} // namespace Algo

} // namespace CGoGN