Here you can find the source of lerp(double a, double l, double h)
public static double lerp(double a, double l, double h)
//package com.java2s; /*//from ww w . ja va 2s . c o m * Copyright (c) 2011, Paul Hertz This library is free software; you can * redistribute it and/or modify it under the terms of the GNU Lesser General * Public License as published by the Free Software Foundation; either version * 3.0 of the License, or (at your option) any later version. * http://www.gnu.org/licenses/lgpl.html This library is distributed in * the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See * the GNU Lesser General Public License for more details. You should have * received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, * Fifth Floor, Boston, MA 02110-1301, USA * * @author ##author## * @modified ##date## * @version ##version## * */ public class Main { /** * Interpolates a value within a range. * linear interpolation from l (when a=0) to h (when a=1) * (equal to (a * h) + (1 - a) * l) */ public static double lerp(double a, double l, double h) { return l + a * (h - l); } /** * Interpolates a value within a range. * linear interpolation from l (when a=0) to h (when a=1) * (equal to (a * h) + (1 - a) * l) */ public static float lerp(float a, float l, float h) { return l + a * (h - l); } }