[vtk-developers] how get object's bounds in viewport?

seaer wuweitianye at yahoo.com.cn
Sun Mar 11 22:10:45 EDT 2012


   hello, everyone!
   i am Chinese student, a rookie to VTK.  
   I am using VTK-5.6 with QT  in ubuntu 11.10 , i have a question :
   in the code: i get 2000000 points  and rendering them.  
   by default,  using ResetCamera(), i can see all points in viewport;using     
 actor->GetBounds(double bounds[6]), we can know all points' bounds.
   but, when zooming  points' actor in or rotating, not all points in
viewport,  i want to know these points' bounds in viewport.  how can i do it
?
     thanks!  


   here are my code:

/*****************************************************/
   ifstream input("/home/xiushan08/Fayetteville-SWB2.las",std::ios::in |
std::ios::out|std::ios::binary);
    liblas::ReaderFactory readerFactory;
    liblas::Reader reader =  readerFactory.CreateWithStream(input);

   
cout<<"总共点的个数为:"<<reader.GetHeader().GetPointRecordsCount()<<std::endl;
    ;
    for(int i =0;i<2000000;i++)
    {
        reader.ReadNextPoint();
       
points->InsertNextPoint(reader.GetPoint().GetX(),reader.GetPoint().GetY(),reader.GetPoint().GetZ());
    }
    for(int i=0;i<2000000;i++)
    {
        cellArray->InsertNextCell(1);
        cellArray->InsertCellPoint(i);
    }
    polyData->SetPoints(points);
    polyData->SetVerts(cellArray);

    this->setCentralWidget(ui->qvtkWidget);

    polyDataMapper->SetInput(polyData);
    lodActor->SetMapper(polyDataMapper);

    render->AddActor(lodActor);
    render->SetBackground(0.1, 0.2, 0.4);

    render->ResetCamera();
    ui->QVTKWidegt->GetRenderWindow()->Render();


/*****************************************************/
    


   



--
View this message in context: http://vtk.1045678.n5.nabble.com/how-get-object-s-bounds-in-viewport-tp5556405p5556405.html
Sent from the VTK - Dev mailing list archive at Nabble.com.



More information about the vtk-developers mailing list