[vtkusers] convert VTK dataset co-ordinates to global co-ordi nates

yoel mittelberg yoel at truelife.com.au
Mon Mar 1 21:48:59 EST 2004


Thanks Mathieu,

I had a look at the file you mentioned & I can find that the
GetEventPosition() is available & its similar to the GetPosition()
available in the vtkCellPicker class. 
As a matter of fact I use the GetPosition() from the vtkCellPicker class
to place my markers on the model. The vtkCellPicker class takes the
viewport X & Y coordinates as input for the Pick() & translates them to
the global coordinates. The same vtkCellPicker object also returns the
cellId of the picked vtkCell & I store this cellId for usage when I
attempt to flip my animation 3D frames. 
But for testing purposes I use the cellId immediatly to get the picked
vtkCell object & tried to to extract the cell position( as I explained
in my original post) & try to convert them to the global coordinates. I
compare this with the original global coordinates the vtkCellPicker
class returned when I used GetPosition() & they are not even remotely
similar. So I am convinced that the EvaluateLocation() in vtkCell
doesn't return global coordinates ( as the docs seem to mention) and the
GetPoint() function returns dataset coordinates for a specific cell
point in the vtkCell object. Neither does the vtkCoordinate class make
the right conversion. 
Altogether the coordinates extracted from vtkCell seem like dataset
coordinates & there doesn't seem to be a facility to convert them to
either global ones or atleast to viewport coordinates. If I can get the
viewport coordinates then I will use the vtkCellPicker class to get the
global coordinates. 
The vtkCoordinate class says that coordinate systems in vtk are as
follows: 

  DISPLAY -             x-y pixel values in window
  NORMALIZED DISPLAY -  x-y (0,1) normalized values
  VIEWPORT -            x-y pixel values in viewport
  NORMALIZED VIEWPORT - x-y (0,1) normalized value in viewport
  VIEW -                x-y-z (-1,1) values in camera coordinates. (z is
depth)
  WORLD -               x-y-z global coordinate values
  USERDEFINED -         x-y-z in User defined space

( no mention of dataset coordinate system while the Vtk book mentions
it. I am confused)

It looks like I will have to reinvent the wheel & try to convert the
coordinates based on the complex formulae given in the vtk book( complex
for me as I ain't a mathematics guru & can't make sense out the
polynomial ()'s ).

Any other input from anyone will be deeply appreciated.

Thanks,
Michael ( I am using my colleague Yoel's mail box as my buggered
mailserver blocks all external mails I receive)



More information about the vtkusers mailing list