[vtkusers] triangle subdivision from subset of triangles

sebastian_a seb.an at icloud.com
Fri Oct 20 04:48:33 EDT 2017


Hi Kurt,

I tried it using the following solution. Unfortunately the vtkAppendPolyData
filter in the end produces non-manifold edges as it just adds both meshes
together without combining the edges on each border. Also it is not a super
clean solution using a set for the IDs.


ids = set()

selectedPolyData = vtk.vtkPolyData()
selectedPolyData.DeepCopy(originalPolyData)
selectedPolyData.BuildLinks()

unselectedPolyData = vtk.vtkPolyData()
unselectedPolyData.DeepCopy(originalPolyData)
unselectedPolyData.BuildLinks()

for c in xrange(originalPolyData.GetNumberOfCells()):
    cell = originalPolyData.GetCell(c)
    if c in ids:
        unselectedPolyData.DeleteCell(c)
    else:
        selectedPolyData.DeleteCell(c)

selectedPolyData.RemoveDeletedCells()
unselectedPolyData.RemoveDeletedCells()

# subdivide or do whatever with selectedPolyData

append = vtk.vtkAppendPolyData()
append.AddInputData(selectedPolyData)
append.AddInputData(unselectedPolyData)
append.Update()

originalPolyData = append.GetOutput()


- Sebastian



--
Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html


More information about the vtkusers mailing list