[vtkusers] the number of vertexes on a cube
    xabi riobe 
    xabivtk at gmail.com
       
    Fri Jan  5 08:23:16 EST 2007
    
    
  
The cube is not seen as a "single" object. The polydata divides it in
6 faces with 4 points that define the rectangle, and the number of
points returned is 4x6=24.
If you want to obtain 8 you could use a vtkCleanPolyData that merges
duplicate points:
     vtkCleanPolyData *clean = vtkCleanPolyData::New();
     clean->SetInput(pCube->GetOutput());
     vtkPolyData *data = clean->GetOutput();
data->GetNumberOfPoints() will return 8.
2007/1/5, PAUL <polinzhuo at 163.com>:
> Hello:
>
> I want to get the number of vertexes on a cube.
>
> I have the codes below:
>
> vtkCubeSource *pCube = vtkCubeSource::New();
>
>      pCube->SetCenter(0,0,0);
>
>      pCube->SetXLength(2);
>
>      pCube->SetYLength(2);
>
>      pCube->SetZLength(2);
>
>      vtkPolyData *data = pCube->GetOutput();
>
>      data->Update();
>
> data->BuildLinks();
>
>      int numPts = data->GetNumberOfPoints();
>
>
>
> numPts should be 8, but here it is 24. why???
>
>
>
    
    
More information about the vtkusers
mailing list