[vtkusers] bug - or misunderstanding - for transformation from world to view coordinates
    Jonathan Bailleul 
    Jonathan.Bailleul at greyc.ismra.fr
       
    Thu Apr 17 14:34:31 EDT 2003
    
    
  
Dear all,
As explained in a previous post, I created an actor from a polydata
object. My purpose is to move the actor with the mouse, and, at a given
stage, to retrieve the current 2d coordinates in order to display on the
screen a vtkActor2D feeded from a textMapper for annotation purposes.
I used the renderer method WorldToView as described here, but I cannot
understand the results:
before: 200 200 50 after:-5.63508 -3.76998 1.97749
before: 200 200 50 after:0.231182 0.0137224 2.20205
it changes when I move the actor with the mouse (hopefully), but the
text remains in the bottom-left corner as the strange values suggest,
which is not what I expected since the actor itself is in the middle of
my screen!
In advance, thanks for your help.
/* sets actor position to 2d projection of given 3d point */
void
Place2DActor(vtkRenderer *ren, vtkActor2D *act, float* pt)
{
  float x, y, z;
  x = pt[0]; y = pt[1]; z = pt[2]; 
  cout << "before: "<< x << " " << y  << " " << z;
 ren -> WorldToView(x, y, z);
  cout << " after:"<< x << " " << y  << " " << z << endl;
  act -> SetPosition(x, y);
}
-- 
-----------------------------------
Jonathan BAILLEUL, Doctorant
GREYC Image - Université de Caen 
http://www.greyc.ismra.fr/~bailleul
    
    
More information about the vtkusers
mailing list