[vtkusers] scatter3

Amy Henderson amy.henderson at kitware.com
Tue Jun 1 16:18:26 EDT 2004


Hi John,

You should create a vtkPolyData with your X, Y, Z tuples as points, and add 
a vertex cell per point. If you really want a sphere at each point, then 
run the poly data through a vtkGlyph3D with the source set to the output of 
vtkSphereSource.

- Amy

At 03:49 PM 6/1/2004, John Hunter wrote:

>I need to plot a 3D scatter plot.  I have a sequence of x,y,z,
>tuples.  Currently I am plotting a bunch of spheres, but seem to be
>hitting the wall performance wise with 20000+ points
>
>What is the most efficient way to do a large scatter in VTK.  I
>initially thought vtkPointSource was what I was looking for but then
>discovered it generates random points.
>
>Here is what I am doing currently:
>
>def scatter3(pnts):
>     window, renwin, renderer = _get_gtkvtk_stuff()
>     for x,y,z in pnts:
>         pnt = vtk.vtkSphereSource()
>         res = 20
>         pnt.SetThetaResolution(res)
>         pnt.SetPhiResolution(res)
>         pnt.SetCenter(x,y,z)
>         pnt.SetRadius(10)
>
>         mapper = vtk.vtkPolyDataMapper()
>         mapper.SetInput(pnt.GetOutput())
>
>         actor = vtk.vtkActor()
>         actor.SetMapper(mapper)
>         actor.GetProperty().SetColor( 0,1,1 )
>         renderer.AddActor(actor)
>     window.show()
>
>Thanks,
>JDH
>_______________________________________________
>This is the private VTK discussion list.
>Please keep messages on-topic. Check the FAQ at: 
><http://public.kitware.com/cgi-bin/vtkfaq>
>Follow this link to subscribe/unsubscribe:
>http://www.vtk.org/mailman/listinfo/vtkusers






More information about the vtkusers mailing list