By the way, do you think that the runtime error happened because I tried to call "sample" with an x co-ordinate which does not correspond to one of the points used to draw the curve?
Normally the x-coordinates have nothing to do with the size of an array. If you have 20 points indexes from 0-19 are valid. A x coordinate of f.e. 1000.0 used as index into this array will be out of bound.
Bookmarks