Daniel:<br><br>That is because vtkBorderRepresentation manages its Position and Position2Coordinates in the NormalizedViewport coodinate system. <br><br>See vtkBorderRepresentation.cxx line 45,48 :<br><br>  this->PositionCoordinate->SetCoordinateSystemToNormalizedViewport();<br>
  this->Position2Coordinate->SetCoordinateSystemToNormalizedViewport();<br><br>Hence any values you set, are in-turn blindly passed on to the these ivars; they are assumed to be in the coodinate system that these ivars are in.<br>
<br>--<br>karthik<br><br><br><div class="gmail_quote">On Wed, Aug 4, 2010 at 2:20 AM, Daniel Haehn <span dir="ltr"><<a href="mailto:haehn@bwh.harvard.edu">haehn@bwh.harvard.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi guys,<br>
<br>
I use the following code to set a position for a vtkTextWidget including a vtkTextRepresentation. I want to place the widget at a specific position obtained through a click in the render window.<br>
<br>
      vtkTextWidget* textWidget = vtkTextWidget::New();<br>
      VTK_CREATE(vtkTextRepresentation, textRep);<br>
      ...<br>
      textRep->SetPosition(x,y)<br>
<br>
This only works if I convert the obtained coordinates:<br>
<br>
     double x = this->GetInteractor()->GetEventPosition()[0];<br>
     double y = this->GetInteractor()->GetEventPosition()[1];<br>
<br>
     this->GetRenderer()->DisplayToNormalizedDisplay(x,y);<br>
     this->GetRenderer()->NormalizedDisplayToViewport(x,y);<br>
     this->GetRenderer()->ViewportToNormalizedViewport(x,y);<br>
<br>
Am I doing something wrong? Is there an easier way?<br>
<br>
Thank you,<br>
Daniel<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtk-developers" target="_blank">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br>
<br>
</blockquote></div><br>