[vtkusers] Accessing polygon vertices from SphereSource

Sylvain Jaume jaume at tele.ucl.ac.be
Fri Jun 8 13:02:11 EDT 2001


try sphere.Update() before sphere.GetOutput()

Sylvain

On Fri, 8 Jun 2001, Philip Cook wrote:

> On page 107 of the Shroeder book, there is some example code 
> which shows a SphereSource object. The sphere is represented by 
> a framework of polygons.
> 
> I am attempting to access the polygon vertices that make up a 
> SphereSource object, so that I might scale the position of each 
> vertex in order to represent datapoints of an arbitrary spherical 
> function. I have written the following Java code: 
> 
>   vtkSphereSource sphere = new vtkSphereSource();
>   sphere.SetRadius(5.0);
>   sphere.SetThetaResolution(18);
>   sphere.SetPhiResolution(18);
> 
>   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