STL使用vtk类降幂

来源:互联网 发布:centos 7 卡在进度条 编辑:程序博客网 时间:2024/05/16 08:03
       QString filePathDown = "D://xxstl";
vSPNew(stlReader, vtkSTLReader);
stlReader->SetFileName(filePathDown.toLatin1().data());
stlReader->Update();


vSPNew(decimate, vtkDecimatePro);
decimate->SetInputData(stlReader->GetOutput());
decimate->SetTargetReduction(0.9); //10% reduction (if there was 100 triangles, now there will be 90)
decimate->Update();


vSPNew(stlWriter, vtkSTLWriter);
stlWriter->SetFileName(filePathDown.toLatin1().data());
stlWriter->SetInputData(decimate->GetOutput());
stlWriter->Update();
stlWriter->Write();
0 0