Sorry, I am not talking about the data, I'm talking about the best fit function.For example suppose you have y=|x| (function of one variable). This is a piecewise linear function with a knot at x=0.
If you have data of the form (x,y) and you want to fit a piecewise linear function, you could do something like say it has one knot at 0, and find the best combination of line before x=0 and line after x=0. This is an easy problem to solve. On the other hand you could say you know there is one knot, you just don't know where it is. This is also not hard to solve. What is really hard is if you say there are multiple knots of unknown number, and unknown location. If you don't actually believe your data is a piecewise linear function and are just trying to approximate a nonlinear function, this is probably the state you are in (from what you have posted so far I think this is probably what you're doing?)
Your situation is even harder, because the domain is 2 dimensions. An example of a piecewise linear function would be ##f(x_1,x_2)= |x_1| + |x_2| +|x_1+x_2 |## this has knots along the lines ##x_1=0##, ##x_2=0## and ##x_1+x_2=0##.
Picking where the knots go and how many of them there should be is a non trivial question that doesn't have a literal answer - it's a balance between making a model with more predictive power vs one that is overfit. That's why if you come in knowing what they should look like, you can get a significantly better answer.
I think the real point here is you don't want to do linear interpolation, which is easy, but linear regression, which is a lot harder. I'm not immediately sure if there is a package/algorithm that will just solve this problem for you, but I feel like there should be one. I'll look around a little more for it.