Java Array Interpolate interpolate(float out[], float in1[], float in2[], int in2_idx, float coef, int length)

Here you can find the source of interpolate(float out[], float in1[], float in2[], int in2_idx, float coef, int length)

Description

interpolate

License

LGPL

Declaration

public static void interpolate(float out[], 
            float in1[], 
            float in2[], 
            int in2_idx, float coef, 
            int length) 
    

Method Source Code

//package com.java2s;
/*//  w  ww .  j a  v a  2 s .c  o  m
 * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
 *
 * Distributable under LGPL license.
 * See terms of license at gnu.org.
 */

public class Main {
    public static void interpolate(float out[], /* (o) the interpolated vector */
            float in1[], /* (i) the first vector for the
                               interpolation */
            float in2[], /* (i) the second vector for the
                               interpolation */
            int in2_idx, float coef, /* (i) interpolation weights */
            int length) /* (i) length of all vectors */
    {
        int i;
        float invcoef;

        invcoef = 1.0f - coef;
        for (i = 0; i < length; i++) {
            out[i] = coef * in1[i] + invcoef * in2[i + in2_idx];
            //       System.out.println("out["+i+"] devient " + out[i] + ", par " +
            //                  coef + " * " + in1[i] + " + " + invcoef + " * " + in2[i + in2_idx]);
        }
    }
}

Related

  1. interpolate(double[] end0, double[] end1, double[] mid)
  2. interpolate(double[] points, double[] values, double interpolateAt)
  3. interpolate(double[] x, double D)
  4. interpolate(double[] X, double[] Y, double[] Z)
  5. interpolate(double[] x, int newLength)
  6. interpolate(int[] data, double x)
  7. interpolate_linear(int[] x, double[] y, int[] xi)
  8. interpolateArray(int[] array, int interval)
  9. interpolateColor(float[] result, float[] color0, float[] color1, double s)