diff --git a/src/meshlabplugins/filter_sampling/filter_sampling.cpp b/src/meshlabplugins/filter_sampling/filter_sampling.cpp
index 3643c7737..5f39c3db5 100644
--- a/src/meshlabplugins/filter_sampling/filter_sampling.cpp
+++ b/src/meshlabplugins/filter_sampling/filter_sampling.cpp
@@ -529,6 +529,9 @@ void FilterDocSampling::initParameterSet(QAction *action, MeshDocument & md, Ric
parlst.addParam(new RichBool("Subsample", false, "Base Mesh Subsampling", "If true the original vertices of the base mesh are used as base set of points. In this case the SampleNum should be obviously much smaller than the original vertex number.
Note that this option is very useful in the case you want to subsample a dense point cloud."));
parlst.addParam(new RichBool("RefineFlag", false, "Refine Existing Samples", "If true the vertices of the below mesh are used as starting vertices, and they will utterly refined by adding more and more points until possible. "));
parlst.addParam(new RichMesh("RefineMesh", md.mm(),&md, "Samples to be refined", "Used only if the above option is checked. "));
+ parlst.addParam(new RichBool("BestSampleFlag", true, "Best Sample Heuristic", "If true it will use an heuristic for choosing the samples that at a small cost can improve the maximality of the generated sampling. It can slow a bit the process. "));
+ parlst.addParam(new RichInt("BestSamplePool", 10, "Best Sample Pool Size", "Used only if the Best Sample Flag is true. It control the number of attempt that it makes to get the best sample. It is reasonable that it is smaller than the Montecarlo oversampling factor."));
+
break;
case FP_VARIABLEDISK_SAMPLING :
parlst.addParam(new RichInt("SampleNum", 1000, "Number of samples", "The desired number of samples. The ray of the disk is calculated according to the sampling density."));
@@ -876,6 +879,8 @@ bool FilterDocSampling::applyFilter(QAction *action, MeshDocument &md, RichParam
pp.preGenMesh=&(par.getMesh("RefineMesh")->cm);
}
pp.geodesicDistanceFlag=par.getBool("ApproximateGeodesicDistance");
+ pp.bestSampleChoiceFlag=par.getBool("BestSampleFlag");
+ pp.bestSamplePoolSize =par.getInt("BestSamplePool");
}
tri::SurfaceSampling::PoissonDiskPruning(mps, *presampledMesh, radius,pp);
//tri::SurfaceSampling::PoissonDisk(curMM->cm, mps, *presampledMesh, radius,pp);
@@ -1055,7 +1060,9 @@ bool FilterDocSampling::applyFilter(QAction *action, MeshDocument &md, RichParam
tri::ClusteringSampler vc(seedVec);
if(randSeed!=0) tri::SurfaceSampling >::SamplingRandomGenerator().initialize(randSeed);
tri::SurfaceSampling >::VertexUniform(*cm,vc,sampleNum);
- tri::VoronoiProcessing::VoronoiRelaxing(*cm, seedVec, relaxIter,90,cb);
+ tri::EuclideanDistance edFunc;
+ tri::VoronoiProcessingParameter vpp;
+ tri::VoronoiProcessing::VoronoiRelaxing(*cm, seedVec, relaxIter, edFunc, vpp, cb);
//VoronoiProcessing::VoronoiClustering(*cm,clusteredMesh->cm,seedVec);
@@ -1081,7 +1088,8 @@ bool FilterDocSampling::applyFilter(QAction *action, MeshDocument &md, RichParam
vector vecV; // points to vertexes of ColoredMesh;
tri::VoronoiProcessing::SeedToVertexConversion (mmM->cm, vecP, vecV);
Log("Converted %ui points into %ui vertex ",vecP.size(),vecV.size());
- tri::VoronoiProcessing::ComputePerVertexSources(mmM->cm,vecV);
+ tri::EuclideanDistance edFunc;
+ tri::VoronoiProcessing::ComputePerVertexSources(mmM->cm,vecV,edFunc);
for(uint i=0;iC()=Color4b::Red;
tri::VoronoiProcessing::VoronoiColoring(mmM->cm, vecV,backwardFlag);