[vtkusers] vtkPlotPoints GetNearestPoint data index?
Eric E. Monson
emonson at cs.duke.edu
Fri Jun 4 09:46:42 EDT 2010
Hey Marcus,
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?
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.)
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.
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?
Thanks a lot,
-Eric
------------------------------------------------------
Eric E Monson
Duke Visualization Technology Group
More information about the vtkusers
mailing list