voronoi remesher tweaking

This commit is contained in:
Luigi Malomo 2018-05-11 18:58:28 +02:00
parent 578a777245
commit 2451c6b8f9
1 changed files with 12 additions and 6 deletions

View File

@ -31,7 +31,7 @@
#include <vcg/complex/algorithms/voronoi_processing.h> #include <vcg/complex/algorithms/voronoi_processing.h>
#include <vcg/complex/algorithms/point_sampling.h> #include <vcg/complex/algorithms/point_sampling.h>
#include <vcg/complex/algorithms/crease_cut.h> #include <vcg/complex/algorithms/crease_cut.h>
#include <vcg/complex/algorithms/curve_on_manifold.h> //#include <vcg/complex/algorithms/curve_on_manifold.h>
#include <memory> #include <memory>
#include <string> #include <string>
@ -133,7 +133,7 @@ protected:
} }
public: public:
static const int VoroRelaxationStep = 30; static const int VoroRelaxationStep = 40;
/// ///
/// \brief Remesh the main function that remeshes a mesh preserving creases. /// \brief Remesh the main function that remeshes a mesh preserving creases.
@ -326,7 +326,7 @@ protected:
// uniform edge sampling // uniform edge sampling
UpdateTopology<EdgeMeshType>::EdgeEdge(em); UpdateTopology<EdgeMeshType>::EdgeEdge(em);
SurfaceSampling<EdgeMeshType>::EdgeMeshUniform(em, ps, samplingRadius, false); SurfaceSampling<EdgeMeshType>::EdgeMeshUniform(em, ps, samplingRadius, SurfaceSampling<EdgeMeshType>::Round);
BuildMeshFromCoordVector(poissonEdgeMesh, borderSamples); BuildMeshFromCoordVector(poissonEdgeMesh, borderSamples);
UpdateBounding<Mesh>::Box(poissonEdgeMesh); UpdateBounding<Mesh>::Box(poissonEdgeMesh);
@ -355,7 +355,7 @@ protected:
// refine to obtain a base mesh // refine to obtain a base mesh
VoronoiProcessingParameter vpp; VoronoiProcessingParameter vpp;
vpp.refinementRatio = 5.0f; vpp.refinementRatio = 8.0f;
Voronoi::PreprocessForVoronoi(baseMesh, samplingRadius, vpp); Voronoi::PreprocessForVoronoi(baseMesh, samplingRadius, vpp);
// Poisson sampling preserving border // Poisson sampling preserving border
@ -394,7 +394,7 @@ protected:
else else
{ {
// Montecarlo poisson sampling // Montecarlo poisson sampling
SurfaceSampler::MontecarloPoisson(original, mps, poissonCount * 40); SurfaceSampler::MontecarloPoisson(original, mps, poissonCount * 50);
BuildMeshFromCoordVector(montecarloMesh,sampleVec); BuildMeshFromCoordVector(montecarloMesh,sampleVec);
#ifdef DEBUG_VORO #ifdef DEBUG_VORO
@ -405,6 +405,8 @@ protected:
typename SurfaceFixSampler::PoissonDiskParam pp; typename SurfaceFixSampler::PoissonDiskParam pp;
pp.preGenMesh = &poissonEdgeMesh; pp.preGenMesh = &poissonEdgeMesh;
pp.preGenFlag = true; pp.preGenFlag = true;
pp.bestSampleChoiceFlag = true;
pp.bestSamplePoolSize = 100;
SurfaceFixSampler::PoissonDiskPruning(fix_sampler, montecarloMesh, samplingRadius, pp); SurfaceFixSampler::PoissonDiskPruning(fix_sampler, montecarloMesh, samplingRadius, pp);
} }
@ -425,9 +427,13 @@ protected:
return std::make_shared<Mesh>(); return std::make_shared<Mesh>();
} }
// TODO: rimettere a posto
// restricted relaxation with fixed points // restricted relaxation with fixed points
vpp.seedPerturbationProbability = 0.0f; vpp.seedPerturbationProbability = 0.2f;
vpp.seedPerturbationAmount = 0.005f;
Voronoi::RestrictedVoronoiRelaxing(baseMesh, seedPointVec, seedFixedVec, VoroRelaxationStep, vpp); Voronoi::RestrictedVoronoiRelaxing(baseMesh, seedPointVec, seedFixedVec, VoroRelaxationStep, vpp);
vpp.seedPerturbationProbability = 0.0f;
Voronoi::RestrictedVoronoiRelaxing(baseMesh, seedPointVec, seedFixedVec, VoroRelaxationStep/2, vpp);
#ifdef DEBUG_VORO #ifdef DEBUG_VORO