Hi,
I am trying to build a function grapher,
The user enters xmin, xmax, ymin, ymax, function. I got the x, y for all points.
Now i want to translate this initial referential to a Canvas starting at 0,0 up to 250,250.
Is there a short way or should i just check
if x < 0
new x = (x - xmin) * (250 / (xmax - xmin)) ?
etc ..
Also this basic approach does not optimise sampling. For example if my function f(x) = 5 i dont need to sample the xrange in 500 points, i only need two points. I could do some heuristic checks.
But for a function like sin(2/x) i need more sampling around x (-1,1) how would you aproach such a thing ?
Thanks