[vtkusers] simple question vtkCleanPolyData

Janet Kim janet at dragonflyesque.com
Mon Apr 17 17:06:22 EDT 2006


I tried out vtkCleanPolyData and it looked like you
might need actual geometry for the polydata to clean,
not just points.  When I just had points, I had the
same result.  But once I added the points to cells,
the clean worked.  Maybe someone else can explain a
bit better, unless, I'm wrong.


On Mon, 17 Apr 2006, Jean-Dominique Barnichon wrote:

> 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
>
> _______________________________________________
> This is the private VTK discussion list. Please keep messages on-topic. Check 
> the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>



More information about the vtkusers mailing list