Here you can find the source of lerp(double a, double b, double amt)
public static double lerp(double a, double b, double amt)
//package com.java2s; public class Main { public static double lerp(double a, double b, double amt) { amt = clamp(amt, 1F, 0F);// ww w . j a va 2 s . com return a * amt + b * (1D - amt); } public static float lerp(float a, float b, float amt) { amt = clamp(amt, 1F, 0F); return a * amt + b * (1F - amt); } public static double clamp(double val, double max, double min) { return val > max ? max : val < min ? min : val; } public static float clamp(float val, float max, float min) { return val > max ? max : val < min ? min : val; } public static int clamp(int val, int max, int min) { return val > max ? max : val < min ? min : val; } public static long clamp(long val, long max, long min) { return val > max ? max : val < min ? min : val; } public static short clamp(short val, short max, short min) { return val > max ? max : val < min ? min : val; } public static byte clamp(byte val, byte max, byte min) { return val > max ? max : val < min ? min : val; } }