Did you multiply z with the near clipping plane . because I could reproduce what you want to do without the actor . Anyway if that is not working for you then I don't have any other explanations at this time :)<br><br>
Regards<br><br>Darshan<br><br><div class="gmail_quote">On Wed, Apr 7, 2010 at 9:58 PM, Rakesh Patil <span dir="ltr"><<a href="mailto:rakeshthp@in.com">rakeshthp@in.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br><br><blockquote>Yes..<br><br>I did try that at the very beginning... Not only this but i tried out the various combination of the coordinates.. none of <br>them matched for me... :-)<br><br>vtkImageTracerWidget is performing the task what i want.. but it needs a prop beneath it.... and for me, it is with or without prop object.. wither ways it should be possible for me to draw...<br>
<br>Any suggestions..??<div class="im"><br><br>Thanks<br><br>Regards<br>Rakesh Patil<br>---------- Original message ----------<br></div><div><div></div><div class="h5">From:Darshan Pai< <a href="mailto:darshanpai@gmail.com" target="_blank">darshanpai@gmail.com</a> ><br>
Date: 08 Apr 10 04:55:02<br>Subject: Re: [vtkusers] Drawing objects interactively in VTK..??<br>To: Rakesh Patil <br><br>replied too fast . The displaytoview() and viewToWorld does not take points as input.<br><br>But you can use the vtkCoordinate . Try this particular snippet of code.<br>
<br>vtkCamera *camera = renderer->GetActiveCamera();<br>
double *n = new double[2];<br>n = camera->GetClippingRange();<br> <br><br> vtkSmartPointer<vtkCoordinate> coordinate = vtkSmartPointer<vtkCoordinate>::New();<br> coordinate->SetCoordinateSystemToDisplay();<br>
coordinate->SetValue(x,y); // display coordinates<br> double *pt = new double[3];<br> pt = coordinate->GetComputedWorldValue(renderer);<br> cout << pt[0] << " " <<pt[1] << " " << pt[2] << endl;<br>
vtkSmartPointer<vtkSphereSource> sphereSource = <br> vtkSmartPointer<vtkSphereSource>::New();<br> sphereSource->SetCenter(pt[0],pt[1],pt[2]*-1*n[0]);<br> sphereSource->SetRadius(1.0);<br>
sphereSource->Update();<br><br>depth is assumed to be 1 and n[0] is the near clip..<br><br><br><div class="gmail_quote">On Wed, Apr 7, 2010 at 6:26 PM, Darshan Pai <span dir="ltr"><<a href="mailto:darshanpai@gmail.com" target="_blank">darshanpai@gmail.com</a>></span> wrote:<br>
<font color="#000000"></font><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><font color="#000000">I don't know how to get the matrices defined . Maybe someone can help .<br>
But vtkRenderer has some functions like DisplayToView() and ViewToWorld() which can get you the world coordinate for that point.<br>
The default camera has the clipping information . You provide the depth of the point<br>
The world point will be <x*depth, y*depth, depth*-1*nearclipplane><br><br>See if it works . <br><br>Regards<br><font color="#888888">Darshan<br><br></font></font><div class="gmail_quote"><div><div></div><div><font color="#000000">On Wed, Apr 7, 2010 at 4:37 AM, Rakesh Patil <span dir="ltr"><<a href="mailto:rakeshthp@in.com" target="_blank">rakeshthp@in.com</a>></span> wrote:<br>
</font></div></div><font color="#000000"><font color="#000000"></font></font><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div>
<div><font color="#000000"><font color="#000000"> <br>Hi David,<br><br>That is exactly what i want.. But how can i get the points or lines which are traced..?? And also it should work without any actor..<br>
I mean this class works only for some actors. But i need for with actor and without actor..<br><br>Thanks<br><br>Regards<br><font color="#888888">Rakesh Patil<br></font><font color="#000000"></font></font></font><blockquote>
<div><font color="#000000"><font color="#000000"><font color="#000000"><br>---------- Original message ----------<br>
From:David Doria< <a href="mailto:daviddoria%2Bvtk@gmail.com" target="_blank">daviddoria+vtk@gmail.com</a> ><br>Date: 06 Apr 10 17:59:52<br>Subject: Re: [vtkusers] Drawing objects interactively in VTK..??<br>To: Rakesh Patil <br>
<br></font></font></font></div><div><font color="#000000"><font color="#000000"><font color="#000000">On Tue, Apr 6, 2010 at 5:13 AM, Rakesh Patil wrote:<br>> Hello,<br>><br>> I am trying to draw a polyline interactively (with help of mouse). What i'm<br>
> doing is at every left button down event, i get the mouse position and store<br>
> it is a vector list. Later using this points am displaying on the rendering<br>> window.<br>><br>> But when i do this, i noticed the following:<br>><br>>
The mouse position values are totally different from the the points which<br>> are displayed.. I mean, i click at one location, and it is displayed at far<br>> end another location..<br>><br>> I tried changing the coordinate system also.. Still the result is<br>
> unchanged..<br>><br>> Any suggestions how it is to be done..??<br>><br>> Thanks<br>> Rakesh Patil<br>><br><br></font></font></font></div><div><font color="#000000"><font color="#000000"><font color="#000000">Sounds like you may need a coordinate system conversion in there<br>
somewhere, check out:<br><a href="http://vtk.org/Wiki/VTK/Examples/Coordinate" target="_blank">http://vtk.org/Wiki/VTK/Examples/Coordinate</a><br><br>It also sounds like you are trying to duplicate already working code in:<br>
<a href="http://vtk.org/Wiki/VTK/Examples/Widgets/ImageTracerWidget" target="_blank">http://vtk.org/Wiki/VTK/Examples/Widgets/ImageTracerWidget</a><br><br>Thanks,<br><br>David<br></font></font></font></div></blockquote><font color="#000000"><font color="#000000"> <br>
</font></font><div><div></div><div>
<font color="#000000"><font color="#000000"><br></font></font><div style="border-top: 1px dashed rgb(204, 204, 204); border-bottom: 1px dashed rgb(204, 204, 204); padding: 5px;"><font color="#000000"><font color="#000000"><a href="http://mail.in.com/mails/new_reg.php?utm_source=invite&utm_medium=outgoing" style="font: 13px arial; color: rgb(30, 86, 161);" target="_blank">Get Yourself a cool, short <b>@in.com</b> Email ID now!</a></font></font></div>
</div></div><font color="#000000"><font color="#000000"><br></font></font></div></div><div><font color="#000000"><font color="#000000">_______________________________________________<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>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">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" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></font></font></div></blockquote></div><font color="#000000"><br>
</font></blockquote></div><br>
</div></div></blockquote>
</blockquote></div><br>