WIP. SignalXY.GetNearest() improvements#4265
Closed
StendProg wants to merge 2 commits intoScottPlot:mainfrom
Closed
WIP. SignalXY.GetNearest() improvements#4265StendProg wants to merge 2 commits intoScottPlot:mainfrom
StendProg wants to merge 2 commits intoScottPlot:mainfrom
Conversation
…xes. Update ShowValueUndermouseSignalXY Demo to demonstrate additional axes.
Contributor
|
@StendProg I took a peek here, and I like these changes. Should this be accepted, my functionality over in #4270 could be adapted to use this strategy fairly easily I think. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The relevance of this PR has been completely lost. PR #4270 brings all the changes implemented here.
Allows user to search for nearest points on
SignalXYthat use additional axes.Added methods to
RenderDetailsto get current resolution of additional axes.ISignalXYSourceinterface has been slightly modified. It doesn't need to know about RenderDetails because it doesn't know about axes used by Plottable. Therefore, it is passed the axis resolutions that are calculated in Plottable.The ShowValueUnderMouseSignalXY Demo has been significantly modified to show how additional axes can be used. It was largely used for debugging purposes. So you can safely undo/modify according to your vision.
It's not hard to apply a similar fix to
ScatterSources, but there are a lot of implementations out there and I'd rather wait for the current design to be approved.SignalXY.GetNearest()method has been significantly improved.Instead of a complete search of all points, we start with the point closest to the X coordinate. Then we move to the left or right until the X distance exceeds maxDistance. At the same time, if we have found points matching the criterion (distance less than maxDistance), the threshold for stopping (maxDistance) is also updated (decreased).
In my tests, finding the nearest point for a 10 million signal stays within the interactive performance limits.
It is not difficult to think of examples when this algorithm degenerates into a complete search of all points, consuming large computations due to more complex checks. But as it seems to me, in most cases when maxDistance is small and the density of points per pixel is relatively small, this algorithm gives a significant performance gain.