Java Lerp lerp(float va, float vb, float t)

Here you can find the source of lerp(float va, float vb, float t)

Description

Linearly interpolates between va and vb by the parameter t.

License

Open Source License

Parameter

Parameter Description
va first value.
vb second value.
t parameter.

Return

result value.

Declaration

public static float lerp(float va, float vb, float t) 

Method Source Code

//package com.java2s;
/**//  w  w w.j a  v a2s .  com
 * This file is part of Kowy Engine.
 *
 * Kowy Engine is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Kowy Engine 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Kowy Engine.  If not, see <http://www.gnu.org/licenses/gpl-3.0.txt>.
 */

public class Main {
    /**
     * Linearly interpolates between va and vb by the parameter t.
     * 
     * @param va
     *            first value.
     * @param vb
     *            second value.
     * @param t
     *            parameter.
     * @return result value.
     */
    public static float lerp(float va, float vb, float t) {
        return va + t * (vb - va);
    }
}

Related

  1. lerp(float fromValue, float toValue, float progress)
  2. lerp(float origin, float target, int steps, int maxSteps)
  3. lerp(float start, float stop, float amt)
  4. lerp(float target, float current, float factor)
  5. lerp(float to, float from, float f)
  6. lerp(float value1, float value2, float amount)
  7. lerp(int a, int b, float value)
  8. lerp(int a, int b, int mul, int div)
  9. lerpa(double a1, double a2, double t)