<P> Hi, Krs:
<P> Because I use java and vtkPanel, I need not associate a vtkPicker with an interactor, in fact, there is no interactor in java-vtk program at all. I have tried picking other normal actors such as cone or sphere in the same way, it works well. So I think there is no any problem with vtkPicker. One possible reason maybe vtkTensorGlyph ( or even vtkGlyph2D and vtkGlyph3D ) is incomptible with vtkPicker.( ? ) However, I know from the mail list that some people can pick objects of glyph, and there is also a possible way to figure out which glyph object I have picked even if all of the glyph objects are rendered with only one actor.
<P> So have you any idea ? Thanks a lot.
<P> Below are some abstract of the relative mail list:
<P>//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
<P>" Hi Jiaye-<BR><BR>Pick the point with the point picker, get a point id.<BR><BR>Use this point id to get the value of input point id, something like:<BR>vtkDataArray *inputIds = <BR>glyph->GetOutput()->GetPointData()->GetArray("InputPointIds");<BR>inputId = inputIds->GetTuple1(pickedId);<BR><BR>You have to have the latest vtk4.0 for this to work.<BR><BR>Will "</P>
<P>///////////////////////////////////////////////////////////////////////////////////////////////////////////////////</P>
<P>"<BR>><I>There is a method in vtkGlyph3D and vtkGlyph2D (very recently added) called<BR></I>><I>GeneratePointIdsOn/Off. This causes the glyphers to generate a field of ids<BR></I>><I>associated with each output point. Then if you use a pointpicker or<BR></I>><I>cellpicker to pick a point (from the output of the glyph), you can then use<BR></I>><I>the picked point id to index into the generated point ids. You'll have to<BR></I>><I>get the nightly release or use CVS to get this feature.<BR></I>><I><BR></I>><I>Will<BR></I>"</P>
<P>//////////////////////////////////////////////////////////////////////////////////////////////////////////////<BR>"Hi Malcolm,<BR><BR> Thanks for the reply. I looked at vtkProgrammableGlyphFilter. I think I<BR>understand what's going on. Following the tcl example included in the<BR>distribution, I used vtkTransform, vtkTransformPolyDataFilter, and<BR>vtkProgrammableGlyphFilter. I am using Java, so when it comes to setting the<BR>GlyphMethod, I am lost at mapping to Java code. (I'm not sure how I can pass<BR>the address of a method, since in C++ I could use &proc_name, but I don't<BR>have an & in Java)<BR>Anyway, leaving implementation issue behind, do I seem to be on the right<BR>track though? Back to the implementation issue, would you happen to be using<BR>Java, or something other than tcl? If so, would you have any suggestions on<BR>how this can be approached? Thank you for your help.<BR><BR>jiaye<BR>" </P>
<P>/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////</P>
<P>"Hi Jiaye<BR><BR>I use spheres to represent multiple seismic events with one actor. I get =<BR>around picking by using a programmable glyph filter and building a =<BR>lookup-table based on cell-ids on each iteration of the GlyphMethod. =<BR>When you do a pick on the actor you can then get the id of your input =<BR>point from the id of the picked cell.<BR>=20<BR>I hope this helps<BR>"</P>
<P>Best Wishes
<P>
<P>Lian
<P>
<P> <B><I>"K.R.Subramanian" <krs@cs.uncc.edu></I></B> wrote:
<BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">Lian:<BR><BR>You create a vtkPointPicker and then assign it to the interactor. Then you write<BR>a callback function. As I have done in one of my applications which is<BR>reproduced below; here<BR>I am determining the position of the picked point. There should be a method<BR>to also return the actor that was picked.<BR><BR>Hope that helps.<BR><BR>-- krs<BR><BR><BR><BR>void ivus3dPick (void *arg)<BR>{<BR><BR>vtkXRenderWindowInteractor<BR>*interactor = (vtkXRenderWindowInteractor *) arg;<BR><BR>vtkPointPicker *picker = (vtkPointPicker *) interactor->GetPicker();<BR><BR>if (picker->GetPointId() >= 0)<BR>{<BR>cout << "Point id: " << picker->GetPointId() << "\n" << flush;<BR><BR>float *a = picker->GetPickPosition();<BR><BR>cout << "Pick Position: " << a[0] <<"," << a[1] <<"," << a[2]<BR><< endl << flush;<BR><BR><BR>}<BR><BR>interactor->GetRenderWindow()->Render();<BR>}<BR><BR>*************<BR><BR>What you are doing is call the Pick method directly - this should also do<BR>something similar - what I show above is interactive picking using the mouse<BR>(in the default bindings, placing the mouse over the object and hitting the key 'p'<BR>should call the above function and output the position coordinates.) Of course,<BR>if the ray doesnt hit anything, then you will return a negative value..<BR><BR>Hope that helps.<BR><BR>-- krs<BR><BR>--<BR>K.R.Subramanian Phone: (704) 687-4872<BR>Department of Computer Science FAX: (704) 687-4893<BR>UNC Charlotte, CARC 311 Email: krs@cs.uncc.edu<BR>Charlotte, NC 28223-0001 Web: http://www.cs.uncc.edu/~krs<BR><BR><BR></BLOCKQUOTE><p><br><hr size=1><b>Do You Yahoo!?</b><br>
<a href="$rd_url/tag/http://movies.yahoo.com/">Yahoo! Movies</a> - coverage of the 74th Academy Awards®