[vtkusers] Polydata sometimes just shown after moving mousewheel

Marc Huber marchuber.hft at gmx.de
Tue Apr 16 07:34:44 EDT 2013


Hi,

i have the problem, that if i load polydata to a renderer window 
depending on the dataset sometimes the object is shown directly and 
sometimes i have to move the mousewheel one time and then the object 
gets visible.
For each object my camera is set depending on the center point of my 
polydata.
I do a repaint but it doesn't help me.

Has anyone an idea what the problem might be?
Or can someone just tell me how i perform a simple event zooming in or 
out one time?

My Code:
     double cent[3], bounds[6], lenX, lenY, lenZ, max;
     stlActor->GetMapper()->GetCenter(cent);
     stlActor->GetMapper()->GetBounds(bounds);
     lenX=bounds[1]-bounds[0];
     lenY=bounds[3]-bounds[2];
     lenZ=bounds[5]-bounds[4];
     max=lenX;
     if (lenY > max) {max=lenY;}
     if (lenZ > max) {max=lenZ;}

     cam->SetFocalPoint(cent[0],cent[1],cent[2]);
     cam->SetViewUp(0,0,1);
     cam->SetPosition(-2*max,0,0);
     if (direction==0)  //azimuth
     {
         cam->Azimuth(degree);
     }
     else if (direction==1) //elevation
     {
         cam->Elevation(degree);
     }
     renderer->SetActiveCamera(cam);
     ui.qvtkWidget->repaint();




More information about the vtkusers mailing list