Linear interpolation online calculator
First point coordinates | X1:Y1: |
Second point coordinates | X2:Y2: |
Target point X coordinate | X : |
Target point Y coordinate |
Linear interpolation is a simple interpolation method widely used in fields such as mathematics and computer graphics.
The commonly used calculation method is as follows: assuming we know the coordinates (x0, y0) and (x1, y1), we need to obtain the value of x on a straight line at a certain position within the [x0, x1] interval.
We can obtain (y-y0) (x-x0)/(y1-y0) (x1-x0). Assuming the values on both sides of the equation are α, 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 as α=(x-x0)/(x1-x0). Similarly, α=(y-y0)/(y1-y0), which can be expressed algebraically as y=(1- α) y0+α y1 or y=y0+α (y1- y0). By using α, y can be directly obtained.
formula:Y = ( ( X - X1 )( Y2 - Y1) / ( X2 - X1) ) + Y1
Here: X1, Y1=first value, X2, Y2=second value, X=target value, Y=result