Looks like the 3D case.
The points (x,y,f(x,y)) aren't on the same plane, so f(x,y) can't be linear for x and y. There are infinite possible functions that work for this group of points, though. I can't see why in the world you'd want to find just
any of these functions, but maybe that's just me.
One such function would be:
f(x,y) = 1, when x = 5000 and y = 0;
f(x,y) = 1, when x = 200000 and y = 0;
f(x,y) = 1.5, when x = 5000 and y = 1000;
f(x,y) = 1.01, when x = 200000 and y = 1000;
f(x,y) = 0, otherwise.
Solved?
EDIT: Ok, maybe I refrain from being quite the jerk I am, and give you all the linear piecewise solutions where three of the points at a time satisfy the either piece (let the points be (x1,y1), (x2,y2), (x3,y3) and (x4,y4)):
f(x,y) = z1 - ( ( (y2-y1)*(f(x3,y3) - f(x1,y1)) - (y3-y1)*(f(x2,y2) - f(x1,y1)) )*(x-x1) + ( (x3-x1)*(f(x2,y2) - f(x1,y1)) - (x2-x1)*(f(x3,y3) - f(x1,y1)) )*(y-y1) )/( (x2-x1)*(y3-y1) - (x3-x1)*(y2-y1) ), when sgn((x-x2)*(y3-y2) - (x3-x2)*(y-y2)) == sgn((x1-x2)*(y3-y2) - (x3-x2)*(y1-y2));
f(x,y) = z4 - ( ( (y2-y4)*(f(x3,y3) - f(x4,y4)) - (y3-y4)*(f(x2,y2) - f(x4,y4)) )*(x-x4) + ( (x3-x4)*(f(x2,y2) - f(x4,y4)) - (x2-x4)*(f(x3,y3) - f(x4,y4)) )*(y-y4) )/( (x2-x4)*(y3-y4) - (x3-x4)*(y2-y4) ), otherwise.
Edited by Tepi, 30 December 2011 - 02:26 PM.