<div dir="ltr">Hi Justin,<div><br></div><div>I've faced the same problem a (long) while ago. Have a look at the vtkCellsFilter and vtkRemoveCellsFilter (its subclass) here: <a href="https://github.com/glawlor/vtkbioeng">https://github.com/glawlor/vtkbioeng</a></div>
<div><br></div><div>hth</div><div><br></div><div>Goodwin</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Feb 1, 2014 at 3:25 PM, eldridgejm <span dir="ltr"><<a href="mailto:eldridgejm@gmail.com" target="_blank">eldridgejm@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I am using VTK to visualize a surface. When the user triggers an event, I'd<br>
like to remove a connected part of the surface and replace it. To make<br>
things clear, I've made some (admittedly poor) drawings of a very simple<br>
example:<br>
<br>
Suppose my polyData consists of the following 10 points as viewed from<br>
above: <a href="http://imgur.com/U4uTUOQ" target="_blank">http://imgur.com/U4uTUOQ</a><br>
<br>
Initially, my surface looks like this: <a href="http://imgur.com/xhQYqKs" target="_blank">http://imgur.com/xhQYqKs</a><br>
All points are included, except for point 9.<br>
<br>
Upon the user triggering an event, I would like to redraw the surface so<br>
that it looks like this: <a href="http://imgur.com/rzzPPTK" target="_blank">http://imgur.com/rzzPPTK</a><br>
That is, the topology is changed to include point 9, but not point 8.<br>
<br>
When the selection is made, I know precisely which triangles to delete from<br>
the polyData: (4,5,8), (5,6,8), (6,7,8), and (7,4,8). I can delete these<br>
with DeleteCells, then update the polyData to reflect the new topology by<br>
inserting the triangles: (4,5,9), (5,6,9), (6,7,9), and (7,4,9).<br>
<br>
This method has a problem, however: DeleteCells requires that I specify the<br>
Ids of the cells I'd like to delete. When I construct the surface, I keep<br>
track of the ids of the triangles I create so that when the user triggers<br>
the action, I know exactly which ids correspond to the triangles that need<br>
to be deleted. After deleting cells, however, these ids will be stale. This<br>
is an issue if the user would like to trigger the event on multiple parts of<br>
the surface: the first event will be handled correctly, but upon triggering<br>
the second event, I do not have a valid listing of the cells which I should<br>
delete. Updating the ids after the first deletion would appear to be both<br>
tedious and computationally inefficient.<br>
<br>
The alternative, it seems, is to completely clear the polyData's polygons<br>
and insert all of the polygons again, which requires no reference to the<br>
cell ids. This method strikes me as inefficient as well, and I think that<br>
there is likely a better way. What would be the natural way to accomplish<br>
this?<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://vtk.1045678.n5.nabble.com/Removing-and-replacing-a-set-of-cells-tp5725743.html" target="_blank">http://vtk.1045678.n5.nabble.com/Removing-and-replacing-a-set-of-cells-tp5725743.html</a><br>
Sent from the VTK - Users mailing list archive at Nabble.com.<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
</blockquote></div><br></div>