[vtkusers] vtkCleanPolyData crashes when I try to get the output

Patrik Andersson patrik.andersson.se at gmail.com
Tue Jun 10 01:35:13 EDT 2014


Hi,

I recently start to use VTK in purpose to use its function for cleaning up
a polygon mesh, which has duplicated vertices and too many small triangles.
I were aiming to use VTK built in methods vtkCleanPolyData and
vtkDecimatePro.

I use the following code snippet to clean the mesh.

[code]
vtkSmartPointer<vtkPolyData> vtk_polydata(
vtkSmartPointer<vtkPolyData>::New() );
vtkSmartPointer<vtkPolyData> vtk_cleanedPoly(
vtkSmartPointer<vtkPolyData>::New() );
vtk_polydata->SetPoints(vtk_points);
vtk_polydata->SetPolys(vtk_polys);
vtk_polydata->Update();
vtkSmartPointer<vtkCleanPolyData> vtk_cleanPolyData(
vtkSmartPointer<vtkCleanPolyData>::New() );

vtk_cleanPolyData->SetInput( vtk_polydata );
vtk_cleanPolyData->SetTolerance(0.1);
vtk_cleanPolyData->SetAbsoluteTolerance(0.1);
vtk_cleanPolyData->PointMergingOn();
vtk_cleanPolyData->Update();
//vtk_cleanPolyData->SetOutput( vtk_cleanedPoly );
 vtk_cleanedPoly->SetPoints( vtk_cleanPolyData->GetOutput()->GetPoints() );
vtk_cleanedPoly->SetPolys( vtk_cleanPolyData->GetOutput()->GetPolys() );
//vtk_cleanedPoly->ShallowCopy( vtk_cleanPolyData->GetOutput() );

vtkSmartPointer<vtkDecimatePro> vtk_decimate(
vtkSmartPointer<vtkDecimatePro>::New() );
vtk_decimate->SetTargetReduction(0.50);
vtk_decimate->SetInput( vtk_cleanedPoly );
vtk_decimate->Update();

//vtkSmartPointer<vtkPolyData> vtk_decimated(  );
vtk_mesh->ShallowCopy( vtk_decimate->GetOutput() );
[/code]

When it reaches the lines where vtk_cleanPolyData->Update() it crashes.

What am I doing wrong? I'm using VTK 5.8

Kind regards
Patrik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20140610/7f00c232/attachment.html>


More information about the vtkusers mailing list