<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hi Arnaud,<div><br></div><div>Do you want to draw a 2D rectangle over a 3D scene, parallel to the viewer?</div><div><br></div><div><div>On 11 Apr 2014, at 15:28, Arnaud Gelas <<a href="mailto:arnaudgelas@gmail.com">arnaudgelas@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">Note that I first naively try to set Position and Position2 in world coordinate, but it does not work as well (as it was done in the following broken wiki example: <a href="http://cmake.org/Wiki/VTK/Examples/Broken/Cxx/Widgets/BorderWorldCoords">http://cmake.org/Wiki/VTK/Examples/Broken/Cxx/Widgets/BorderWorldCoords</a> )</div>

<div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Apr 11, 2014 at 3:13 PM, Arnaud Gelas <span dir="ltr"><<a href="mailto:arnaudgelas@gmail.com" target="_blank">arnaudgelas@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all,<br>
<br>
I have world coordinates for both corners of a rectangle and I would like to draw the corresponding rectangle using vtkBorderWidget / vtkBorderRepresentation.<br>
<br>
Assuming the 2 locations are:<br>
        * double lowerLeftCorner[3], upperRightCorner[3];<br>
<br>
How would you set it to Position and Position2, by the means of PositionCoordinate and Position2Coordinate?<br>
<br>
I have tried the following:<br>
<br>
        vtkSmartPointer< vtkCoordinate > temp = vtkSmartPointer< vtkCoordinate >::New();<br>
        temp->SetCoordinateSystemToWorld();<br>
        temp->SetValue( lowerLeftCorner[0], lowerLeftCorner[1], lowerLeftCorner[2] );<br>
<br>
        double* left = temp->GetComputedDoubleDisplayValue( renderer );<br>
<br>
        renderer->DisplayToNormalizedDisplay( left[0], left[1] );<br>
        renderer->NormalizedDisplayToViewport( left[0], left[1] );<br>
        renderer->ViewportToNormalizedViewPort( left[0], left[1] );<br>
<br>
        borderRepresentation->GetPositionCoordinate()->SetValue( left[0], left[1] );<br>
<br>
I have tried doing the same for upperRightCorner, or making it relative as it is done inside vtkBorderRepresentation, i.e.<br>
<br>
        borderRepresentation->GetPositionCoordinate()->SetValue( right[0], right[1] );<br>
<br>
or<br>
        borderRepresentation->GetPositionCoordinate()->SetValue( right[0] - left[0], right[1] - left[1] );<br>
<br>
<br>
It does not appear right on the screen afterwards… I am definitively missing something here…<br>
<br>
What is the correct way to proceed?<br>
<br>
<br>
I would really appreciate if anyone could enlighten me here!!!<br>
<br>
Best,<br>
Arnaud</blockquote></div><br></div>
_______________________________________________<br>Powered by <a href="http://www.kitware.com">www.kitware.com</a><br><br>Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br><br>Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</a><br><br>Follow this link to subscribe/unsubscribe:<br><a href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</a><br></blockquote></div><br></body></html>