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

yoel mittelberg yoel at truelife.com.au
Mon Mar 1 01:00:28 EST 2004


Reposting query in a better format( hoping!!!)
************************
Hi Guys, 
I would like to know how its possible to transform in VTK a dataset
coordinate to global corrdinate. 
For ex: I have a 3D Model which has been enabled to be picked. Everytime
its picked I put a marker on the model & I store the cellId of the
picked cell. I am required to animate the 3D Model & the marker needs to
move with the model. 
What I tried to do when I change the model position for each animation
frame is to get the vtkCell using the stored cellId. From there I try to
retrieve the cell position for any one of the 3 cell points 
>> cell->GetPoints()->GetPoint( 0, pos); 
The position retrieved seems to be in dataset coordinates ( Is this
correct ???) 
Instead of the above, I also tried to retrieve the Global position of
the vtkCell object using 
>> cell->EvaluateLocation( subId, pcoords, gcoords, weights). 
But the "gcoords[]" returned seem to have similar values like GetPoint()
showed above and don't seem to be in global coordinates. 
I tried using vtkCoordinate class but they seem to do the transformation
between viewport & global coordinates and don't seem to have dataset
coordinate transformation. vtkRenderer class also have transformations
between Display(viewport) & world(Global) coordinates. 
The Visualisation Toolkit book has some info wrt to coordinates in
Chapter 8, section 3( i.e 8.3 ). I am wondering if anyone has
implemented any class that encapsulates that logic( I expected
vtkCoordinate to do this but alas!) 
So I am caught out hopelessly after breaking my head over several
techniques & I would be grateful if someone can provide me with that
crucial tip that will open my mind to the vast possibilities in vtk
coordinate space :). 
Thank You. 
Cheers,
Michael Thomas




More information about the vtkusers mailing list