[vtkusers] converting from display coordinates to world coodinates

Veerapuram Varadhan v.varadhan at californiadigital.com
Tue Mar 9 06:43:49 EST 2004


Hi Megha,

cam->GetFocalPoint() returns the current focal point of the camera in
WORLD co-ordinates only.  Moreover, AFAIK, vtkRenderWindowInterctor also
returns the event-position in WORLD co-ordinates.  So, you can directly
use them if you want them in WORLD co-ordinates.

Hope this helps!!  If not correct me.

V. Varadhan.

> Hello all
>
> I am using the following code to convert the display coords to world
> coords
>
>   double *arr=cam->GetFocalPoint();
>      x=iren->GetEventPosition()[0];
>      y=iren->GetEventPosition()[1];
>      z=arr[2];
>  float display[3];
>  display[0]=(float)x;
>  display[1]=(float)y;
>  display[2]=(float)z;
>  ren->SetDisplayPoint(display);
>  ren->DisplayToWorld();
>  float *world;
>  world=ren->GetWorldPoint();
>  vol->SetPosition((double)world[0],(double)world[1],(double)world[2]);
>  iren->Render();
>
> but the world coords that i am getting is something like
>   world[0]=2000.34;
>   world[1]=95123.00
>  world[2]= -2300.04
>
> Please suggest a solution
> Thanks
> Megha
>
> Yahoo! India Insurance Special: Be informed on the best policies,
> services, tools and more.




More information about the vtkusers mailing list