[vtkusers] Help!! =( NormalizedViewport -> World using vtkCoordinate

Louis Desjardins lost_bits1110 at hotmail.com
Thu Dec 9 21:51:22 EST 2004


Okay apparantly my last message didnt go through which was:

Hello experts

Say I have a Viewport that is defined as:
Ren->SetViewport( 0.5, 0.5, 1, 1)    // (x_min,y_min, x_max,y_max)

so basically it takes some fraction of the screen (half in this case)

I've rendered an UnstructuredGrid in this viewport, and thus I have an idea 
of what my world coordinates are

I would like to know the points defined above for my 'Ren' viewport in these 
defined world coordinates

so I would like to convert (0.5,0.5) to world coords
and (1,1) to world coords

this my code:

       double *worldValue1 = new double[2];
double *worldValue2 = new double[2];

ViewPortToWorld->SetCoordinateSystemToNormalizedViewport( );
ViewPortToWorld->SetViewport( Ren );
ViewPortToWorld->SetValue(0.5, 0.5);

worldValue1 = ViewPortToWorld->GetComputedWorldValue( Ren );
cout<<worldValue1[0]<<" "<<worldValue1[1]<<endl;

ViewPortToWorld->SetValue(1, 1);
worldValue2 = ViewPortToWorld->GetComputedWorldValue( ColorDoppler.Ren1 );
cout<<worldValue2[0]<<" "<<worldValue2[1]<<endl;

Like I said, I have an idea of what the values should be, but I dont get the 
right ones
also, worldValue1 and worldValue2 give the exact same values!??

Any help at all would be greatly appreciated =S
Thank you!

LD
--------
.. just to add to this:
I've also tried:

Ren->SetViewPoint( 0.5, 0.5, 0 );
Ren->ViewToWorld();
worldValue1 = ColorDoppler.Ren1->GetWorldPoint();
cout<<worldValue1[0]<<"  "<<worldValue1[1]<<endl;

Ren->SetViewPoint( 1, 1, 0 );
Ren->ViewToWorld();
worldValue1 = ColorDoppler.Ren1->GetWorldPoint();
cout<<worldValue1[0]<<"  "<<worldValue1[1]<<endl<<endl;

and still doesnt work :(

sigh





More information about the vtkusers mailing list