[vtkusers] vtkPolyData RemoveDeletedCells() reorders vtkIdType cellid, so my indexes to them are no longer correct.
da xu
remywendy at gmail.com
Wed Aug 12 21:04:04 EDT 2009
Hi all,
I have some cells in a vtkPolyData where I also have a std::list of their
index in my program. Sometimes, I want to delete some of these cells, but
when I call RemoveDeletedCells the cells in my vtkPolyData get re-ordered,
so my std::list index to them are no longer correct.
My question is there another way to keep track of which cell is which cell
if I do call RemoveDeletedCells and get rid of some of them? Such as a
pointer to each cell within my vtkPolyData...
Relevant code below:
pointArray is of vtkPoints
cellArray is of vtkCellArray
I keep a list of actorIndex to refer to each cell. (each cell is basically
just the point i want to display on the render window). So when I delete
actorIndex 10, the old actorIndex 11 becomes 10, and when I try to delete 11
I get an error....
AddPoint(double pt[3]) {
int actorIndex = pointArray->InsertNextPoint(pt);
polyData->SetPoints(pointArray);
int n = pointArray->GetNumberOfPoints() - 1; // Subtract one for the
correct array index
cellArray->InsertNextCell(1, &n);
polyData->SetVerts(cellArray);
if (n==0) {
polyMapper->SetInput(polyData);
actor->SetMapper(polyMapper);
actor->GetProperty()->SetRepresentationToPoints();
renderer->AddActor(actor);
}
polyData->Modified();
...
Any help/clue/pointer is appreciated!
-Will
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090812/c73374ff/attachment.htm>
More information about the vtkusers
mailing list