[vtkusers] simple question vtkCleanPolyData

Jean-Dominique Barnichon jeando.barnichon at free.fr
Mon Apr 17 16:50:01 EDT 2006


Should be a simple one.
I've got a polydata containing only points (see end of email), some of 
which are duplicate points.
I want to keep only a single point with given coordinates (yes, I know 
that the vtkCleanPolyData filter should do the trick, but I just can 
couldn't get it working so far).
When I run the piece of code given below, the cleaned polydata is empty 
(i.e. it has 0 points), and I don't understand why.
Any Idea?
Jean-Do

Code snippet:
        vtkPolyDataReader *re = vtkPolyDataReader::New();
        re->SetFileName("InitialPolydata.vtk");

        vtkPolyData *pdata = vtkPolyData::New();
        pdata = re->GetOutput();

        // pdata is the vtkPolyData
        vtkCleanPolyData *Clean = vtkCleanPolyData::New();
        Clean->SetInput(pdata);
        Clean->SetTolerance(0.0);
        Clean->PointMergingOn();
        Clean->Update();

        vtkPolyDataWriter *wr = vtkPolyDataWriter::New();
        wr->SetFileName("CleanedPolydata.vtk");
        wr->SetInput(Clean->GetOutput());
        wr->Write();


//beginning_of_file (InitialPolydata.vtk)
# vtk DataFile Version 3.0
vtk output
ASCII
DATASET POLYDATA
POINTS 12 float
3.35936 1.84257 49.9219 6.3551 1.84257 40.9347 17.8945 1.84257 39.9079
17.8945 1.84257 39.9079 25.3551 1.84257 23.6583 25.3551 1.84257 23.6583
34.0223 1.84257 20.6629 34.0223 1.84257 20.6629 36.8945 1.84257 20.1843
45.263 1.84257 1.84257 45.263 1.84257 1.84257 83.3594 1.84257 0

POINT_DATA 12
//end_of_file




More information about the vtkusers mailing list