Open
Conversation
jbednar
reviewed
Mar 23, 2022
Member
There was a problem hiding this comment.
Very cool, thanks! It's important to document precisely what the implications, limitations, and costs of this approach are, especially compared to other possible implementations. My guesses:
- It appears to assume that the curve is (nearly) a function, i.e. that there is at most one y value for a given x value (or that if there are multiple, they are connected vertically, not fully disjoint?). If so, that's fine and a useful assumption, but should be clearly documented, and other
inspectfunctions could relax that assumption if needed. - From what I can see, if a particular curve crosses close to the clicked location but does not happen to have a vertex near the location, then my understanding is that it won't be selected, either because it doesn't fit the tolerance or because another curve not as close to the click but with a vertex that's within tolerance gets selected. That's a limitation that should be documented, but may be ok; we can tell people to click near a vertex in such a situation.
- I wonder if there is a practical alternative that interpolates each curve at the available x values, computing the y value explicitly, and then can do a cheap lookup of the y value when it gets a click. That would optimize clicking or hovering performance, but may incur a cost in memory and CPU whenever the viewport changes.
Not sure what other alternatives there are.
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.
Selects one of multiple datashaded curves by drawing a vertical line at the x-position and identifying all points of intersection of that line on the rasterized plot. The intersection closest to the specified y-coordinate is picked and the data of all rasterized curves is searched for proximity to that coordinate.
Here's a demo with 10 curves with 100k points each: