[vtkusers] Re: world to screen coordinates

Bruno da Silva de Oliveira bruno at esss.com.br
Tue Sep 20 11:48:27 EDT 2005


Posting to the vtkusers list too, so it can be found in the archives.

Theodore Papatheodorou wrote:

> Hi all,
> a simple question that requires an urgent answer.
> I have written a program that displays the 3d coordinates of the 
> points of the surface currently displayed in the renderer. How can I 
> get the 2D (screen) coordinates for the points displayed?
> Please help :)
> tp


Here some sample code (untested):

vtkCoordinate* c = vtkCoordinate::New();
c->setViewport(myviewport);
c->SetCoordinateSystemToWorld();
c->SetValue(wx, wy);
float *p = c->GetComputedDisplayValue(myviewport);


HTH,

-- 
Bruno da Silva de Oliveira
bruno at esss.com.br
ESSS - Engineering Simulation and Scientific Software
http://www.esss.com.br





More information about the vtkusers mailing list