[vtkusers] ViewToWorld problem ?

Rémy Obein / Muf mufmtp at yahoo.fr
Wed Feb 6 12:06:16 EST 2002


Hi again,

After some other searches, I've found where is my problem.
I've printed the matrix of my active camera.
    mat->DeepCopy(
mVtkRenderer->GetActiveCamera( )->GetCompositePerspectiveTransformMatrix(1,0
,1) );
    mat->Invert();

When no actor are displayed, the output is :

=> 0.267949 0.000000 0.000000 0.000000
=> 0.000000 0.267949 0.000000 0.000000
=> 0.000000 0.000000 -99.999000 99.000000
=> 0.000000 0.000000 -99.999000 100.000000

When I add an actor, after the first call to the Render function the output
is :

=> 0.267949 0.000000 0.000000 0.000000
=> 0.000000 0.267949 0.000000 0.000000
=> 0.000000 0.000000 -9.922609 19.360096
=> 0.000000 0.000000 -9.922609 20.360096

So, why is the matrix changed by the render method ? (and isn't if no actor
is present).
Here is my code to init the view :
    vtkCamera* camera = mVtkRenderer->GetActiveCamera( );
    camera->SetParallelProjection( FALSE );
    camera->SetPosition( 0, 0, 1 );
    camera->SetFocalPoint( 0, 0, 0 );
    camera->SetViewUp( 0, 1, 0 );
    mVtkRenderer->ResetCamera( );
    mVtkRenderer->SetActiveCamera( camera );
    camera->ComputeViewPlaneNormal();
    mVtkRenderer->ResetCameraClippingRange();

Help me !! Thanks
    Muf




More information about the vtkusers mailing list