Here you can find the source of linearInterpolation(double x0, double y0, double x1, double y1, double x)
Parameter | Description |
---|---|
x0 | a parameter |
y0 | a parameter |
x1 | a parameter |
y1 | a parameter |
x | a parameter |
public static double linearInterpolation(double x0, double y0, double x1, double y1, double x)
//package com.java2s; //License from project: LGPL public class Main { /**//from ww w. j a v a 2 s . c o m * The linear interpolant is the straight line between these points * * @param x0 * @param y0 * @param x1 * @param y1 * @param x * @return y */ public static double linearInterpolation(double x0, double y0, double x1, double y1, double x) { return y0 + ((y1 - y0) / (x1 - x0)) * (x - x0); } }