One valid input.
The expected output at x1.
Another valid input.
The expected output at x2.
A function that takes x as an input.
If x is between x1 and x2, return the corresponding y from the line segment.
Outside of the line segment, the function is flat.
I.e. f(-Infinity) == f(min(x1,x2) - 100) == f(min(x1,x2)).
And f(Infinity) == f(max(x1,x2) + 100) == f(max(x1,x2)).
Linear interpolation.
Given two points, this function will find the line segment that connects the two points.