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

#include "Algo/Geometry/normal.h"
#include "Algo/Geometry/laplacian.h"
Sylvain Thery's avatar
Sylvain Thery committed
5
#include "Algo/LinearSolving/basic.h"
6

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

9 10
#include "camera.h"

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

namespace CGoGN
{

namespace SCHNApps
{

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

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

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

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

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

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

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

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

			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();

70
			nb_vertices = Algo::Topo::computeIndexCells<VERTEX>(*map, vIndex);
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 115

			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()
{
116
	//	magic line that init static variables of GenericMap in the plugins
Pierre Kraemer's avatar
Pierre Kraemer committed
117
	GenericMap::copyAllStatics(m_schnapps->getStaticPointers());
118

119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138
	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*)));
}

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

143 144 145 146 147 148
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
149
			if(mh)
150
			{
Pierre Kraemer's avatar
Pierre Kraemer committed
151 152
				const MapParameters& p = h_parameterSet[mh];
				if(!m_dragging)
153
				{
Pierre Kraemer's avatar
Pierre Kraemer committed
154 155 156 157 158
					if(p.handleSelector && !p.handleSelector->getSelectedCells().empty())
					{
						m_dragging = true;
						m_draginit = false;
						view->setMouseTracking(true);
159
						view->getCurrentCamera()->disableViewsBoundingBoxFitting();
Pierre Kraemer's avatar
Pierre Kraemer committed
160 161 162 163 164
					}
				}
				else
				{
					m_dragging = false;
165
					m_draginit = false;
Pierre Kraemer's avatar
Pierre Kraemer committed
166
					view->setMouseTracking(false);
167
					view->getCurrentCamera()->enableViewsBoundingBoxFitting();
168 169
				}
			}
170 171
			break;
		}
Pierre Kraemer's avatar
Pierre Kraemer committed
172

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

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

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

199
		if (!m_draginit)
200 201
		{
			m_dragZ = 0;
202
			for (std::vector<Vertex>::const_iterator it = handle.begin(); it != handle.end(); ++it)
203 204 205 206 207 208
			{
				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();
209

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

213 214 215 216 217 218 219 220 221
			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);
222
			for (std::vector<Vertex>::const_iterator it = handle.begin(); it != handle.end(); ++it)
223
				p.positionAttribute[*it] += t;
224

225
			m_dragPrevious = qq;
226

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

		view->updateGL();
	}
}





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

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&)));
257
	connect(map, SIGNAL(selectedCellsChanged(CellSelectorGen*)), this, SLOT(selectedCellsChanged(CellSelectorGen*)));
258 259 260 261 262 263 264
}

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&)));
265
	disconnect(map, SIGNAL(selectedCellsChanged(CellSelectorGen*)), this, SLOT(selectedCellsChanged(CellSelectorGen*)));
266 267 268 269 270 271 272 273 274
}





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

276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295
	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];
296
	if(p.handleSelector->getName() == name)
297 298 299 300
	{
		p.stop(map);
		if(!p.initialized && map->isSelectedMap())
			m_dockTab->mapParametersInitialized(false);
301
		p.handleSelector = NULL;
302
	}
303
	if(p.freeSelector->getName() == name)
304 305 306 307
	{
		p.stop(map);
		if(!p.initialized && map->isSelectedMap())
			m_dockTab->mapParametersInitialized(false);
308
		p.freeSelector = NULL;
309 310 311
	}
}

312
void Surface_Deformation_Plugin::selectedCellsChanged(CellSelectorGen* cs)
313
{
314 315 316 317 318 319 320
	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) ;
	}
321 322 323 324 325 326 327 328 329 330 331 332 333 334
}





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
335 336
			MapHandler<PFP2>* mh = static_cast<MapHandler<PFP2>*>(m);
			p.positionAttribute = mh->getAttribute<PFP2::VEC3, VERTEX>(name);
337 338 339 340 341 342
			if(m->isSelectedMap())
				m_dockTab->updateMapParameters();
		}
	}
}

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

