surface_deformation.cpp 15.4 KB
Newer Older
1 2 3 4 5
#include "surface_deformation.h"

#include "Algo/Geometry/normal.h"
#include "Algo/Geometry/laplacian.h"

6 7
#include "Algo/Topo/basic.h"

8 9
#include "camera.h"

10 11 12 13 14 15 16 17 18 19 20
#include <QKeyEvent>
#include <QMouseEvent>

namespace CGoGN
{

namespace SCHNApps
{

MapParameters::MapParameters() :
	handleSelector(NULL),
21
	freeSelector(NULL),
22 23 24 25 26 27 28 29 30 31
	initialized(false),
	nlContext(NULL)
{}

MapParameters::~MapParameters()
{
	if(nlContext)
		nlDeleteContext(nlContext);
}

Pierre Kraemer's avatar
Pierre Kraemer committed
32
void MapParameters::start(MapHandlerGen* mhg)
33 34 35
{
	if(!initialized)
	{
36
		if(positionAttribute.isValid() && handleSelector && freeSelector)
37
		{
Pierre Kraemer's avatar
Pierre Kraemer committed
38 39
			MapHandler<PFP2>* mh = static_cast<MapHandler<PFP2>*>(mhg);

40
			positionInit = mh->getAttribute<PFP2::VEC3, VERTEX>("positionInit");
41
			if(!positionInit.isValid())
42
				positionInit = mh->addAttribute<PFP2::VEC3, VERTEX>("positionInit");
43

44
			diffCoord = mh->getAttribute<PFP2::VEC3, VERTEX>("diffCoord");
45
			if(!diffCoord.isValid())
46
				diffCoord = mh->addAttribute<PFP2::VEC3, VERTEX>("diffCoord");
47

48
			vertexRotationMatrix = mh->getAttribute<Eigen_Matrix3f, VERTEX>("vertexRotationMatrix");
49
			if(!vertexRotationMatrix.isValid())
50
				vertexRotationMatrix = mh->addAttribute<Eigen_Matrix3f, VERTEX>("vertexRotationMatrix");
51

52
			rotatedDiffCoord = mh->getAttribute<PFP2::VEC3, VERTEX>("rotatedDiffCoord");
53
			if(!rotatedDiffCoord.isValid())
54
				rotatedDiffCoord = mh->addAttribute<PFP2::VEC3, VERTEX>("rotatedDiffCoord");
55

56
			vIndex = mh->getAttribute<unsigned int, VERTEX>("vIndex");
57
			if(!vIndex.isValid())
58
				vIndex = mh->addAttribute<unsigned int, VERTEX>("vIndex");
59 60 61 62 63 64 65 66 67 68

			PFP2::MAP* map = static_cast<MapHandler<PFP2>*>(mh)->getMap();

			map->copyAttribute(positionInit, positionAttribute);

			Algo::Surface::Geometry::computeLaplacianTopoVertices<PFP2>(*map, positionAttribute, diffCoord);

			for(unsigned int i = vertexRotationMatrix.begin(); i != vertexRotationMatrix.end(); vertexRotationMatrix.next(i))
				vertexRotationMatrix[i] = Eigen::Matrix3f::Identity();

69
			nb_vertices = Algo::Topo::computeIndexCells<VERTEX>(*map, vIndex);
70 71 72 73 74 75 76 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 106 107 108 109 110 111 112 113 114

			if(nlContext)
				nlDeleteContext(nlContext);
			nlContext = nlNewContext();
			nlSolverParameteri(NL_NB_VARIABLES, nb_vertices);
			nlSolverParameteri(NL_LEAST_SQUARES, NL_TRUE);
			nlSolverParameteri(NL_SOLVER, NL_CHOLMOD_EXT);

			initialized = true;
		}
	}
}

void MapParameters::stop(MapHandlerGen* mh)
{
	if(initialized)
	{
//		if(positionInit.isValid())
//			mh->removeAttribute(positionInit);

//		if(diffCoord.isValid())
//			mh->removeAttribute(diffCoord);

//		if(vertexRotationMatrix.isValid())
//			mh->removeAttribute(vertexRotationMatrix);

//		if(rotatedDiffCoord.isValid())
//			mh->removeAttribute(rotatedDiffCoord);

//		if(vIndex.isValid())
//			mh->removeAttribute(vIndex);

		if(nlContext)
			nlDeleteContext(nlContext);

		initialized = false;
	}
}





bool Surface_Deformation_Plugin::enable()
{
115
	//	magic line that init static variables of GenericMap in the plugins
Pierre Kraemer's avatar
Pierre Kraemer committed
116
	GenericMap::copyAllStatics(m_schnapps->getStaticPointers());
117

118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
	m_dockTab = new Surface_Deformation_DockTab(m_schnapps, this);
	m_schnapps->addPluginDockTab(this, m_dockTab, "Surface_Deformation");

	connect(m_schnapps, SIGNAL(selectedMapChanged(MapHandlerGen*, MapHandlerGen*)), this, SLOT(selectedMapChanged(MapHandlerGen*, MapHandlerGen*)));
	connect(m_schnapps, SIGNAL(mapAdded(MapHandlerGen*)), this, SLOT(mapAdded(MapHandlerGen*)));
	connect(m_schnapps, SIGNAL(mapRemoved(MapHandlerGen*)), this, SLOT(mapRemoved(MapHandlerGen*)));

	foreach(MapHandlerGen* map, m_schnapps->getMapSet().values())
		mapAdded(map);

	m_dockTab->updateMapParameters();

	return true;
}

void Surface_Deformation_Plugin::disable()
{
	disconnect(m_schnapps, SIGNAL(selectedMapChanged(MapHandlerGen*, MapHandlerGen*)), this, SLOT(selectedMapChanged(MapHandlerGen*, MapHandlerGen*)));
}

138 139 140 141
void Surface_Deformation_Plugin::draw(View *view)
{
}

142 143 144 145 146 147
void Surface_Deformation_Plugin::keyPress(View* view, QKeyEvent* event)
{
	switch(event->key())
	{
		case Qt::Key_D : {
			MapHandlerGen* mh = m_schnapps->getSelectedMap();
Pierre Kraemer's avatar
Pierre Kraemer committed
148
			if(mh)
149
			{
Pierre Kraemer's avatar
Pierre Kraemer committed
150 151
				const MapParameters& p = h_parameterSet[mh];
				if(!m_dragging)
152
				{
Pierre Kraemer's avatar
Pierre Kraemer committed
153 154 155 156 157
					if(p.handleSelector && !p.handleSelector->getSelectedCells().empty())
					{
						m_dragging = true;
						m_draginit = false;
						view->setMouseTracking(true);
158
						view->getCurrentCamera()->disableViewsBoundingBoxFitting();
Pierre Kraemer's avatar
Pierre Kraemer committed
159 160 161 162 163
					}
				}
				else
				{
					m_dragging = false;
164
					m_draginit = false;
Pierre Kraemer's avatar
Pierre Kraemer committed
165
					view->setMouseTracking(false);
166
					view->getCurrentCamera()->enableViewsBoundingBoxFitting();
167 168
				}
			}
169 170
			break;
		}
Pierre Kraemer's avatar
Pierre Kraemer committed
171

172
		case Qt::Key_R : {
Pierre Kraemer's avatar
Pierre Kraemer committed
173 174 175 176 177 178 179 180 181 182 183
			MapHandlerGen* mh = m_schnapps->getSelectedMap();
			if(mh)
			{
				const MapParameters& p = h_parameterSet[mh];
				if(p.initialized)
				{
					asRigidAsPossible(mh);
					mh->notifyAttributeModification(p.positionAttribute);
					view->updateGL();
				}
			}
184 185 186 187 188 189 190
			break;
		}
	}
}

void Surface_Deformation_Plugin::mouseMove(View* view, QMouseEvent* event)
{
191
	if (m_dragging)
192 193
	{
		MapHandlerGen* mh = m_schnapps->getSelectedMap();
194

195
		MapParameters& p = h_parameterSet[mh];
196
		const std::vector<Vertex>& handle = p.handleSelector->getSelectedCells();
197

198
		if (!m_draginit)
199 200
		{
			m_dragZ = 0;
201
			for (std::vector<Vertex>::const_iterator it = handle.begin(); it != handle.end(); ++it)
202 203 204 205 206 207
			{
				const PFP2::VEC3& pp = p.positionAttribute[*it];
				qglviewer::Vec q = view->camera()->projectedCoordinatesOf(qglviewer::Vec(pp[0],pp[1],pp[2]));
				m_dragZ += q.z;
			}
			m_dragZ /= handle.size();
208

209 210
			qglviewer::Vec pp(event->x(), event->y(), m_dragZ);
			m_dragPrevious = view->camera()->unprojectedCoordinatesOf(pp);
211

212 213 214 215 216 217 218 219 220
			m_draginit = true;
		}
		else
		{
			qglviewer::Vec pp(event->x(), event->y(), m_dragZ);
			qglviewer::Vec qq = view->camera()->unprojectedCoordinatesOf(pp);

			qglviewer::Vec vec = qq - m_dragPrevious;
			PFP2::VEC3 t(vec.x, vec.y, vec.z);
221
			for (std::vector<Vertex>::const_iterator it = handle.begin(); it != handle.end(); ++it)
222
				p.positionAttribute[*it] += t;
223

224
			m_dragPrevious = qq;
225

226
//			matchDiffCoord(map);
227
			if (p.initialized)
Pierre Kraemer's avatar
Pierre Kraemer committed
228
			{
229
				asRigidAsPossible(mh);
Pierre Kraemer's avatar
Pierre Kraemer committed
230 231
				mh->notifyAttributeModification(p.positionAttribute);
			}
232
		}
233 234 235 236 237 238 239 240 241 242 243 244

		view->updateGL();
	}
}





void Surface_Deformation_Plugin::selectedMapChanged(MapHandlerGen *prev, MapHandlerGen *cur)
{
	m_dockTab->updateMapParameters();
245 246 247 248
	if (cur==NULL)
		m_dockTab->setDisabled(true);
	else
		m_dockTab->setDisabled(false);
249 250 251 252 253 254 255
}

void Surface_Deformation_Plugin::mapAdded(MapHandlerGen* map)
{
	connect(map, SIGNAL(attributeAdded(unsigned int, const QString&)), this, SLOT(attributeAdded(unsigned int, const QString&)));
	connect(map, SIGNAL(cellSelectorAdded(unsigned int, const QString&)), this, SLOT(cellSelectorAdded(unsigned int, const QString&)));
	connect(map, SIGNAL(cellSelectorRemoved(unsigned int, const QString&)), this, SLOT(cellSelectorRemoved(unsigned int, const QString&)));
256
	connect(map, SIGNAL(selectedCellsChanged(CellSelectorGen*)), this, SLOT(selectedCellsChanged(CellSelectorGen*)));
257 258 259 260 261 262 263
}

void Surface_Deformation_Plugin::mapRemoved(MapHandlerGen* map)
{
	disconnect(map, SIGNAL(attributeAdded(unsigned int, const QString&)), this, SLOT(attributeAdded(unsigned int, const QString&)));
	disconnect(map, SIGNAL(cellSelectorAdded(unsigned int, const QString&)), this, SLOT(cellSelectorAdded(unsigned int, const QString&)));
	disconnect(map, SIGNAL(cellSelectorRemoved(unsigned int, const QString&)), this, SLOT(cellSelectorRemoved(unsigned int, const QString&)));
264
	disconnect(map, SIGNAL(selectedCellsChanged(CellSelectorGen*)), this, SLOT(selectedCellsChanged(CellSelectorGen*)));
265 266 267 268 269 270 271 272 273
}





void Surface_Deformation_Plugin::attributeAdded(unsigned int orbit, const QString& name)
{
	MapHandlerGen* map = static_cast<MapHandlerGen*>(QObject::sender());
274

275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294
	if(orbit == VERTEX && map->isSelectedMap())
		m_dockTab->addVertexAttribute(name);
}

void Surface_Deformation_Plugin::cellSelectorAdded(unsigned int orbit, const QString& name)
{
	MapHandlerGen* map = static_cast<MapHandlerGen*>(QObject::sender());

	if(orbit == VERTEX && map->isSelectedMap())
		m_dockTab->addVertexSelector(name);
}

void Surface_Deformation_Plugin::cellSelectorRemoved(unsigned int orbit, const QString& name)
{
	MapHandlerGen* map = static_cast<MapHandlerGen*>(QObject::sender());

	if(orbit == VERTEX && map->isSelectedMap())
		m_dockTab->removeVertexSelector(name);

	MapParameters& p = h_parameterSet[map];
295
	if(p.handleSelector->getName() == name)
296 297 298 299
	{
		p.stop(map);
		if(!p.initialized && map->isSelectedMap())
			m_dockTab->mapParametersInitialized(false);
300
		p.handleSelector = NULL;
301
	}
302
	if(p.freeSelector->getName() == name)
303 304 305 306
	{
		p.stop(map);
		if(!p.initialized && map->isSelectedMap())
			m_dockTab->mapParametersInitialized(false);
307
		p.freeSelector = NULL;
308 309 310
	}
}

311
void Surface_Deformation_Plugin::selectedCellsChanged(CellSelectorGen* cs)
312
{
313 314 315 316 317 318 319
	MapHandlerGen* map = static_cast<MapHandlerGen*>(QObject::sender());
	MapParameters& p = h_parameterSet[map];
	if(p.initialized && (p.handleSelector == cs || p.freeSelector == cs))
	{
		nlMakeCurrent(p.nlContext) ;
		nlReset(NL_FALSE) ;
	}
320 321 322 323 324 325 326 327 328 329 330 331 332 333
}





void Surface_Deformation_Plugin::changePositionAttribute(const QString& map, const QString& name)
{
	MapHandlerGen* m = m_schnapps->getMap(map);
	if(m)
	{
		MapParameters& p = h_parameterSet[m];
		if(!p.initialized)
		{
Pierre Kraemer's avatar
Pierre Kraemer committed
334 335
			MapHandler<PFP2>* mh = static_cast<MapHandler<PFP2>*>(m);
			p.positionAttribute = mh->getAttribute<PFP2::VEC3, VERTEX>(name);
336 337 338 339 340 341
			if(m->isSelectedMap())
				m_dockTab->updateMapParameters();
		}
	}
}

342
void Surface_Deformation_Plugin::changeHandleSelector(const QString& map, const QString& name)
343 344 345 346 347 348 349
{
	MapHandlerGen* m = m_schnapps->getMap(map);
	if(m)
	{
		MapParameters& p = h_parameterSet[m];
		if(!p.initialized)
		{
Pierre Kraemer's avatar
Pierre Kraemer committed
350 351
			MapHandler<PFP2>* mh = static_cast<MapHandler<PFP2>*>(m);
			p.handleSelector = mh->getCellSelector<VERTEX>(name);
352 353 354 355 356 357
			if(m->isSelectedMap())
				m_dockTab->updateMapParameters();
		}
	}
}

358
void Surface_Deformation_Plugin::changeFreeSelector(const QString& map, const QString& name)
359 360 361 362 363 364 365
{
	MapHandlerGen* m = m_schnapps->getMap(map);
	if(m)
	{
		MapParameters& p = h_parameterSet[m];
		if(!p.initialized)
		{
Pierre Kraemer's avatar
Pierre Kraemer committed
366 367
			MapHandler<PFP2>* mh = static_cast<MapHandler<PFP2>*>(m);
			p.freeSelector = mh->getCellSelector<VERTEX>(name);
368 369 370 371 372 373 374 375 376 377 378 379 380 381 382
			if(m->isSelectedMap())
				m_dockTab->updateMapParameters();
		}
	}
}





void Surface_Deformation_Plugin::toggleMapDeformation(MapHandlerGen* map)
{
	if(map)
	{
		MapParameters& p = h_parameterSet[map];
Pierre Kraemer's avatar
Pierre Kraemer committed
383
		if (!p.initialized)
384 385
		{
			p.start(map);
Pierre Kraemer's avatar
Pierre Kraemer committed
386
			if (p.initialized && map->isSelectedMap())
387 388 389 390 391
				m_dockTab->mapParametersInitialized(true);
		}
		else
		{
			p.stop(map);
Pierre Kraemer's avatar
Pierre Kraemer committed
392
			if (!p.initialized && map->isSelectedMap())
393 394 395 396 397 398 399 400 401 402 403
				m_dockTab->mapParametersInitialized(false);
		}
	}
}

void Surface_Deformation_Plugin::matchDiffCoord(MapHandlerGen* mh)
{
	PFP2::MAP* map = static_cast<MapHandler<PFP2>*>(mh)->getMap();
	MapParameters& p = h_parameterSet[mh];

	nlMakeCurrent(p.nlContext);
Pierre Kraemer's avatar
Pierre Kraemer committed
404
	if (nlGetCurrentState() == NL_STATE_INITIAL)
405
		nlBegin(NL_SYSTEM) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
406
	for (int coord = 0; coord < 3; ++coord)
407
	{
408
		LinearSolving::setupVariables<PFP2>(*map, p.vIndex, p.freeSelector->getMarker(), p.positionAttribute, coord);
409 410 411 412 413 414 415 416 417 418 419 420 421 422 423
		nlBegin(NL_MATRIX);
		LinearSolving::addRowsRHS_Laplacian_Topo<PFP2>(*map, p.vIndex, p.diffCoord, coord);
		nlEnd(NL_MATRIX);
		nlEnd(NL_SYSTEM);
		nlSolve();
		LinearSolving::getResult<PFP2>(*map, p.vIndex, p.positionAttribute, coord);
		nlReset(NL_TRUE);
	}
}

void Surface_Deformation_Plugin::asRigidAsPossible(MapHandlerGen* mh)
{
	PFP2::MAP* map = static_cast<MapHandler<PFP2>*>(mh)->getMap();
	MapParameters& p = h_parameterSet[mh];

Pierre Kraemer's avatar
Pierre Kraemer committed
424
	if (p.initialized)
425
	{
Pierre Kraemer's avatar
Pierre Kraemer committed
426
		CellMarkerNoUnmark<PFP2::MAP, VERTEX> m(*map) ;
427

Pierre Kraemer's avatar
Pierre Kraemer committed
428
		for (Dart d = map->begin(); d != map->end(); map->next(d))
429
		{
Pierre Kraemer's avatar
Pierre Kraemer committed
430
			if (!m.isMarked(d))
431 432 433 434 435 436 437 438 439 440 441 442 443
			{
				m.mark(d) ;

				Eigen::Matrix3f cov = Eigen::Matrix3f::Zero() ;
				PFP2::VEC3 pp = p.positionAttribute[d] ;
				PFP2::VEC3 ppInit = p.positionInit[d] ;
	//			PFP2::REAL area = p.vertexArea[d] ;
				Dart it = d ;
				do
				{
					Dart neigh = map->phi1(it) ;
					PFP2::VEC3 v = p.positionAttribute[neigh] - pp ;
					PFP2::VEC3 vv = p.positionInit[neigh] - ppInit ;
Pierre Kraemer's avatar
Pierre Kraemer committed
444 445
					for (unsigned int i = 0; i < 3; ++i)
						for (unsigned int j = 0; j < 3; ++j)
446 447
							cov(i,j) += v[i] * vv[j];// * perMap->edgeWeight[it] / area ;
					Dart dboundary = map->phi_1(it) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
448
					if (map->phi2(dboundary) == dboundary)
449 450 451 452 453 454 455 456
					{
						v = p.positionAttribute[dboundary] - pp ;
						vv = p.positionInit[dboundary] - pp ;
						for(unsigned int i = 0; i < 3; ++i)
							for(unsigned int j = 0; j < 3; ++j)
								cov(i,j) += v[i] * vv[j];// * perMap->edgeWeight[dboundary] / area ;
					}
					it = map->alpha1(it) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
457
				} while (it != d) ;
458 459 460 461

				Eigen::JacobiSVD<Eigen::Matrix3f> svd(cov, Eigen::ComputeFullU | Eigen::ComputeFullV) ;
				Eigen::Matrix3f R = svd.matrixU() * svd.matrixV().transpose() ;

Pierre Kraemer's avatar
Pierre Kraemer committed
462
				if (R.determinant() < 0)
463 464
				{
					Eigen::Matrix3f U = svd.matrixU() ;
Pierre Kraemer's avatar
Pierre Kraemer committed
465
					for (unsigned int i = 0; i < 3; ++i)
466 467 468 469 470 471 472 473
						U(i,2) *= -1 ;
					R = U * svd.matrixV().transpose() ;
				}

				p.vertexRotationMatrix[d] = R ;
			}
		}

Pierre Kraemer's avatar
Pierre Kraemer committed
474
		for (Dart d = map->begin(); d != map->end(); map->next(d))
475
		{
Pierre Kraemer's avatar
Pierre Kraemer committed
476
			if (m.isMarked(d))
477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493
			{
				m.unmark(d) ;

				unsigned int degree = 0 ;
				Eigen::Matrix3f r = Eigen::Matrix3f::Zero() ;
				Dart it = d ;
				do
				{
					r += p.vertexRotationMatrix[map->phi1(it)] ;
					++degree ;
					Dart dboundary = map->phi_1(it) ;
					if(map->phi2(dboundary) == dboundary)
					{
						r += p.vertexRotationMatrix[dboundary] ;
						++degree ;
					}
					it = map->alpha1(it) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
494
				} while (it != d) ;
495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533
				r += p.vertexRotationMatrix[d] ;
				r /= degree + 1 ;
				PFP2::VEC3& dc = p.diffCoord[d] ;
				Eigen::Vector3f rdc(dc[0], dc[1], dc[2]) ;
				rdc = r * rdc ;
				p.rotatedDiffCoord[d] = PFP2::VEC3(rdc[0], rdc[1], rdc[2]) ;

	//			Eigen::Vector3f rdc = Eigen::Vector3f::Zero() ;
	//			Dart it = d ;
	//			PFP::REAL vArea = p.vertexArea[d] ;
	//			Eigen::Matrix3f& rotM = p.vertexRotationMatrix[d] ;
	//			PFP::REAL val = 0 ;
	//			do
	//			{
	//				Dart ddn = map->phi1(it) ;
	//				PFP::REAL w = p.edgeWeight[it] / vArea ;
	//				PFP::VEC3 vv = (p.positionInit[ddn] - p.positionInit[it]) * w ;
	//				val += w ;
	//				Eigen::Matrix3f r = 0.5f * (p.vertexRotationMatrix[ddn] + rotM) ;
	//				Eigen::Vector3f vvr = r * Eigen::Vector3f(vv[0], vv[1], vv[2]) ;
	//				rdc += vvr ;
	//				Dart dboundary = map->phi_1(it) ;
	//				if(map->phi2(dboundary) == dboundary)
	//				{
	//					w = p.edgeWeight[dboundary] / vArea ;
	//					vv = (p.positionInit[dboundary] - p.positionInit[it]) * w ;
	//					val += w ;
	//					r = 0.5f * (p.vertexRotationMatrix[dboundary] + rotM) ;
	//					vvr = r * Eigen::Vector3f(vv[0], vv[1], vv[2]) ;
	//					rdc += vvr ;
	//				}
	//				it = map->alpha1(it) ;
	//			} while(it != d) ;
	//			rdc /= val ;
	//			p.rotatedDiffCoord[d] = PFP::VEC3(rdc[0], rdc[1], rdc[2]) ;
			}
		}

		nlMakeCurrent(p.nlContext);
Pierre Kraemer's avatar
Pierre Kraemer committed
534
		if (nlGetCurrentState() == NL_STATE_INITIAL)
535
			nlBegin(NL_SYSTEM);
Pierre Kraemer's avatar
Pierre Kraemer committed
536
		for (int coord = 0; coord < 3; ++coord)
537
		{
538
			LinearSolving::setupVariables<PFP2>(*map, p.vIndex, p.freeSelector->getMarker(), p.positionAttribute, coord);
539 540 541 542 543 544 545 546
			nlBegin(NL_MATRIX);
	//		LinearSolving::addRowsRHS_Laplacian_Cotan<PFP2>(*map, p.vIndex, p.edgeWeight, p.vertexArea, p.rotatedDiffCoord, coord);
			LinearSolving::addRowsRHS_Laplacian_Topo<PFP2>(*map, p.vIndex, p.rotatedDiffCoord, coord);
			nlEnd(NL_MATRIX);
			nlEnd(NL_SYSTEM);
			nlSolve();
			LinearSolving::getResult<PFP2>(*map, p.vIndex, p.positionAttribute, coord);
			nlReset(NL_TRUE);
547 548 549
		}
	}
}
Sylvain Thery's avatar
Sylvain Thery committed
550 551 552 553 554
#if CGOGN_QT_DESIRED_VERSION == 5
	Q_PLUGIN_METADATA(IID "CGoGN.SCHNapps.Plugin")
#else
	Q_EXPORT_PLUGIN2(Surface_Deformation_Plugin, Surface_Deformation_Plugin)
#endif
555 556 557 558

} // namespace SCHNApps

} // namespace CGoGN