Java Lerp lerp(final float x, final float x1, final float x2, final float q00, final float q01)

Here you can find the source of lerp(final float x, final float x1, final float x2, final float q00, final float q01)

Description

lerp

License

Open Source License

Parameter

Parameter Description
x a parameter
q00 a parameter
q01 a parameter
x1 a parameter
x2 a parameter

Declaration

private static float lerp(final float x, final float x1, final float x2, final float q00, final float q01) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2012 Andreas H?hmann/*from  w ww. ja  va 2  s.  co m*/
 *
 * All rights reserved. Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 
 *******************************************************************************/

public class Main {
    /**
     * @param x
     * @param q00
     * @param q01
     * @param x1
     * @param x2
     * @return
     */
    private static float lerp(final float x, final float x1, final float x2, final float q00, final float q01) {
        return (x2 - x) / (x2 - x1) * q00 + (x - x1) / (x2 - x1) * q01;
    }
}

Related

  1. lerp(double x, double x1, double x2, double q00, double q01)
  2. lerp(final double a, final double min, final double max)
  3. lerp(final double percent, final int startColor, final int endColor)
  4. lerp(final float a, final float b, final float f)
  5. lerp(final float percent, final float startValue, final float endValue)
  6. lerp(float a, float b, float f)
  7. lerp(float a, float b, float interpolation)
  8. lerp(float a, float b, float t)
  9. lerp(float fromValue, float toValue, float progress)