Thank you, this is a substantial piece of work.
Unfortunately, I have little time now, so it will take a while to review.
A few comments from a cursory reading of code:
1) I think that this kind of interpolation is commonly called two-dimensional, so
TInterpolation3D name is not optimal.
2) Maybe
TInterpolationNeedsValue1Event should be called
TInterpolationNeedsCoordEvent?
3) You call OnNeed events multiple times in arbitrary order -- perhaps either a cache
or a single-pass algorithm will be useful for performance, particularly of bilinear interpolation, which is cheap by itself.
4) Do you have references for the algorithms used, especially spline interpolation?
5) If you have time and inclination, please adapt the source to TAChart coding style. I can do it myself, of course.
The unit is not specific to TAChart and can also be used in other projects, it does depend on the numlib of FPC, though. Initially I wanted to write a descendant of TColorMapSeries, but I think this solution is more general.
Yes, you got this quite right. I have even given some thought to moving this unit outside of TAChart, but decided against it since it will add significant maintenance overhead.
As for your caching ideas -- yes, they are theoretically good, but are not easy to implement. Based on your description, I can see the following plan:
1) Extend drawer interface for saving/restoring images or their parts. I have not yet thought how to achieve this -- consider OpenGL and SVN back-ends...
2) Change notification mechanism so that assignments to logical extent might be distinguished from other changes.
3) Include series into notification mechanism (currently they initiate, but not receive notifications).
4) Use the above to implement caching as you described
5) Make sure that drawing algorithm is independent from initial offset, so that copied part seamlessly integrates with newly-drawn part
(I think I have already taken care of that, but I may have erred).
6) Update drawing algorithm for partial drawing.
7) Introduce some sort of out-of-view caching. Note that this means support for non-rectangular cached areas.
this kind of doublebuffering should be added as an option to all TBasicFuncSeries descendants.
Actually, it can be applied to all series. The only obstacle is point 6, which must be implemented differently for each series type, even for other functional series.