[vtkusers] Polydata sometimes just shown after moving mousewheel
Marc Huber
marchuber.hft at gmx.de
Tue Apr 16 08:28:53 EDT 2013
thx! Reset the camera again after its movement solved the problem.
Am 4/16/2013 1:58 PM, schrieb David Doria:
> On Tue, Apr 16, 2013 at 7:34 AM, Marc Huber <marchuber.hft at gmx.de> wrote:
>> 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();
>
> Did you try renderer->ResetCamera()? Otherwise, please post compilable
> code that demonstrates the problem. The code should be as simple as
> possible (remove the Qt dependency, hard code data to view, etc.)
>
> David
>
--
Best regards / Mit freundlichen Grüßen
Marc Huber
More information about the vtkusers
mailing list