embeddedMap2.hpp 11.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 27 28 29 30 31 32 33
* Contact information: cgogn@unistra.fr                                        *
*                                                                              *
*******************************************************************************/

#include <vector>
#include <algorithm>

namespace CGoGN
{

template <typename MAP2>
void EmbeddedMap2<MAP2>::splitVertex(Dart d, Dart e)
{
Pierre Kraemer's avatar
Pierre Kraemer committed
34 35
	Dart dd = MAP2::phi2(d) ;
	Dart ee = MAP2::phi2(e) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
36 37 38

	MAP2::splitVertex(d, e) ;

39
	if (MAP2::isOrbitEmbedded(VERTEX))
Pierre Kraemer's avatar
Pierre Kraemer committed
40
	{
41 42 43 44
		MAP2::copyDartEmbedding(VERTEX, MAP2::phi1(dd), d) ;
		MAP2::copyDartEmbedding(VERTEX, MAP2::phi1(ee), e) ;
		MAP2::embedNewCell(VERTEX, e) ;
		MAP2::copyCell(VERTEX, e, d) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
45
	}
Pierre Kraemer's avatar
Pierre Kraemer committed
46

47
	if(MAP2::isOrbitEmbedded(FACE))
Pierre Kraemer's avatar
Pierre Kraemer committed
48
	{
49 50
		MAP2::copyDartEmbedding(FACE, MAP2::phi1(dd), dd) ;
		MAP2::copyDartEmbedding(FACE, MAP2::phi1(ee), ee) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
51
	}
Pierre Kraemer's avatar
Pierre Kraemer committed
52 53
}

Pierre Kraemer's avatar
Pierre Kraemer committed
54 55 56 57 58 59
template <typename MAP2>
bool EmbeddedMap2<MAP2>::deleteVertex(Dart d)
{
	Dart f = MAP2::phi1(d) ;
	if(MAP2::deleteVertex(d))
	{
60
		if (MAP2::isOrbitEmbedded(FACE))
Pierre Kraemer's avatar
Pierre Kraemer committed
61
		{
62
			MAP2::embedOrbit(FACE, f, MAP2::getEmbedding(FACE, f)) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
63 64 65 66 67 68
		}
		return true ;
	}
	return false ;
}

69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
template <typename MAP2>
void EmbeddedMap2<MAP2>::linkVertices(Dart d, Dart e)
{
	Dart dNext = MAP2::phi1(d) ;

	MAP2::linkVertices(d,e);

	if (MAP2::isOrbitEmbedded(VERTEX))
	{
		MAP2::copyDartEmbedding(VERTEX, MAP2::phi_1(e), d) ;
		MAP2::copyDartEmbedding(VERTEX, MAP2::phi_1(d), e) ;
	}

	if (MAP2::isOrbitEmbedded(FACE))
	{
		MAP2::embedOrbit(FACE, dNext, MAP2::getEmbedding(FACE, dNext)) ;
	}
}

Pierre Kraemer's avatar
Pierre Kraemer committed
88 89 90 91 92
template <typename MAP2>
void EmbeddedMap2<MAP2>::cutEdge(Dart d)
{
	MAP2::cutEdge(d) ;

Pierre Kraemer's avatar
Pierre Kraemer committed
93 94
	Dart nd = MAP2::phi1(d) ;

95
	if (MAP2::isOrbitEmbedded(EDGE))
Pierre Kraemer's avatar
Pierre Kraemer committed
96
	{
97
		MAP2::embedNewCell(EDGE, nd) ;
98
		MAP2::copyDartEmbedding(EDGE, MAP2::phi2(d), d) ;
99
		MAP2::copyCell(EDGE, nd, d) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
100
	}
101
	if(MAP2::isOrbitEmbedded(FACE))
Pierre Kraemer's avatar
Pierre Kraemer committed
102
	{
103
		MAP2::copyDartEmbedding(FACE, MAP2::phi1(d), d) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
104 105
		Dart e = MAP2::phi2(nd) ;
		if(e != nd)
106
			MAP2::copyDartEmbedding(FACE, MAP2::phi1(e), e) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
107 108 109
	}
}

Pierre Kraemer's avatar
Pierre Kraemer committed
110 111 112 113 114 115 116 117 118
template <typename MAP2>
void EmbeddedMap2<MAP2>::uncutEdge(Dart d)
{
	bool doSomethg = (d != MAP2::phi2(d)) ;

	MAP2::uncutEdge(d) ;

	if(doSomethg)
	{
119 120
		if(MAP2::isOrbitEmbedded(EDGE))
			MAP2::copyDartEmbedding(EDGE, MAP2::phi2(d), d) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
121 122 123
	}
}

Pierre Kraemer's avatar
Pierre Kraemer committed
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158
template <typename MAP2>
bool EmbeddedMap2<MAP2>::edgeCanCollapse(Dart d)
{
	if(MAP2::phi2(d) == d)
		return false ;

	if(MAP2::isBoundaryVertex(d) || MAP2::isBoundaryVertex(MAP2::phi1(d)))
		return false ;

	unsigned int val_v1 = MAP2::vertexDegree(d) ;
	unsigned int val_v2 = MAP2::vertexDegree(MAP2::phi1(d)) ;

	if(val_v1 + val_v2 < 8 || val_v1 + val_v2 > 14)
		return false ;

	if(MAP2::isFaceTriangle(d))
	{
		if(MAP2::vertexDegree(MAP2::phi_1(d)) < 4)
			return false ;
	}

	Dart dd = MAP2::phi2(d) ;
	if(MAP2::isFaceTriangle(dd))
	{
		if(MAP2::vertexDegree(MAP2::phi_1(dd)) < 4)
			return false ;
	}

	// Check vertex sharing condition
	std::vector<unsigned int> vu1 ;
	vu1.reserve(32) ;
	Dart vit1 = MAP2::alpha1(MAP2::alpha1(d)) ;
	Dart end = MAP2::phi1(dd) ;
	do
	{
159
		unsigned int ve = MAP2::getEmbedding(VERTEX, MAP2::phi2(vit1)) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
160 161 162 163 164 165 166
		vu1.push_back(ve) ;
		vit1 = MAP2::alpha1(vit1) ;
	} while(vit1 != end) ;
	end = MAP2::phi1(d) ;
	Dart vit2 = MAP2::alpha1(MAP2::alpha1(dd)) ;
	do
	{
167
		unsigned int ve = MAP2::getEmbedding(VERTEX, MAP2::phi2(vit2)) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
168 169 170 171 172 173 174 175 176 177
		std::vector<unsigned int>::iterator it = std::find(vu1.begin(), vu1.end(), ve) ;
		if(it != vu1.end())
			return false ;
		vit2 = MAP2::alpha1(vit2) ;
	} while(vit2 != end) ;

	return true ;
}

template <typename MAP2>
178
Dart EmbeddedMap2<MAP2>::collapseEdge(Dart d, bool delDegenerateFaces)
Pierre Kraemer's avatar
Pierre Kraemer committed
179 180
{
	unsigned int vEmb = EMBNULL ;
181
	if (MAP2::isOrbitEmbedded(VERTEX))
Pierre Kraemer's avatar
Pierre Kraemer committed
182
	{
183
		vEmb = MAP2::getEmbedding(VERTEX, d) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
184 185
	}

186
	Dart dV = MAP2::collapseEdge(d, delDegenerateFaces);
Pierre Kraemer's avatar
Pierre Kraemer committed
187

188
	if (MAP2::isOrbitEmbedded(VERTEX))
Pierre Kraemer's avatar
Pierre Kraemer committed
189
	{
190
		MAP2::embedOrbit(VERTEX, dV, vEmb) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
191
	}
192 193

	return dV ;
Pierre Kraemer's avatar
Pierre Kraemer committed
194 195 196 197 198 199 200 201 202
}

template <typename MAP2>
bool EmbeddedMap2<MAP2>::flipEdge(Dart d)
{
	if(MAP2::flipEdge(d))
	{
		Dart e = MAP2::phi2(d) ;

203
		if (MAP2::isOrbitEmbedded(VERTEX))
Pierre Kraemer's avatar
Pierre Kraemer committed
204
		{
205 206
			MAP2::copyDartEmbedding(VERTEX, d, MAP2::phi1(e)) ;
			MAP2::copyDartEmbedding(VERTEX, e, MAP2::phi1(d)) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
207
		}
208
		if (MAP2::isOrbitEmbedded(FACE))
Pierre Kraemer's avatar
Pierre Kraemer committed
209
		{
210 211
			MAP2::copyDartEmbedding(FACE, MAP2::phi_1(d), d) ;
			MAP2::copyDartEmbedding(FACE, MAP2::phi_1(e), e) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
212 213 214 215 216 217 218 219 220 221 222 223 224
		}
		return true ;
	}
	return false ;
}

template <typename MAP2>
bool EmbeddedMap2<MAP2>::flipBackEdge(Dart d)
{
	if(MAP2::flipBackEdge(d))
	{
		Dart e = MAP2::phi2(d) ;

225
		if (MAP2::isOrbitEmbedded(VERTEX))
Pierre Kraemer's avatar
Pierre Kraemer committed
226
		{
227 228
			MAP2::copyDartEmbedding(VERTEX, d, MAP2::phi1(e)) ;
			MAP2::copyDartEmbedding(VERTEX, e, MAP2::phi1(d)) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
229
		}
230
		if (MAP2::isOrbitEmbedded(FACE))
Pierre Kraemer's avatar
Pierre Kraemer committed
231
		{
232 233
			MAP2::copyDartEmbedding(FACE, MAP2::phi1(d), d) ;
			MAP2::copyDartEmbedding(FACE, MAP2::phi1(e), e) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
234 235 236 237 238 239
		}
		return true ;
	}
	return false ;
}

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
template <typename MAP2>
void EmbeddedMap2<MAP2>::insertEdgeInVertex(Dart d, Dart e)
{
	MAP2::insertEdgeInVertex(d, e);

	if (MAP2::isOrbitEmbedded(VERTEX))
	{
		MAP2::copyDartEmbedding(VERTEX, e, d) ;
	}

	if (MAP2::isOrbitEmbedded(FACE))
	{
		if(!MAP2::sameFace(d,e))
		{
			MAP2::embedNewCell(FACE, e);
			MAP2::copyCell(FACE, e, d) ;
		}
		else
		{
			MAP2::embedOrbit(FACE, d, MAP2::getEmbedding(FACE, d)) ;
		}
	}
}

template <typename MAP2>
void EmbeddedMap2<MAP2>::removeEdgeFromVertex(Dart d)
{
	Dart dPrev = MAP2::alpha_1(d);

	MAP2::removeEdgeFromVertex(d);

	if (MAP2::isOrbitEmbedded(VERTEX))
	{
		MAP2::embedNewCell(VERTEX, d);
		MAP2::copyCell(VERTEX, d, dPrev);
	}

	if (MAP2::isOrbitEmbedded(FACE))
	{
		if(!MAP2::sameFace(d, dPrev))
		{
			MAP2::embedNewCell(FACE, d);
			MAP2::copyCell(FACE, d, dPrev) ;
		}
		else
		{
			MAP2::embedOrbit(FACE, d, MAP2::getEmbedding(FACE, d)) ;
		}
	}
}

Pierre Kraemer's avatar
Pierre Kraemer committed
291 292 293 294 295
template <typename MAP2>
void EmbeddedMap2<MAP2>::sewFaces(Dart d, Dart e)
{
	unsigned int vEmb1 = EMBNULL ;
	unsigned int vEmb2 = EMBNULL ;
296
	if (MAP2::isOrbitEmbedded(VERTEX))
Pierre Kraemer's avatar
Pierre Kraemer committed
297
	{
298 299
		vEmb1 = MAP2::getEmbedding(VERTEX, d) ;
		vEmb2 = MAP2::getEmbedding(VERTEX, MAP2::phi1(d)) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
300 301 302 303
	}

	MAP2::sewFaces(d, e) ;

304
	if (MAP2::isOrbitEmbedded(VERTEX))
Pierre Kraemer's avatar
Pierre Kraemer committed
305
	{
306 307
		MAP2::embedOrbit(VERTEX, d, vEmb1) ;
		MAP2::embedOrbit(VERTEX, e, vEmb2) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
308 309
	}

310
	if (MAP2::isOrbitEmbedded(EDGE))
Pierre Kraemer's avatar
Pierre Kraemer committed
311
	{
312
		MAP2::copyDartEmbedding(EDGE, e, d) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
313 314 315 316 317 318
	}
}

template <typename MAP2>
void EmbeddedMap2<MAP2>::unsewFaces(Dart d)
{
Thomas's avatar
Thomas committed
319 320 321 322 323 324 325 326 327 328 329
//	bool boundaryD = false ;
//	bool boundaryE = false ;
//	if (MAP2::isOrbitEmbedded(VERTEX))
//	{
//		if(MAP2::isBoundaryVertex(d))
//			boundaryD = true ;
//		if(MAP2::isBoundaryVertex(MAP2::phi1(d)))
//			boundaryE = true ;
//	}
//
//	Dart e = MAP2::phi2(d) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
330 331
	MAP2::unsewFaces(d) ;

Thomas's avatar
Thomas committed
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
//	if (MAP2::isOrbitEmbedded(VERTEX))
//	{
//		if(boundaryD)
//		{
//			if(e != d)
//			{
//				Dart ee = MAP2::phi1(e) ;
//				MAP2::embedNewCell(VERTEX, ee) ;
//				MAP2::copyCell(VERTEX, ee, d) ;
//			}
//		}
//
//		if(boundaryE)
//		{
//			if(e != d)
//			{
//				MAP2::embedNewCell(VERTEX, e) ;
//				MAP2::copyCell(VERTEX, e, MAP2::phi1(d)) ;
//			}
//		}
//	}
//	if (MAP2::isOrbitEmbedded(EDGE))
//	{
//		MAP2::embedNewCell(EDGE, e) ;
//		MAP2::copyCell(EDGE, e, d) ;
//	}
Pierre Kraemer's avatar
Pierre Kraemer committed
358 359 360 361 362 363 364 365 366
}

template <typename MAP2>
bool EmbeddedMap2<MAP2>::collapseDegeneratedFace(Dart d)
{
	Dart e = MAP2::phi2(d) ;

	if(MAP2::collapseDegeneratedFace(d))
	{
367
		if (MAP2::isOrbitEmbedded(EDGE))
Pierre Kraemer's avatar
Pierre Kraemer committed
368
		{
369
			MAP2::copyDartEmbedding(EDGE, MAP2::phi2(e), e) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
370 371 372 373 374 375 376 377 378 379 380
		}
		return true ;
	}
	return false ;
}

template <typename MAP2>
void EmbeddedMap2<MAP2>::splitFace(Dart d, Dart e)
{
	MAP2::splitFace(d, e) ;

381
	if (MAP2::isOrbitEmbedded(VERTEX))
Pierre Kraemer's avatar
Pierre Kraemer committed
382
	{
383 384
		MAP2::copyDartEmbedding(VERTEX, MAP2::phi_1(e), d) ;
		MAP2::copyDartEmbedding(VERTEX, MAP2::phi_1(d), e) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
385
	}
386
	if (MAP2::isOrbitEmbedded(FACE))
Pierre Kraemer's avatar
Pierre Kraemer committed
387
	{
388 389
		MAP2::embedNewCell(FACE, e) ;
		MAP2::copyCell(FACE, e, d) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
390 391 392 393 394 395 396 397 398 399
	}
}

template <typename MAP2>
bool EmbeddedMap2<MAP2>::mergeFaces(Dart d)
{
	Dart dNext = MAP2::phi1(d) ;

	if(MAP2::mergeFaces(d))
	{
400
		if (MAP2::isOrbitEmbedded(FACE))
Pierre Kraemer's avatar
Pierre Kraemer committed
401
		{
402
			MAP2::embedOrbit(FACE, dNext, MAP2::getEmbedding(FACE, dNext)) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419
		}
		return true ;
	}
	return false ;
}

template <typename MAP2>
bool EmbeddedMap2<MAP2>::mergeVolumes(Dart d, Dart e)
{
	std::vector<Dart> darts ;
	std::vector<unsigned int> vEmb ;
	std::vector<unsigned int> eEmb ;
	Dart fit = d ;
	do
	{
		darts.push_back(MAP2::phi2(fit)) ;

420
		if (MAP2::isOrbitEmbedded(VERTEX))
Pierre Kraemer's avatar
Pierre Kraemer committed
421
		{
422
			vEmb.push_back(MAP2::getEmbedding(VERTEX, MAP2::phi2(fit))) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
423 424
		}

425
		if (MAP2::isOrbitEmbedded(EDGE))
Pierre Kraemer's avatar
Pierre Kraemer committed
426
		{
427
			eEmb.push_back(MAP2::getEmbedding(EDGE, fit)) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
428 429 430 431 432 433 434 435 436
		}

		fit = MAP2::phi1(fit) ;
	} while (fit != d) ;

	if(MAP2::mergeVolumes(d, e))
	{
		for(unsigned int i = 0; i < darts.size(); ++i)
		{
437
			if (MAP2::isOrbitEmbedded(VERTEX))
Pierre Kraemer's avatar
Pierre Kraemer committed
438
			{
439
				MAP2::embedOrbit(VERTEX, darts[i], vEmb[i]) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
440 441
			}

442
			if (MAP2::isOrbitEmbedded(EDGE))
Pierre Kraemer's avatar
Pierre Kraemer committed
443
			{
444
				MAP2::embedOrbit(EDGE, darts[i], eEmb[i]) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
445 446 447 448 449 450 451
			}
		}
		return true ;
	}
	return false ;
}

Pierre Kraemer's avatar
Pierre Kraemer committed
452 453 454 455 456 457 458 459
template <typename MAP2>
unsigned int EmbeddedMap2<MAP2>::closeHole(Dart d)
{
	unsigned int nbE = MAP2::closeHole(d) ;
	Dart dd = MAP2::phi2(d) ;
	Dart f = dd ;
	do
	{
460
		if (MAP2::isOrbitEmbedded(VERTEX))
Pierre Kraemer's avatar
Pierre Kraemer committed
461
		{
462
			MAP2::copyDartEmbedding(VERTEX, f, MAP2::alpha1(f)) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
463
		}
464
		if (MAP2::isOrbitEmbedded(EDGE))
Pierre Kraemer's avatar
Pierre Kraemer committed
465
		{
466
			MAP2::copyDartEmbedding(EDGE, f, MAP2::phi2(f)) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
467 468 469 470 471 472
		}
		f = MAP2::phi1(f) ;
	} while(dd != f) ;
	return nbE ;
}

Pierre Kraemer's avatar
Pierre Kraemer committed
473 474 475 476 477 478
template <typename MAP2>
bool EmbeddedMap2<MAP2>::check()
{
	bool topo = MAP2::check() ;
	if (!topo)
		return false ;
479

480
	CGoGNout << "Check: embedding begin" << CGoGNendl ;
Pierre Kraemer's avatar
Pierre Kraemer committed
481 482
	for(Dart d = MAP2::begin(); d != MAP2::end(); MAP2::next(d))
	{
483
		if (MAP2::isOrbitEmbedded(VERTEX))
Pierre Kraemer's avatar
Pierre Kraemer committed
484
		{
485
			if (MAP2::getEmbedding(VERTEX, d) != MAP2::getEmbedding(VERTEX, MAP2::alpha1(d)))
Pierre Kraemer's avatar
Pierre Kraemer committed
486
			{
487
				CGoGNout << "Check: different embeddings on vertex" << CGoGNendl ;
Pierre Kraemer's avatar
Pierre Kraemer committed
488 489 490 491
				return false ;
			}
		}

492
		if (MAP2::isOrbitEmbedded(EDGE))
Pierre Kraemer's avatar
Pierre Kraemer committed
493
		{
494
			if (MAP2::getEmbedding(EDGE, d) != MAP2::getEmbedding(EDGE, MAP2::phi2(d)))
Pierre Kraemer's avatar
Pierre Kraemer committed
495
			{
496
				CGoGNout << "Check: different embeddings on edge" << CGoGNendl ;
Pierre Kraemer's avatar
Pierre Kraemer committed
497 498 499 500
				return false ;
			}
		}

501
		if (MAP2::isOrbitEmbedded(FACE))
Pierre Kraemer's avatar
Pierre Kraemer committed
502
		{
503
			if (MAP2::getEmbedding(FACE, d) != MAP2::getEmbedding(FACE, MAP2::phi1(d)))
Pierre Kraemer's avatar
Pierre Kraemer committed
504
		{
505
				CGoGNout << "Check: different embeddings on face" << CGoGNendl ;
Pierre Kraemer's avatar
Pierre Kraemer committed
506 507 508 509
				return false ;
			}
		}
	}
510
	CGoGNout << "Check: embedding ok" << CGoGNendl ;
Pierre Kraemer's avatar
Pierre Kraemer committed
511 512 513 514
	return true ;
}

} // namespace CGoGN