Java Linear Interpolate LinearInterpolation(float a, float b, float f)

Here you can find the source of LinearInterpolation(float a, float b, float f)

Description

Calculates linear interpolation between values

License

Open Source License

Parameter

Parameter Description
a First value
b Second value
f Blend value

Return

Interpolated value

Declaration

public static float LinearInterpolation(float a, float b, float f) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**/*w w  w  .j a  v a2  s. c o  m*/
     * Calculates linear interpolation between values
     * 
     * @param a         First value
     * @param b         Second value
     * @param f         Blend value
     * @return          Interpolated value
     */
    public static float LinearInterpolation(float a, float b, float f) {
        float possible = (a + b + f) / 3;
        if (Math.abs(possible) < 1) {
            return possible;
        } else {
            return 1;
        }
    }
}

Related

  1. linearInterpolate(float y1, float y2, float mu)
  2. linearInterpolation(double min, double max, double factor)
  3. linearInterpolation(double x, double x1, double x2, double y1, double y2)
  4. linearInterpolation(double x0, double y0, double x1, double y1, double x)
  5. linearInterpolation(double y2, double y1, double deltaX, double x1)
  6. linearInterpolation(float min, float max, float min2, float max2, float value)
  7. linearInterpReal(double dX, double[] dXCoordinate, double[] dYCoordinate)