changed the strategy to find point to fix in an automatic way, and some minor changes in comments

This commit is contained in:
Nico Pietroni 2013-02-19 13:53:33 +00:00
parent 8111bcda24
commit 1f91e92f9a
1 changed files with 729 additions and 712 deletions

View File

@ -26,6 +26,8 @@
#define EIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET
#include <eigenlib/Eigen/Sparse>
//#include <eigenlib/Eigen/SparseCore>
//#include <eigenlib/Eigen/SparseCholesky>
#include <eigenlib/unsupported/Eigen/SparseExtra>
#include <time.h>
@ -34,9 +36,10 @@
#include <vcg/complex/algorithms/update/flag.h>
#include <vcg/complex/algorithms/update/bounding.h>
#include <vcg/complex/algorithms/parametrization/distortion.h>
#include <vcg/complex/algorithms/parametrization/uv_utils.h>
namespace vcg {
namespace tri{
namespace tri{
template <class MeshType>
class PoissonSolver
{
@ -60,7 +63,7 @@ class PoissonSolver
///unknown vector
Eigen:: DynamicSparseMatrix<double> A; // A
Eigen::DynamicSparseMatrix<double> A; // A
Eigen::VectorXd b,x;// x and b
//number of variables
@ -158,7 +161,13 @@ class PoissonSolver
if (vt1->IsD())continue;
if (!vt0->IsB())continue;
if (!vt1->IsB())continue;
ScalarType d_test=(vt0->P()-vt1->P()).Norm();
// ScalarType d_test=(vt0->P()-vt1->P()).Norm();
ScalarType Dx=fabs(vt0->P().X()-vt1->P().X());
ScalarType Dy=fabs(vt0->P().Y()-vt1->P().Y());
ScalarType Dz=fabs(vt0->P().Z()-vt1->P().Z());
// ScalarType d_test=std::max(Dx,std::max(Dy,Dz));
ScalarType d_test=std::max(fabs(Dx-Dy),std::max(fabs(Dx-Dz),fabs(Dy-Dz)));
if (d_test>dmax)
{
dmax=d_test;
@ -586,12 +595,20 @@ public:
{
tri::UpdateTopology<MeshType>::FaceFace(mesh);
int NNmanifoldE=tri::Clean<MeshType>::CountNonManifoldEdgeFF(mesh);
if (NNmanifoldE!=0)return false;
if (NNmanifoldE!=0)
{
printf("Non Manifold");
return false;
}
/*int NNmanifoldV=tri::Clean<MeshType>::CountNonManifoldVertexFF(mesh);
if (NNmanifoldV!=0)return false;*/
int G=tri::Clean<MeshType>::MeshGenus(mesh);
int numholes=tri::Clean<MeshType>::CountHoles(mesh);
if (numholes==0) return false;
if (numholes==0)
{
printf("Non omeomorph to a disc");
return false;
}
return (G==0);
}
@ -688,7 +705,7 @@ public:
FindFarthestVert(v0,v1);
if (v0==v1)
{
// tri::io::ExporterPLY<MeshType>::Save(mesh,"./parametrized.ply");
// tri::io::ExporterPLY<MeshType>::Save(mesh,"./parametrized.ply");
assert(0);
}
v0->T().P()=Point2<ScalarType>(0,0);
@ -812,7 +829,7 @@ public:
}
}; // end class
} //End Namespace Tri
}; // end class
} //End Namespace Tri
} // End Namespace vcg
#endif