Java Lerp lerp(double a, double b, double f)

Here you can find the source of lerp(double a, double b, double f)

Description

Interpolates between point a and point b

License

Open Source License

Parameter

Parameter Description
f A percentage value between 0 to 1

Return

The interpolated value

Declaration

public static double lerp(double a, double b, double f) 

Method Source Code

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

public class Main {
    /**//from www.j  a  v a  2s  .  c o m
     * Interpolates between point a and point b
     *
     * @param f A percentage value between 0 to 1
     * @return The interpolated value
     */
    public static double lerp(double a, double b, double f) {
        return a + f * (b - a);
    }

    public static float lerp(float a, float b, float f) {
        return a + f * (b - a);
    }
}

Related

  1. lerp(double a, double b, double amt)
  2. lerp(double a, double b, double lambda)
  3. lerp(double a, double l, double h)
  4. lerp(double amt, double start, double end)
  5. lerp(double distance, double firstPoint, double secondPoint)