Eric,<div><br></div><div>Marcus is traveling today, I'll try to help out.</div><div><br></div><div>Roughly, yes, you do need to sort the points. The problem with simply searching through unsorted possibilities is that there's unlikely to be an exact match and you need the best possible candidate for a match. You wouldn't be sure if there's a better candidate "down the line".</div>
<div><br></div><div>You will need to devise someway to keep your points and the index together during the process. In vtkPlotStacked.cxx (in the current VTK tree) I had to do something similar with the upper and lower extent of the "stack". I cheated a little by using a vtkVector3f and treating the lower/upper bounds as two "dimensions" but the idea is roughly the same.</div>
<div><br></div><div>Keith<br><br><div class="gmail_quote">On Fri, Jun 4, 2010 at 9:46 AM, Eric E. Monson <span dir="ltr"><<a href="mailto:emonson@cs.duke.edu">emonson@cs.duke.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hey Marcus,<br>
<br>
I'm trying to figure out how to alter your scatter plot code to get a hover tooltip which has more data-specific info, not just the point position. (In this case I want try displaying an image associated with the point, and I need the pedigree ID of the point to know which image to retrieve.) I'm curious if you can think of an easy way to get back the row index (or pedigree id, or something) for the hovered-over data point, and not just its position?<br>
<br>
In the current implementation you call vtkPlotPoints::GetNearestPoint() from vtkChartXY::LocatePointInPlots(), and it uses vtkstd::lower_bound() on a sort()-ed vector of positions. Is this method a lot faster than just stupidly traversing all the points until you find a hit? (As you can tell, I'm not a C++ expert.)<br>
<br>
To use the stl sort() and lower_bounds(), it seems like I would have to move to storing the row index along with the position vectors and sort them together to get back the index of the closest point. Otherwise, I guess I could make a new routine that just traverses in the original row index order.<br>
<br>
Off the top of your head, do you have a feeling for which would be best to try, or perhaps another idea of how to get back the original index?<br>
<br>
Thanks a lot,<br>
-Eric<br>
<br>
------------------------------------------------------<br>
Eric E Monson<br>
Duke Visualization Technology Group<br>
<br>
<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>
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>
</blockquote></div><br></div>