[vtkusers] Accessing polygon vertices from SphereSource

hj hj at cad.zju.edu.cn
Wed Dec 12 00:10:22 EST 2001


    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   


More information about the vtkusers mailing list