[vtkusers] Deleting points form vtkPolyData object

da remywendy at gmail.com
Mon Nov 2 12:24:25 EST 2009


Its not clear if you're adding multiple points or not...

Given the code you've included, you're only inserting one point from the
line
m_Points->GetPoints()->InsertNextPoint(m_daPointPosition);
and then deleting the second point (index 1, but you only have index 0),
which would cause a null pointer exception?


If you're adding multiple points in the lines of code that are not included,
make sure to include them.



On Mon, Nov 2, 2009 at 1:30 AM, Lodron, Gerald <Gerald.Lodron at joanneum.at>wrote:

> 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?
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20091102/f212b3f2/attachment.htm>


More information about the vtkusers mailing list