[vtkusers] Accessing polygon vertices from SphereSource

Sylvain Jaume jaume at tele.ucl.ac.be
Wed Dec 12 02:23:50 EST 2001


Hi H.J.,

I don't know what 'information of edges' you're looking for.
vtkSphereSource will only ouput a polydata made of points, polys, and
normals. You can get the normal at the point i with:
float *normal=sphere->GetOutput()->GetPointData()->GetNormals()->GetTuple(i);
If you want an edge representation of the sphere, try vtkExtractEdges.

Sylvain

On Wed, 12 Dec 2001, hj wrote:

> Hi, Sylvain:
> 
>     I have got the right answer about the number of points by calling GetNumberOfPoints. 
> 
>     Can you tell me how to get the number and other infomation of edges stored in vtkPolyData? I'm a beginner of VTK, and feel very sorry to bother you with such questions.
> 
>     Thanks.
> 
>     J.Huang
> ----- Original Message ----- 
> From: "Sylvain Jaume" <jaume at tele.ucl.ac.be>
> To: "hj" <hj at cad.zju.edu.cn>
> Cc: <vtkusers at public.kitware.com>
> Sent: Wednesday, December 12, 2001 1:59 PM
> Subject: Re: [vtkusers] Accessing polygon vertices from SphereSource
> 
> 
> Hi,
> 
> vtkSphereSource creates a sphere model made of points, triangles, and 
> normals. You can get the number of points with:
> cout<<sphere->GetOutput()->GetNumberOfPoints()<<" points\n";
> Verts are different from points. That's why you get 0 verts with your
> program.
> 
> Hope this helps,
> Sylvain
> 
> On Wed, 12 Dec 2001, hj wrote:
> 
> >     I meet a similar problem as Phil Cook. I have called the function Update, but my code still doesn't work.
> >     The following is my code in VC6.0:
> >  
> >     vtkSphereSource *sphere = vtkSphereSource::New();
> >     sphere->SetRadius(5.0);
> >     sphere->SetThetaResolution(18);
> >     sphere->SetPhiResolution(18);
> >     sphere->Update();
> > 
> >     vtkPolyData *Data = sphere->GetOutput();
> >     cout << Data->GetNumberOfVerts() << ',' 
> >         << Data->GetNumberOfLines()  << ',' 
> >         << Data->GetNumberOfPolys() << ',' 
> >         << Data->GetNumberOfStrips() << endl;
> >  
> >     I get 0,0,576,0. Only GetNumberOfPolys give me the right answer.
> >     Did I forget something important?
> > 
> >     Thanks a lot.
> > 
> >     J.Huang   
> > ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÓ?+"²Ø^¦¸¯j×.L§b±Ë¬²*'-+-üù^jǤyêfzˁë(Yûh¦'ÿ
> > o'Ø^·ÿá¶ÚÿÿúnnXoþH­ÁªÞýÊ&ýÈ"ý¸§þûd}ªÿ?e£ aSÉbzKh²æìr¸>{û§²æìr¸>{øm¶Yÿþ>>-'ÿ'+pj·ÿr?¿T¨¥T©ÿ-+-SwèþûdºÇ«
> > 
> 
> 
> 
> 




More information about the vtkusers mailing list