fix for voronoi remesher, again
This commit is contained in:
parent
30dcc87c1a
commit
75eca5e231
|
@ -59,17 +59,26 @@ int main( int argc, char **argv )
|
||||||
if(argc < 2 )
|
if(argc < 2 )
|
||||||
{
|
{
|
||||||
printf("Usage trimesh_voro mesh region_num\n");
|
printf("Usage trimesh_voro mesh region_num\n");
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
printf("Reading %s \n",argv[1]);
|
|
||||||
int ret= tri::io::Importer<MyMesh>::Open(startMesh,argv[1]);
|
|
||||||
if(ret!=0)
|
|
||||||
{
|
|
||||||
printf("Unable to open %s for '%s'\n",argv[1],tri::io::ImporterPLY<MyMesh>::ErrorMsg(ret));
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
float samplingRadius = startMesh.bbox.Diag() *0.02f;
|
printf("Reading %s \n",argv[1]);
|
||||||
auto remeshed = Remesher<MyMesh>::Remesh(startMesh, samplingRadius, 50.0);
|
int ret = tri::io::Importer<MyMesh>::Open(startMesh,argv[1]);
|
||||||
|
if(ret!=0)
|
||||||
|
{
|
||||||
|
printf("Unable to open %s: '%s'\n",argv[1],tri::io::ImporterPLY<MyMesh>::ErrorMsg(ret));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
tri::UpdateBounding<MyMesh>::Box(startMesh);
|
||||||
|
|
||||||
|
float samplingRadius = startMesh.bbox.Diag() * 0.01f;
|
||||||
|
if (argc == 3)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
samplingRadius = stof(string(argv[2]));
|
||||||
|
} catch (exception &) {}
|
||||||
|
}
|
||||||
|
std::cout << "using sampling radius: " << samplingRadius << std::endl;
|
||||||
|
auto remeshed = Remesher<MyMesh>::Remesh(startMesh, samplingRadius, 75.0);
|
||||||
|
|
||||||
|
|
||||||
tri::io::ExporterPLY<MyMesh>::Save(*remeshed,"Full.ply",tri::io::Mask::IOM_VERTCOLOR|tri::io::Mask::IOM_WEDGTEXCOORD );
|
tri::io::ExporterPLY<MyMesh>::Save(*remeshed,"Full.ply",tri::io::Mask::IOM_VERTCOLOR|tri::io::Mask::IOM_WEDGTEXCOORD );
|
||||||
|
|
|
@ -1260,7 +1260,7 @@ static int RestrictedVoronoiRelaxing(MeshType &m, std::vector<CoordType> &seedPo
|
||||||
if(sumVec[i].first != 0)
|
if(sumVec[i].first != 0)
|
||||||
{
|
{
|
||||||
newseedVec.push_back(sumVec[i].second /ScalarType(sumVec[i].first));
|
newseedVec.push_back(sumVec[i].second /ScalarType(sumVec[i].first));
|
||||||
if(vpp.seedPerturbationProbability > RandomGenerator().generate01())
|
if(vpp.seedPerturbationProbability > 0 && (vpp.seedPerturbationProbability > RandomGenerator().generate01()))
|
||||||
newseedVec.back()+=math::GeneratePointInUnitBallUniform<ScalarType,math::MarsenneTwisterRNG>( RandomGenerator())*perturb;
|
newseedVec.back()+=math::GeneratePointInUnitBallUniform<ScalarType,math::MarsenneTwisterRNG>( RandomGenerator())*perturb;
|
||||||
newfixedVec.push_back(false);
|
newfixedVec.push_back(false);
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue