[vtkusers] Removing and replacing a set of cells
eldridgejm
eldridgejm at gmail.com
Sat Feb 1 10:25:39 EST 2014
I am using VTK to visualize a surface. When the user triggers an event, I'd
like to remove a connected part of the surface and replace it. To make
things clear, I've made some (admittedly poor) drawings of a very simple
example:
Suppose my polyData consists of the following 10 points as viewed from
above: http://imgur.com/U4uTUOQ
Initially, my surface looks like this: http://imgur.com/xhQYqKs
All points are included, except for point 9.
Upon the user triggering an event, I would like to redraw the surface so
that it looks like this: http://imgur.com/rzzPPTK
That is, the topology is changed to include point 9, but not point 8.
When the selection is made, I know precisely which triangles to delete from
the polyData: (4,5,8), (5,6,8), (6,7,8), and (7,4,8). I can delete these
with DeleteCells, then update the polyData to reflect the new topology by
inserting the triangles: (4,5,9), (5,6,9), (6,7,9), and (7,4,9).
This method has a problem, however: DeleteCells requires that I specify the
Ids of the cells I'd like to delete. When I construct the surface, I keep
track of the ids of the triangles I create so that when the user triggers
the action, I know exactly which ids correspond to the triangles that need
to be deleted. After deleting cells, however, these ids will be stale. This
is an issue if the user would like to trigger the event on multiple parts of
the surface: the first event will be handled correctly, but upon triggering
the second event, I do not have a valid listing of the cells which I should
delete. Updating the ids after the first deletion would appear to be both
tedious and computationally inefficient.
The alternative, it seems, is to completely clear the polyData's polygons
and insert all of the polygons again, which requires no reference to the
cell ids. This method strikes me as inefficient as well, and I think that
there is likely a better way. What would be the natural way to accomplish
this?
--
View this message in context: http://vtk.1045678.n5.nabble.com/Removing-and-replacing-a-set-of-cells-tp5725743.html
Sent from the VTK - Users mailing list archive at Nabble.com.
More information about the vtkusers
mailing list