[vtkusers] numpy_to_vtk and vtkPolyData

Philip Winston pwinston at gmail.com
Sat Oct 29 16:48:39 EDT 2011


Are there any examples showing how to populate a vtkPolyData with
verts/triangles from numpy arrays?

I have a solution right now where I loop through by hand adding points and
triangles, but it is slow.

I see there is a numpy_to_vtk utility function, but I'm not clear how to
setup my numpy arrays and what vtkPolyData functions I need to call.  I'm
imagining I want one Nx3 array with a vert per row (X Y Z).  And a second
Nx3 array of vert indexes with one triangle per row (v1 v2 v3)?  But I can
create whatever numpy arrays are needed, I just need help slurping them
into a vtkPolyData.

Thanks!

-Philip
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20111029/708c8541/attachment.htm>


More information about the vtkusers mailing list