Java interpolate interpolate(int start, int end, int n, int i)

Here you can find the source of interpolate(int start, int end, int n, int i)

Description

Get the color component that lies between the two color component points

License

Open Source License

Parameter

Parameter Description
start The first color component value
end The last color component value
n Number of steps between the two colors
i The index at which the color is to be calculated

Return

The calculated color component

Declaration

private static int interpolate(int start, int end, int n, int i) 

Method Source Code

//package com.java2s;
/*//w ww  .ja  v a 2  s . co m
 *  Copyright (C) Stichting Akvo (Akvo Foundation)
 *
 *  This file is part of Akvo Caddisfly
 *
 *  Akvo Caddisfly is free software: you can redistribute it and modify it under the terms of
 *  the GNU Affero General Public License (AGPL) as published by the Free Software Foundation,
 *  either version 3 of the License or any later version.
 *
 *  Akvo Caddisfly 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 Affero General Public License included below for more details.
 *
 *  The full license text can also be seen at <http://www.gnu.org/licenses/agpl.html>.
 */

public class Main {
    /**
     * Get the color component that lies between the two color component points
     *
     * @param start The first color component value
     * @param end   The last color component value
     * @param n     Number of steps between the two colors
     * @param i     The index at which the color is to be calculated
     * @return The calculated color component
     */
    private static int interpolate(int start, int end, int n, int i) {
        return (int) ((float) start + ((((float) end - (float) start) / n) * i));
    }
}

Related

  1. interpolate(float s, float e, float t)
  2. interpolate(float t, float a, float b)
  3. interpolate(float var1, float var2, float var3)
  4. interpolate(int a, int b, int theta, int reciprocal)
  5. interpolate(int i, int n, float u1, float u2, float du)
  6. interpolate(int v1, int v2, float f)
  7. interpolate(int v1, int v2, float f)
  8. interpolate(Long t, Long t1, Double m1, Long t2, Double m2)
  9. interpolate(long x1, long x2, double y1, double y2, long x)