Linear interpolation online calculator
First-point coordinate | X1:Y1: |
Second point coordinate | X2:Y2: |
Target point x coordinates | X : |
Target point Y coordinates |
Linear interpolation is a simple interpolation method widely used in mathematics, computer graphics and other fields.
The common calculation method is as follows: suppose we know the coordinates (x0,y0) and (x1,y1), to get the value of a position x on the line in the interval [x0,x1].
We can get (y-y0)(X-x0)/(y1-y0)(x1-x0) Assuming that the value on both sides of the equation is α, then this value is the interpolation coefficient - the ratio of the distance from x0 to x to the distance from x0 to x1.
Since the value of x is known, the value of α can be obtained from the formula α=(X-x0)/(x1-x0) Similarly, α=(y-y0)/(y1-y0), which can be expressed algebraically as: y = (1-α)y0 + αy1 or y = y0 + α(y1-y0) so you can get y directly from α.
formula: Y = ((X - X1) (Y2 - Y1)/(X2 - X1)) + Y1
Here: X1,Y1 = first value, X2,Y2 = second value, X = target value,Y = result