359
void Surface_Deformation_Plugin::changeFreeSelector(const QString& map, const QString& name)
360 361 362 363 364 365 366
{
	MapHandlerGen* m = m_schnapps->getMap(map);
	if(m)
	{
		MapParameters& p = h_parameterSet[m];
		if(!p.initialized)
		{
Pierre Kraemer's avatar
Pierre Kraemer committed
367 368
			MapHandler<PFP2>* mh = static_cast<MapHandler<PFP2>*>(m);
			p.freeSelector = mh->getCellSelector<VERTEX>(name);
369 370 371 372 373 374 375 376 377 378 379 380 381 382 383
			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
384
		if (!p.initialized)
385 386
		{
			p.start(map);
Pierre Kraemer's avatar
Pierre Kraemer committed
387
			if (p.initialized && map->isSelectedMap())
388 389 390 391 392
				m_dockTab->mapParametersInitialized(true);
		}
		else
		{
			p.stop(map);
Pierre Kraemer's avatar
Pierre Kraemer committed
393
			if (!p.initialized && map->isSelectedMap())
394 395 396 397 398 399 400 401 402 403 404
				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
405
	if (nlGetCurrentState() == NL_STATE_INITIAL)
406
		nlBegin(NL_SYSTEM) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
407
	for (int coord = 0; coord < 3; ++coord)
408
	{
Sylvain Thery's avatar
Sylvain Thery committed
409
		Algo::LinearSolving::setupVariables<PFP2>(*map, p.vIndex, p.freeSelector->getMarker(), p.positionAttribute, coord);
410
		nlBegin(NL_MATRIX);
Sylvain Thery's avatar
Sylvain Thery committed
411
		Algo::LinearSolving::addRowsRHS_Laplacian_Topo<PFP2>(*map, p.vIndex, p.diffCoord, coord);
412 413 414
		nlEnd(NL_MATRIX);
		nlEnd(NL_SYSTEM);
		nlSolve();
Sylvain Thery's avatar
Sylvain Thery committed
415
		Algo::LinearSolving::getResult<PFP2>(*map, p.vIndex, p.positionAttribute, coord);
416 417 418 419 420 421 422 423 424
		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
425
	if (p.initialized)
426
	{
Pierre Kraemer's avatar
Pierre Kraemer committed
427
		CellMarkerNoUnmark<PFP2::MAP, VERTEX> m(*map) ;
428

Pierre Kraemer's avatar
Pierre Kraemer committed
429
		for (Dart d = map->begin(); d != map->end(); map->next(d))
430
		{
Pierre Kraemer's avatar
Pierre Kraemer committed
431
			if (!m.isMarked(d))
432 433 434 435 436 437 438 439 440 441 442 443 444
			{
				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
445 446
					for (unsigned int i = 0; i < 3; ++i)
						for (unsigned int j = 0; j < 3; ++j)
447 448
							cov(i,j) += v[i] * vv[j];// * perMap->edgeWeight[it] / area ;
					Dart dboundary = map->phi_1(it) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
449
					if (map->phi2(dboundary) == dboundary)
450 451 452 453 454 455 456 457
					{
						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
458
				} while (it != d) ;
459 460 461 462

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

				p.vertexRotationMatrix[d] = R ;
			}
		}

Pierre Kraemer's avatar
Pierre Kraemer committed
475
		for (Dart d = map->begin(); d != map->end(); map->next(d))
476
		{
Pierre Kraemer's avatar
Pierre Kraemer committed
477
			if (m.isMarked(d))
478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494
			{
				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
495
				} while (it != d) ;
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 534
				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
535
		if (nlGetCurrentState() == NL_STATE_INITIAL)
536
			nlBegin(NL_SYSTEM);
Pierre Kraemer's avatar
Pierre Kraemer committed
537
		for (int coord = 0; coord < 3; ++coord)
538
		{
Sylvain Thery's avatar
Sylvain Thery committed
539
			Algo::LinearSolving::setupVariables<PFP2>(*map, p.vIndex, p.freeSelector->getMarker(), p.positionAttribute, coord);
540 541
			nlBegin(NL_MATRIX);
	//		LinearSolving::addRowsRHS_Laplacian_Cotan<PFP2>(*map, p.vIndex, p.edgeWeight, p.vertexArea, p.rotatedDiffCoord, coord);
Sylvain Thery's avatar
Sylvain Thery committed
542
			Algo::LinearSolving::addRowsRHS_Laplacian_Topo<PFP2>(*map, p.vIndex, p.rotatedDiffCoord, coord);
543 544 545
			nlEnd(NL_MATRIX);
			nlEnd(NL_SYSTEM);
			nlSolve();
Sylvain Thery's avatar
Sylvain Thery committed
546
			Algo::LinearSolving::getResult<PFP2>(*map, p.vIndex, p.positionAttribute, coord);
547
			nlReset(NL_TRUE);
548 549 550
		}
	}
}
Sylvain Thery's avatar
Sylvain Thery committed
551 552 553 554 555
#if CGOGN_QT_DESIRED_VERSION == 5
	Q_PLUGIN_METADATA(IID "CGoGN.SCHNapps.Plugin")
#else
	Q_EXPORT_PLUGIN2(Surface_Deformation_Plugin, Surface_Deformation_Plugin)
#endif
556 557 558 559

} // namespace SCHNApps

} // namespace CGoGN