voronoi remesher tweaked
This commit is contained in:
parent
54d19e3059
commit
6011f049fc
vcg/complex/algorithms
|
@ -133,7 +133,7 @@ protected:
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static const int VoroRelaxationStep = 20;
|
static const int VoroRelaxationStep = 30;
|
||||||
|
|
||||||
///
|
///
|
||||||
/// \brief Remesh the main function that remeshes a mesh preserving creases.
|
/// \brief Remesh the main function that remeshes a mesh preserving creases.
|
||||||
|
@ -355,7 +355,7 @@ protected:
|
||||||
|
|
||||||
// refine to obtain a base mesh
|
// refine to obtain a base mesh
|
||||||
VoronoiProcessingParameter vpp;
|
VoronoiProcessingParameter vpp;
|
||||||
vpp.refinementRatio = 4.0f;
|
vpp.refinementRatio = 5.0f;
|
||||||
Voronoi::PreprocessForVoronoi(baseMesh, samplingRadius, vpp);
|
Voronoi::PreprocessForVoronoi(baseMesh, samplingRadius, vpp);
|
||||||
|
|
||||||
// Poisson sampling preserving border
|
// Poisson sampling preserving border
|
||||||
|
@ -372,7 +372,15 @@ protected:
|
||||||
|
|
||||||
// Montecarlo oversampling
|
// Montecarlo oversampling
|
||||||
Mesh montecarloMesh;
|
Mesh montecarloMesh;
|
||||||
int poissonCount = SurfaceSampler::ComputePoissonSampleNum(original, samplingRadius) * 0.7;
|
// const int poissonCount = SurfaceSampler::ComputePoissonSampleNum(original, samplingRadius)/* * 0.7*/;
|
||||||
|
int poissonCount = 0;
|
||||||
|
{
|
||||||
|
const ScalarType meshArea = Stat<Mesh>::ComputeMeshArea(original);
|
||||||
|
const ScalarType meshBoundary = Stat<Mesh>::ComputeBorderLength(original);
|
||||||
|
const double factor = math::Sqrt(3)/2;
|
||||||
|
const ScalarType areaPerSample = samplingRadius*samplingRadius * factor;
|
||||||
|
poissonCount = meshArea / areaPerSample - meshBoundary * samplingRadius * factor * 0.5; // totalArea / (r^2 * sqrt(3)/2) - (totalBoundary * r * sqrt(3)/4)
|
||||||
|
}
|
||||||
|
|
||||||
// std::cout << "poisson Count: " << poissonCount << std::endl;
|
// std::cout << "poisson Count: " << poissonCount << std::endl;
|
||||||
if (poissonCount <= 0)
|
if (poissonCount <= 0)
|
||||||
|
@ -386,7 +394,7 @@ protected:
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Montecarlo poisson sampling
|
// Montecarlo poisson sampling
|
||||||
SurfaceSampler::MontecarloPoisson(original, mps, poissonCount * 20);
|
SurfaceSampler::MontecarloPoisson(original, mps, poissonCount * 40);
|
||||||
BuildMeshFromCoordVector(montecarloMesh,sampleVec);
|
BuildMeshFromCoordVector(montecarloMesh,sampleVec);
|
||||||
|
|
||||||
#ifdef DEBUG_VORO
|
#ifdef DEBUG_VORO
|
||||||
|
@ -421,6 +429,7 @@ protected:
|
||||||
vpp.seedPerturbationProbability = 0.0f;
|
vpp.seedPerturbationProbability = 0.0f;
|
||||||
Voronoi::RestrictedVoronoiRelaxing(baseMesh, seedPointVec, seedFixedVec, VoroRelaxationStep, vpp);
|
Voronoi::RestrictedVoronoiRelaxing(baseMesh, seedPointVec, seedFixedVec, VoroRelaxationStep, vpp);
|
||||||
|
|
||||||
|
|
||||||
#ifdef DEBUG_VORO
|
#ifdef DEBUG_VORO
|
||||||
BuildMeshFromCoordVector(poissonMesh,seedPointVec);
|
BuildMeshFromCoordVector(poissonMesh,seedPointVec);
|
||||||
io::ExporterPLY<MeshType>::Save(poissonMesh, QString("relaxedMesh_%1.ply").arg(idx).toStdString().c_str());
|
io::ExporterPLY<MeshType>::Save(poissonMesh, QString("relaxedMesh_%1.ply").arg(idx).toStdString().c_str());
|
||||||
|
|
Loading…
Reference in New Issue