[vtkusers] deleting point

<bourouis.sami@voila.fr bourouis.sami at voila.fr
Wed Jun 23 12:42:04 EDT 2004


hello all,
I tried to test this function that should remove
a point and all incident cells:
- get all cells incident to the point;
- for each cell in the above set
- - remove the cell
- remove the point.

        void removePoint(int pointIndex, vtkPolyData p)
        {
            vtkIdList adjacentCells = vtkIdList.New();
            p.GetPointCells(pointIndex, adjacentCells);

            int nrPoints = p.GetNumberOfPoints();

            int nrAdjCells = adjacentCells.GetNumberOfIds();
            for (int i=0; i<nrAdjCells; i++)
            {
                int cellId = adjacentCells.GetId(i);
                p.RemoveReferenceToCell(pointIndex, cellId);
                p.RemoveCellReference(cellId);
                p.DeleteCell(cellId);
            }
            p.DeletePoint(pointIndex);

            nrPoints = p.GetNumberOfPoints();
        }

This function does _not_ work To give an idea, I added the variable 
nrPoints. In the examples that I tried, after the last line, the value of nrPoints
does not change .
the poly data has the same number of points as before.
------------------------------------------

Faites un voeu et puis Voila ! www.voila.fr 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20040623/a1693ff6/attachment.htm>


More information about the vtkusers mailing list