I need to find good approximations of the points where an undefined function intersect a threshold value. I'm stepping through my space and whenever I find that two subsequent steps are on different sides of the threshold, I add a point somewhere in between:
(source: ning.com)
My first approach was to just pick the mid-point, but this is obviously a terrible solution:
(source: ning.com)
I'm now using linear interpolation which gives a reasonable result, but the underlying function will practically never be linear. Thus, this only works well if my stepsize is small enough:
(source: ning.com)
Sampling the base function can be quite expensive, but adding one or two additional samples in order to get a much better approximation is something I'd like to try. Is it possible to use Cubic interpolation here? Like so:
(source: ning.com)
Or are there better ways?
Much obliged, David Rutten
ps. I'm writing in C#, but this is a language agnostic problem.