[vtkusers] Accessing polygon vertices from SphereSource

John Biddiscombe jbiddiscombe at skippingmouse.co.uk
Sat Jun 9 07:26:11 EDT 2001


>
>   vtkSphereSource sphere = new vtkSphereSource();
>   sphere.SetRadius(5.0);
>   sphere.SetThetaResolution(18);
>   sphere.SetPhiResolution(18);

sphere->Update();
Causes the source to execute and generate the points. Polydatamapper does 
this implicitly when the screen asks for a repaint...

>   vtkPolyData poly = sphere.GetOutput();
>   vtkCellArray verts = poly.GetVerts();
>
>
>   System.out.println("points (poly) = " + poly.GetNumberOfPoints());
>   System.out.println("vertices (poly) = " +poly.GetNumberOfVerts());
>   System.out.println("cells (verts) = " + verts.GetNumberOfCells());
>   System.out.println("cells (poly) = " + poly.GetNumberOfCells());
>   System.out.println("lines (poly) = " + poly.GetNumberOfLines());
>   System.out.println("polys(poly) = " + poly.GetNumberOfPolys());
>
>When I run the program all these numbers come out to zero, so
>apparently there are no vertices to modify! But I can use sphere as
>input to a vtkPolyDataMapper and it displays the correct shape.
>Am I looking in the wrong place for the vertices?
>
>Thanks,
>
>
>Phil Cook
>
>
>
>_______________________________________________
>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://public.kitware.com/mailman/listinfo/vtkusers





More information about the vtkusers mailing list