graph.tk
graph.tk copied to clipboard
Coords
It would be more useful if instead of displaying the mouse coordinates, it locked/snapped to points on the graph, so that you could get values off the plot.
Do you suggest any strategy approaching this problem?
I thought about using alreadydrawnpoints, but that won't be precise enough
I don't know. I'm not even sure how lines will be plotted now that we need implicit equation support.
If we were to plot lines like this: user input: "f(x,y) = g(x,y)" And then for every pixel, (using a fragment shader running on the GPU) check whether |f(x,y)-g(x,y)| < 0.01, and colour the pixel in if it is, or something like that?
If we do it like that, then we won't have alreadydrawnpoints, but we will instead have a bitmap, with some pixels coloured in.
So one method for finding coords might be solving for a point on the line using Newtons method (not using the already drawn graph, just the equation), starting with the mouse coords. That might not always get the point on the line closest to the cursor, and it might be a bit too slow.
Any ideas?