<DIV>
<DIV>I have the same problem that picker sometimes returns the point on the back surface not the front one. </DIV>
<DIV>&nbsp;</DIV>
<DIV>If you figured it out, please let me know.</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Luke<BR><BR><B><I>&#23433; &#32487;&#19994; &lt;an_jiye@hotmail.com&gt;</I></B> wrote:</DIV>
<BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid"><BR>Hi.<BR><BR>I have done some picking work. It didn't seem to be what I had thought of.<BR><BR>In my test application, I create a vtkImageData object to simulate the <BR>source. It contains 64*64*93 points, the scalar type is unsigned char. I <BR>manually assign each slices the "same" value, where there are two rectangle <BR>areas with B inside A. Rectangle A locates at (5,1) to (49, 49), while <BR>rectangle B at (20, 20) to (39, 39). I assign value 0 to all the pixels <BR>outside A, value 2 inside B, and value 1 between A and B.<BR><BR>At next step, I use vtkContourFilter::SetValue(0, 1) and <BR>vtkContourFilter::SetValue(0, 2) to render this data set. My pipeline is <BR>vtkImageData-&gt;vtkContourFilter-&gt;vtkPolyDataNormals-&gt;vtkStripper-&gt;vtkPolyDataMapper-&gt;vtkActor. <BR>There are totally two pipelines. As a result, there are two cuboid surfaces <BR>in the rendering
 window, with B inside A. The four lower vertices of A is <BR>(5, 1, 0), (49, 1, 0), (49, 49, 0), (5, 49, 0), you will get the <BR>coordinates of the upper four vertices when replace z axis 0 with 92. <BR>Similarly, the lower four vertices of B is (20, 20, 0), (39, 20, 0), (39, <BR>39, 0) and (39, 20, 0). Getting the upper four vertices is the same as A.<BR><BR>The class for my observer is as below:<BR><BR>class vtkMyCallback : public vtkCommand<BR>{<BR>public:<BR>vtkMyCallback::vtkMyCallback() { };<BR>static vtkMyCallback *New() { return new vtkMyCallback; }<BR><BR>virtual void Execute(vtkObject *caller, unsigned long, void*)<BR>{<BR>vtkRenderWindowInteractor *iren = <BR>reinterpret_cast<VTKRENDERWINDOWINTERACTOR*>(caller);<BR>vtkPointPicker *picker = (vtkPointPicker *)iren-&gt;GetPicker();<BR><BR>if (picker-&gt;GetPointId() != -1){<BR>vtkPoints *points = picker-&gt;GetPickedPositions();<BR>int n = points-&gt;GetNumberOfPoints();<BR><BR>cout&lt;&lt; n &lt;&lt; " points are picked:
 \n";<BR>for(int i = 0; i &lt; n; ++ i){<BR>double pos[3];<BR>points-&gt;GetPoint(i, pos);<BR>cout&lt;&lt;"\tPoisition: ("&lt;<POS[0]<<", <br ?<<pos[2] ?<<pos[1]<<?,> }<BR>}<BR>}<BR>};<BR><BR>I add my observer like this:<BR><BR>... ...<BR>vtkPointPicker *picker = vtkPointPicker::New();<BR>iren-&gt;SetPicker(picker);<BR><BR>vtkMyCallback *callback = vtkMyCallback::New();<BR>iren-&gt;AddObserver(vtkCommand::EndPickEvent, callback);<BR>... ...<BR><BR>I also create a carema to make the actor locates at a traditional <BR>coordinate system, with the origin at lower left, x axies from left to <BR>right, y axis points inside and z axis from down to up.<BR><BR>...<BR>camera-&gt;SetViewUp (0, 0, 1);<BR>camera-&gt;SetPosition (0, 0, 0);<BR>camera-&gt;SetFocalPoint (0, 1, 0);<BR>...<BR><BR>During the visualization procedure, I use the default vtk interactor style. <BR>That is, use keypress "p" for points picking.<BR><BR>To my surprise, I got the following results and some question occur:
 <BR><BR>1. Why I got negative coordinates sometimes? like (1.34204, -0.79771, <BR>-5.08054). If the picking poinst is "on" the A surface, the minimum y axis <BR>should be 1, and the minimum z axis should be zero. I didn't get a negative <BR>x axis, but I think maybe it is possible to do so. Why? Can I only pick the <BR>points right ON the surface?<BR><BR>2. When I picking points by key press "p" while mouse cursor moves on the A <BR>surface (5, 1, 0), (49, 1, 0), (49, 1, 92) and (5, 1, 92), the following <BR>results occur:<BR><BR>1 points are picked:<BR>Poisition: (8.24702, 0.980525, 2.79693) &lt;--------- I can understand.<BR><BR>1 points are picked:<BR>Poisition: (6.62972, 49.0116, 5.25943) &lt;--------- Why the y axis is 49?<BR><BR>2 points are picked:<BR>Poisition: (15.9431, 48.9816, 14.8662) &lt;--------- It is on the back <BR>surface of A?<BR>Poisition: (17.191, 19.5678, 18.3799) &lt;--------- It is on the front <BR>surface of B?<BR><BR>Why these two points are picked? Where
 is the front surface of A?<BR><BR>2 points are picked:<BR>Poisition: (20.592, 0.938955, 3.75471) &lt;--------- I can understand.<BR>Poisition: (20.0176, 19.9942, -0.032108) &lt;--------- It is on the front <BR>surface of B?<BR><BR>The z axis is negative.<BR><BR>1 points are picked:<BR>Poisition: (5.16348, 24.0098, 37.8442) &lt;--------- Why the y axis is 24?<BR><BR>2 points are picked:<BR>Poisition: (36.259, 1.00855, 15.1336) &lt;--------- I can understand.<BR>Poisition: (37.9111, 38.9501, 9.62979) &lt;--------- It is on the back <BR>surface of B?<BR><BR>2 points are picked:<BR>Poisition: (24.0894, 49.0852, 2.34159) &lt;--------- It is on the back <BR>surface of A?<BR>Poisition: (24.2017, 39.0064, 4.02494) &lt;--------- It is on the back <BR>surface of B?<BR><BR>I never do some rotate to the carema by hold down the left mouse button <BR>when achieveing the above results. If do some, some other "strange" results <BR>will occur.<BR><BR>In conclusion, I can not understant how does
 vtkPointPicker pick points <BR>from the two surfaces. It seems I can get points from each of the four <BR>parallel surfaces from A and B. But acturally, I can only see the front <BR>surface of A.<BR><BR>Another question, why the point coordinates are not so accurate? I mean the <BR>y axis should be only one of the values 1, 20, 39 and 49, at least it <BR>should be much similar to these values. It seems there are some little <BR>errors in most of the time. The errors can range from 0.00x to 1. And also <BR>there is one 24 value.<BR><BR>I am using vtk4.4.0 under MS Visual C++ 6.0, windows 2000 professional <BR>edition.<BR><BR>Any suggestion will be appreciated. Thank you in advance.<BR><BR>Best Regards,<BR>Jiye An<BR><BR>_________________________________________________________________<BR>&#20813;&#36153;&#19979;&#36733; MSN Explorer: http://explorer.msn.com/lccn/ <BR><BR>_______________________________________________<BR>This is the private VTK discussion list. <BR>Please keep
 messages on-topic. Check the FAQ at: <HTTP: vtkfaq cgi-bin public.kitware.com><BR>Follow this link to subscribe/unsubscribe:<BR>http://www.vtk.org/mailman/listinfo/vtkusers</BLOCKQUOTE></DIV><p><hr SIZE=1>
Do you Yahoo!?<br>
Yahoo! Finance: <a href="http://us.rd.yahoo.com/evt=22055/*http://taxes.yahoo.com/filing.html">Get your refund fast by filing online</a>