[vtkusers] Deleting points form vtkPolyData object

Lodron, Gerald Gerald.Lodron at joanneum.at
Mon Nov 2 03:30:41 EST 2009


Hello,
 
I stored a point list into the vtkPolyData object using these lines:
 
//m_Points ... vtkPolyData Object pointer
//m_daPointPosition ... Three dimensional double array specifying x,y and z coordinate of the point

m_Points->GetPoints()->InsertNextPoint(m_daPointPosition);
m_Points->GetVerts()->InsertNextCell(1);
m_Points->GetVerts()->InsertCellPoint(m_Points->GetPoints()->GetNumberOfPoints()-1);
m_Points->Update();

This works fine, I also can visualize it. Now I want to delete a specific point, e.g. the second point which was inserted, but I always get a null pointer exception:
 
m_Points->DeletePoint(1); //Null pointer exception
m_Points->DeleteCell(1);

vtkCleanPolyData *Cleaner = vtkCleanPolyData::New();
Cleaner->SetInput(m_Points);
Cleaner->Update();

m_Points = Cleaner->GetOutput();
m_Points->Update();
m_Points->BuildCells();
m_Points->BuildLinks();

Cleaner = NULL;	//Use smart pointers to delete
 
 
Have anybody a suggestion what i made false?



More information about the vtkusers mailing list