importMesh.hpp 17.1 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 27 28 29 30 31 32 33 34 35 36 37 38 39 40
* Contact information: cgogn@unistra.fr                                        *
*                                                                              *
*******************************************************************************/

#include "Topology/generic/attributeHandler.h"
#include "Topology/generic/autoAttributeHandler.h"
#include "Container/fakeAttribute.h"

namespace CGoGN
{

namespace Algo
{

namespace Import
{

template <typename PFP>
bool importMesh(typename PFP::MAP& map, MeshTablesSurface<PFP>& mts)
{
41
	AutoAttributeHandler< NoMathIONameAttribute< std::vector<Dart> > > vecDartsPerVertex(map, VERTEX, "incidents");
Pierre Kraemer's avatar
Pierre Kraemer committed
42 43 44 45 46

	unsigned nbf = mts.getNbFaces();
	int index = 0;
	// buffer for tempo faces (used to remove degenerated edges)
	std::vector<unsigned int> edgesBuffer;
47
	edgesBuffer.reserve(16);
Pierre Kraemer's avatar
Pierre Kraemer committed
48 49 50 51 52 53 54 55 56 57 58 59 60

	DartMarkerNoUnmark m(map) ;

	// for each face of table
	for(unsigned int i = 0; i < nbf; ++i)
	{
		// store face in buffer, removing degenerated edges
		unsigned int nbe = mts.getNbEdgesFace(i);
		edgesBuffer.clear();
		unsigned int prec = EMBNULL;
		for (unsigned int j = 0; j < nbe; ++j)
		{
			unsigned int em = mts.getEmbIdx(index++);
Pierre Kraemer's avatar
Pierre Kraemer committed
61
			if (em != prec)
Pierre Kraemer's avatar
Pierre Kraemer committed
62 63 64 65 66 67 68 69 70 71 72 73 74
			{
				prec = em;
				edgesBuffer.push_back(em);
			}
		}
		// check first/last vertices
		if (edgesBuffer.front() == edgesBuffer.back())
			edgesBuffer.pop_back();

		// create only non degenerated faces
		nbe = edgesBuffer.size();
		if (nbe > 2)
		{
Pierre Kraemer's avatar
Pierre Kraemer committed
75
			Dart d = map.newFace(nbe, false);
Pierre Kraemer's avatar
Pierre Kraemer committed
76 77 78
			for (unsigned int j = 0; j < nbe; ++j)
			{
				unsigned int em = edgesBuffer[j];		// get embedding
79

80
				FunctorSetEmb<typename PFP::MAP> fsetemb(map, VERTEX, em);
81 82
				foreach_dart_of_orbit_in_parent<typename PFP::MAP>(&map, VERTEX, d, fsetemb) ;

83
				m.mark(d) ;								// mark on the fly to unmark on second loop
Pierre Kraemer's avatar
Pierre Kraemer committed
84
				vecDartsPerVertex[em].push_back(d);		// store incident darts for fast adjacency reconstruction
Pierre Kraemer's avatar
Pierre Kraemer committed
85 86 87 88 89 90
				d = map.phi1(d);
			}
		}
	}

	// reconstruct neighbourhood
91
	unsigned int nbBoundaryEdges = 0;
Pierre Kraemer's avatar
Pierre Kraemer committed
92 93 94 95 96 97 98
	for (Dart d = map.begin(); d != map.end(); map.next(d))
	{
		if (m.isMarked(d))
		{
			// darts incident to end vertex of edge
			std::vector<Dart>& vec = vecDartsPerVertex[map.phi1(d)];

99
			unsigned int embd = map.getEmbedding(VERTEX, d);
Pierre Kraemer's avatar
Pierre Kraemer committed
100
			Dart good_dart = NIL;
101
			for (typename std::vector<Dart>::iterator it = vec.begin(); it != vec.end() && good_dart == NIL; ++it)
Pierre Kraemer's avatar
Pierre Kraemer committed
102
			{
103
				if (map.getEmbedding(VERTEX, map.phi1(*it)) == embd)
Pierre Kraemer's avatar
Pierre Kraemer committed
104 105 106
					good_dart = *it;
			}

107
			if (good_dart != NIL)
Pierre Kraemer's avatar
Pierre Kraemer committed
108
			{
109 110
				map.sewFaces(d, good_dart, false);
				m.unmarkOrbit(EDGE, d);
Pierre Kraemer's avatar
Pierre Kraemer committed
111 112 113
			}
			else
			{
114
				m.unmark(d);
115
				++nbBoundaryEdges;
Pierre Kraemer's avatar
Pierre Kraemer committed
116 117 118 119
			}
		}
	}

120
	if (nbBoundaryEdges > 0)
Sylvain Thery's avatar
Sylvain Thery committed
121 122
	{
		map.closeMap();
123
		CGoGNout << "Map closed (" << nbBoundaryEdges << " boundary edges)" << CGoGNendl;
124
		// ensure bijection between topo and embedding
125
		map.bijectiveOrbitEmbedding(VERTEX);
Sylvain Thery's avatar
Sylvain Thery committed
126
	}
Pierre Kraemer's avatar
Pierre Kraemer committed
127 128 129 130 131 132 133 134 135

	return true ;
}

template <typename PFP>
bool importMesh(typename PFP::MAP& map, MeshTablesVolume<PFP>& mtv)
{
	typedef typename PFP::VEC3 VEC3 ;

136
	AutoAttributeHandler<  NoMathIONameAttribute< std::vector<Dart> > > vecDartsPerVertex(map, VERTEX, "incidents");
Pierre Kraemer's avatar
Pierre Kraemer committed
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193

	//ALGO
	// précondition
	// indexer le tableau du nombre d'arrete par faces par le nombre de faces par volume
	//
	//creation d'une sous-carte (2-carte) pour les faces d'un volume en fonction du nombre d'arete grace a un meshtableSurface
	//avoir un tableau_de_sommets[nbsommets] indexe par les sommets dans lequel on comptera le nombre de fois qu'on a croisé un sommet
	//
	//
	//fusion de toutes les composantes connexes avec couture par phi3


	unsigned int nbf = mtv.getNbFaces(); //getNbVolume()
	unsigned int indexNbFaces = 0;

	//for each volume
	for(unsigned int i = 0 ; i < nbf ; ++i)
	{
		unsigned int indexNbFacesMin = indexNbFaces;

		indexNbFaces += mtv.getNbFacesVolume(i) - 1;

		//for each face of this volume
		for(unsigned int j = indexNbFacesMin ; j<= indexNbFaces ; ++j)
		{
			//reconstructing the faces for this volume

			unsigned int nbEdges = mtv.getNbEdgesFace(j);



//			std::vector<unsigned int> edgesBuffer;
//			edgesBuffer.reserve(8);
//
//			edgesBuffer.clear();
//			unsigned int prec = EMBNULL;
//			for (unsigned int j = 0; j < nbe; ++j)
//			{
//				unsigned int em = mtv.getEmbIdx(index++);
//				if (em!=prec)
//				{
//					prec = em;
//					edgesBuffer.push_back(em);
//				}
//			}
//			// check first/last vertices
//			if (edgesBuffer.front() == edgesBuffer.back())
//				edgesBuffer.pop_back();
//
//			// create only non degenerated faces
//			nbe = edgesBuffer.size();
//			if (nbe >2)
//			{
//				Dart d = map.newFace(nbe);
//				for (unsigned int j = 0; j < nbe; ++j)
//				{
//					unsigned int em = edgesBuffer[j];		// get embedding
194
//					map.setDartEmbedding(VERTEX, d, em);	// associate to dart
Pierre Kraemer's avatar
Pierre Kraemer committed
195 196 197
//					vecDartsPerVertex[em].push_back(d);	// store incident darts for fast phi2 reconstruction
//					d = map.phi1(d);
//				}
198
//				m.markOrbit(FACE, d);	// mark on the fly to unmark on second loop
Pierre Kraemer's avatar
Pierre Kraemer committed
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248
//			}

		}

		indexNbFaces++;
	}









	int index = 0;
	// buffer for tempo faces (used to remove degenerated edges)
	std::vector<unsigned int> edgesBuffer;
	edgesBuffer.reserve(8);

	DartMarkerNoUnmark m(map) ;

	// for each face of table
	for(unsigned int i = 0; i < nbf; ++i)
	{
		// store face in buffer, removing degenerated edges
		unsigned int nbe = mtv.getNbEdgesFace(i);
		edgesBuffer.clear();
		unsigned int prec = EMBNULL;
		for (unsigned int j = 0; j < nbe; ++j)
		{
			unsigned int em = mtv.getEmbIdx(index++);
			if (em!=prec)
			{
				prec = em;
				edgesBuffer.push_back(em);
			}
		}
		// check first/last vertices
		if (edgesBuffer.front() == edgesBuffer.back())
			edgesBuffer.pop_back();

		// create only non degenerated faces
		nbe = edgesBuffer.size();
		if (nbe >2)
		{
			Dart d = map.newFace(nbe);
			for (unsigned int j = 0; j < nbe; ++j)
			{
				unsigned int em = edgesBuffer[j];		// get embedding
249
				map.setDartEmbedding(VERTEX, d, em);	// associate to dart
Pierre Kraemer's avatar
Pierre Kraemer committed
250 251 252
				vecDartsPerVertex[em].push_back(d);	// store incident darts for fast phi2 reconstruction
				d = map.phi1(d);
			}
253
			m.markOrbit(FACE, d);	// mark on the fly to unmark on second loop
Pierre Kraemer's avatar
Pierre Kraemer committed
254 255 256 257 258 259 260 261 262 263 264 265
		}
	}
	//unsigned int nbnm = 0;
	// reconstruct neighbourhood

	for (Dart d = map.begin(); d != map.end(); map.next(d))
	{
		if (m.isMarked(d))
		{
			std::vector<Dart>& vec = vecDartsPerVertex[map.phi1(d)];

			//Phi3 reconstruction
266 267
			unsigned int emb1d = map.getEmbedding(VERTEX, map.phi_1(d));
			unsigned int emb2d = map.getEmbedding(VERTEX, map.phi1(map.phi1(d)));
Pierre Kraemer's avatar
Pierre Kraemer committed
268 269 270 271

			for (typename std::vector<Dart>::iterator it = vec.begin(); it != vec.end(); ++it)
			{
				Dart dprim=*it;
272 273
				unsigned int emb1dprim = map.getEmbedding(VERTEX, map.phi1(map.phi1(dprim)));
				unsigned int emb2dprim = map.getEmbedding(VERTEX, map.phi_1(dprim));
Pierre Kraemer's avatar
Pierre Kraemer committed
274 275 276 277 278 279 280 281

				if(emb1d == emb1dprim && emb2d == emb2dprim)
				{
					map.sewVolumes(d,dprim);
				}
			}

			//Phi2 reconstruction
282 283
			emb1d = map.getEmbedding(VERTEX, d);
			emb2d = map.getEmbedding(VERTEX, map.phi1(d));
Pierre Kraemer's avatar
Pierre Kraemer committed
284 285 286 287

			for (typename std::vector<Dart>::iterator it = vec.begin(); it != vec.end(); ++it)
			{
				Dart dprim=*it;
288 289
				unsigned int emb1dprim = map.getEmbedding(VERTEX, map.phi1(dprim));
				unsigned int emb2dprim = map.getEmbedding(VERTEX, dprim);
Pierre Kraemer's avatar
Pierre Kraemer committed
290 291 292 293 294 295 296

				if(emb1d == emb1dprim && emb2d == emb2dprim)
				{
					map.sewFaces(d,dprim);
				}
			}

297
			m.unmarkOrbit(DART,d);
Pierre Kraemer's avatar
Pierre Kraemer committed
298 299 300 301 302 303 304 305 306 307
		}
	}

	return true ;

//
//	//creer un polyhedre de nbf faces
//	//stocker pour un dart d tout les darts autour de l'arete
//	// reconstruire le voisine de l'arete pour phi3
//
308
//	AutoAttributeHandler<  NoMathIONameAttribute< std::vector<Dart> > > vecDartsPerEdge(map, VERTEX, "incidents");
Pierre Kraemer's avatar
Pierre Kraemer committed
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
//
//	unsigned nbv = mtv.getNbVolumes();
//	int index = 0;
//	// buffer for tempo faces (used to remove degenerated edges)
//	std::vector<unsigned int> edgesBuffer;
//	edgesBuffer.reserve(8);
//
//	DartMarkerNoUnmark m(map) ;
//
//	//for each volume of table
//	for(unsigned int i = 0; i < nbv ; ++i)
//	{
//		unsigned int nbf = mtv.getNbFacesPerVolume(i);
//
//		//for each face of a volume
//		for(unsigned int j = 0; j < nbf; ++j)
//		{
//			// store face in buffer, removing degenerated edges
//			unsigned int nbe = mtv.getNbVerticesPerFace(j);
//			edgesBuffer.clear();
//			unsigned int prec = EMBNULL;
//			for (unsigned int k = 0; k < nbe; ++k)
//			{
//				unsigned int em = mtv.getEmbIdx(index++);
//				if (em!=prec)
//				{
//					prec = em;
//					edgesBuffer.push_back(em);
//				}
//			}
//
//			// check first/last vertices
//			if (edgesBuffer.front() == edgesBuffer.back())
//				edgesBuffer.pop_back();
//
//			// create only non degenerated faces
//			nbe = edgesBuffer.size();
//
//			if (nbe >2)
//			{
//				Dart d = map.newFace(nbe);
//				Dart d3 = map.newFace(nbe);
//				map.sewVolumes(d,d3);
//
//				for (unsigned int l = 0; l < nbe; ++l)
//				{
//					unsigned int em = edgesBuffer[l];		// get embedding
356
//					map.setDartEmbedding(VERTEX, d, em);	// associate to dart
Pierre Kraemer's avatar
Pierre Kraemer committed
357 358 359 360 361 362
//					vecDartsPerVertex[em].push_back(d);	// store incident darts for fast phi2 reconstruction
//					d = map.phi1(d);
//
////					if(l == nbe-1)
////					{
////						unsigned int em2 = edgesBuffer[0];	// get embedding
363
////						map.setDartEmbedding(VERTEX, d3, em2);	// associate to dart
Pierre Kraemer's avatar
Pierre Kraemer committed
364 365 366 367 368
////						vecDartsPerVertex[em2].push_back(d3);	// store incident darts for fast phi2 reconstruction
////					}
////					else
////					{
////						unsigned int em2 = edgesBuffer[l+1];	// get embedding
369
////						map.setDartEmbedding(VERTEX, d3, em2);	// associate to dart
Pierre Kraemer's avatar
Pierre Kraemer committed
370 371 372 373 374
////						vecDartsPerVertex[em2].push_back(d3);	// store incident darts for fast phi2 reconstruction
////					}
////
////					d3 = map.phi_1(d3);
//				}
375 376
//				m.markOrbit(FACE, d);	// mark on the fly to unmark on second loop
//				//m.markOrbit(FACE, d3);	// mark on the fly to unmark on second loop
Pierre Kraemer's avatar
Pierre Kraemer committed
377 378 379 380 381 382 383 384 385 386 387 388 389 390
//			}
//		}
//	}
//
//
//	unsigned int nbnm = 0;
//	// reconstruct neighbourhood
//	for (Dart d = map.begin(); d != map.end(); map.next(d))
//	{
//		if (m.isMarked(d))
//		{
//			// darts incident to end vertex of edge
//			std::vector<Dart>& vec = vecDartsPerVertex[map.phi1(d)];
//
391
//			unsigned int embd = map.getEmbedding(VERTEX, d);
Pierre Kraemer's avatar
Pierre Kraemer committed
392 393 394
//			unsigned int nbf = 0;
//			Dart good_dart = d;
//
395
//			CGoGNout << "vec size" << vec.size() << CGoGNendl;
Pierre Kraemer's avatar
Pierre Kraemer committed
396 397 398
//
//			for(typename std::vector<Dart>::iterator it = vec.begin(); it != vec.end(); ++it)
//			{
399
//				if (map.getEmbedding(VERTEX, map.phi1(*it)) == embd)
Pierre Kraemer's avatar
Pierre Kraemer committed
400 401 402 403 404 405 406 407 408 409 410
//				{
//					good_dart = *it;
//					nbf++;
//				}
//			}
//
//			if (nbf == 2)
//			{
//				if (good_dart == map.phi2(good_dart))
//				{
//					map.sewFaces(d, good_dart);
411
//					m.unmarkOrbit(EDGE, d);
Pierre Kraemer's avatar
Pierre Kraemer committed
412 413 414 415 416 417 418 419 420 421 422
//				}
//			}
//			else
//			{
//				++nbnm;
//			}
//		}
//	}
//
//	if (nbnm > 0)
//	{
423
//		CGoGNout << "Warning " << nbnm << " darts with phi2 fix points" << CGoGNendl;
Pierre Kraemer's avatar
Pierre Kraemer committed
424 425 426 427 428 429 430
//	}
//
//	return true ;

}

template <typename PFP>
431
bool importMesh(typename PFP::MAP& map, const std::string& filename, std::vector<std::string>& attrNames, ImportSurfacique::ImportType kind, bool mergeCloseVertices)
Pierre Kraemer's avatar
Pierre Kraemer committed
432
{
Pierre Kraemer's avatar
Pierre Kraemer committed
433
	MeshTablesSurface<PFP> mts(map);
Pierre Kraemer's avatar
Pierre Kraemer committed
434

Pierre Kraemer's avatar
Pierre Kraemer committed
435
	if(!mts.importMesh(filename, attrNames, kind))
Pierre Kraemer's avatar
Pierre Kraemer committed
436
		return false;
Kenneth Vanhoey's avatar
Kenneth Vanhoey committed
437

438 439
	if (mergeCloseVertices)
		mts.mergeCloseVertices();
Pierre Kraemer's avatar
Pierre Kraemer committed
440 441 442 443

	return importMesh<PFP>(map, mts);
}

444
/*
Pierre Kraemer's avatar
Pierre Kraemer committed
445
template <typename PFP>
446
bool importMesh(typename PFP::MAP& map, const std::string& filename, std::vector<std::string>& attrNames, ImportVolumique::ImportType kind)
Pierre Kraemer's avatar
Pierre Kraemer committed
447
{
448
	MeshTablesVolume<PFP> mtv(map);
Pierre Kraemer's avatar
Pierre Kraemer committed
449

450
	if(!mtv.importMesh(filename, attrNames, kind))
Pierre Kraemer's avatar
Pierre Kraemer committed
451 452 453 454
		return false;

	return importMesh<PFP>(map, mtv);
}
455
*/
Pierre Kraemer's avatar
Pierre Kraemer committed
456 457 458 459

//
//
//
460
//	AutoAttributeHandler<  NoMathIONameAttribute< std::vector<Dart> > > vecDartsPerVertex(map, VERTEX, "incidents");
Pierre Kraemer's avatar
Pierre Kraemer committed
461 462 463
//
//
//	// Attributes container for vertex orbit
464
//	AttributeContainer& vertexContainer = map.getAttributeContainer(VERTEX);
Pierre Kraemer's avatar
Pierre Kraemer committed
465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509
//
//	AttributeHandler<VEC3> positions(idPositions,map);
//
//	MeshTablesSurface<VEC3> mts(vertexContainer, positions);
//
//	if (!mts.importMesh(filename,kind))
//		return false;
//
//	// marker for phi2 reconstruction
//	m = map.getNewMarker();
//
//	unsigned nbf = mts.getNbFaces();
//	int index = 0;
//	// buffer for tempo faces (used to remove degenerated edges)
//	std::vector<unsigned int> edgesBuffer;
//	edgesBuffer.reserve(8);
//
//	// for each face of table
//	for(unsigned int i = 0; i < nbf; ++i)
//	{
//		// store face in buffer, removing degenerated edges
//		unsigned int nbe = mts.getNbEdgesFace(i);
//		edgesBuffer.clear();
//		unsigned int prec=EMBNULL;
//		for (unsigned int j=0; j<nbe; ++j)
//		{
//			unsigned int em = mts.getEmbIdx(index++);
//			if (em!=prec)
//			{
//				prec = em;
//				edgesBuffer.push_back(em);
//			}
//		}
//		// check first/last vertices
//		if (edgesBuffer.front() == edgesBuffer.back())
//			edgesBuffer.pop_back();
//
//		// create only non degenerated faces
//		nbe = edgesBuffer.size();
//		if (nbe >2)
//		{
//			Dart d = map.newFace(nbe);
//			for (unsigned int j=0; j<nbe; ++j)
//			{
//				unsigned int em = edgesBuffer[j];		// get embedding
510
//				map.setDartEmbedding(VERTEX, d, em);	// associate to dart
Pierre Kraemer's avatar
Pierre Kraemer committed
511 512 513
//				vecDartsPerVertex[em].push_back(d);	// store incident darts for fast phi2 reconstruction
//				d = map.phi1(d);
//			}
514
//			map.markOrbit(FACE,d,m);// mark on the fly to unmark on second loop
Pierre Kraemer's avatar
Pierre Kraemer committed
515 516 517 518 519 520 521 522 523 524 525 526 527
//		}
//	}
//
//	unsigned nbnm=0;
//	// reconstruct neighbourhood
//
//	for (Dart d = map.begin(); d != map.end(); map.next(d))
//	{
//		if (map.isMarkedDart(d, m))
//		{
//			// darts incident to end vertex of edge
//			std::vector<Dart>& vec = vecDartsPerVertex[map.phi1(d)];
//
528
//			unsigned int embd = map.getEmbedding(VERTEX, d);
Pierre Kraemer's avatar
Pierre Kraemer committed
529 530 531 532
//			unsigned int nbf=0;
//			Dart good_dart;
//			for (typename std::vector<Dart>::iterator it = vec.begin(); it != vec.end(); ++it)
//			{
533
//				if ( map.getEmbedding(VERTEX,map.phi1(*it))==embd)
Pierre Kraemer's avatar
Pierre Kraemer committed
534 535 536 537 538 539 540 541 542 543 544
//				{
//					good_dart = *it;
//					nbf++;
//				}
//			}
//
//			if (nbf==1)
//			{
//				if (good_dart == map.phi2(good_dart))
//				{
//					map.sewFaces(d, good_dart);
545
//					map.unmarkOrbit(EDGE, d, m);
Pierre Kraemer's avatar
Pierre Kraemer committed
546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573
//				}
//			}
//			else
//			{
//				++nbnm;
//			}
//		}
//	}
//
//
////	return true;
//
//	if (nbnm > 0)
//	{
//		if (closeObject)
//		{
//			Marker mb = map.closeMap(true);
////			// for all vertices
////			for (unsigned int index = 0; index < vecDartsEmb.size(); ++index)
////			{
////				// if vertex is on boundary
////				if (vecEmbNbFp[index] > 0)
////				{
////					// find first dart that is sewed to boundary
////					std::vector<Dart>& vd = vecDartsEmb[index];
////					typename std::vector<Dart>::iterator jt = vd.begin();
////					while (!map.isMarkedDart(*jt, m))
////						jt++;
574
////					unsigned int P = map.getEmbedding(VERTEX, *jt);
Pierre Kraemer's avatar
Pierre Kraemer committed
575 576 577 578 579 580 581 582 583
////					// while vertex if a "non manifold point"
////					while (vecEmbNbFp[index] > 1)
////					{
////						Dart e = map.phi2(*jt);
////						// turn in boundary until we find same embedding
////						do
////						{
////							e = map.phi1(e);
////							// embedding of boundary darts on the fly
584 585 586
////							unsigned int emb = map.getEmbedding(VERTEX, map.phi1(map.phi2(e)));
////							map.setDartEmbedding(VERTEX, e, emb);
////						} while (map.getEmbedding(VERTEX, map.phi2(e)) != P);
Pierre Kraemer's avatar
Pierre Kraemer committed
587 588 589 590 591 592 593
////						// separate the face
////						map.phi1sew(map.phi2(*jt), e);
////						vecEmbNbFp[index]--;
////					}
////					// copy embedding of vertex of boundary of last face
////					Dart e = map.phi2(*jt);
////					Dart d = e;
594
////					if (map.getEmbedding(VERTEX, d) == EMBNULL)
Pierre Kraemer's avatar
Pierre Kraemer committed
595 596 597
////					{
////						do
////						{
598 599
////							unsigned int emb = map.getEmbedding(VERTEX, map.phi1(map.phi2(d)));
////							map.setDartEmbedding(VERTEX, d, emb);
Pierre Kraemer's avatar
Pierre Kraemer committed
600 601 602 603 604 605 606 607 608 609 610
////							d = map.phi1(d);
////						} while (d != e);
////					}
////				}
////			}
//			map.unmarkAll(m);
//			map.releaseMarker(m);
//			m = mb;
//		}
//		else
//		{
611
//			CGoGNout << "Warning " << nbnm << " darts with phi2 fix points" << CGoGNendl;
Pierre Kraemer's avatar
Pierre Kraemer committed
612 613 614 615 616 617 618 619 620 621 622
//		}
//	}
//
//	return true;
//}

} // namespace Import

} // namespace Algo

} // namespace CGoGN