# 2D interpolation

I've developed a little program that let me load an image then make some angle measurements onto it. Here is a screenshot (there is no image loaded in this screenshot).

When all the measurements are done I have a list of x, y and angle values. What I'd like to do is interpolate them to generate some kind of graph. I would prefer to directly implement this functionality and not rely on any other library (as long as it's possible and not to complicated).

So basically I see two steps, first interpolating the data, second, generating a graph from it.

At first I was going to implement some bicubic interpolation but this kind of interpolation needs a regular grid, which I can't ensure.

For the moment I think I have to main options:

- Convert my data to a regular grid and then do a bicubic interpolation.
- Find an other kind of interpolation that doesn't require a regular grid.

What way do you think I should go and do you have any idea of which grid-redefining/interpolation I should use? I don't have any opinion on both methods but I think this is going to take me a lot of time and I wouldn't like to realize in the end that I am in a dead-end.

If this is of any relevance I'm working with Qt and on windows.

Edit: Basically I want something like that in the end:

## Answers

What you are looking for is a 2D Least squares fitting function, and generating a heat map or a 3D surface.

QWT is nice library that can help with graphing it, but it is doable without it.

Google Least Squares 2D Calculation