[vtkusers] Deleting points form vtkPolyData object

Lodron, Gerald Gerald.Lodron at joanneum.at
Tue Nov 3 09:43:42 EST 2009


I am new with VTK but i thought i insert points, no lines? Also in the visualization there are only points rendered, no lines!

Can you explain me why i insert lines and what i must do if i want to insert points only?




________________________________
Von: frinxor at gmail.com [mailto:frinxor at gmail.com] Im Auftrag von da
Gesendet: Montag, 02. November 2009 18:24
An: Lodron, Gerald; vtkusers at vtk.org
Betreff: Re: [vtkusers] Deleting points form vtkPolyData object

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<mailto: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<http://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/20091103/dcb7a65d/attachment.htm>


More information about the vtkusers mailing list