Here you can find the source of interpolate(int i, int n, float u1, float u2, float du)
public static float interpolate(int i, int n, float u1, float u2, float du)
//package com.java2s; /*// w ww.ja v a 2s . co m * @(#)gl_util.java 0.3 06/11/20 * * jGL 3-D graphics library for Java * Copyright (c) 1999-2006 Robin Bing-Yu Chen (robin@ntu.edu.tw) * * 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 2.1 of the License, or any later version. the GNU Lesser * General Public License should be included with this distribution * in the file LICENSE. * * 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. */ public class Main { public static float interpolate(int i, int n, float u1, float u2, float du) { if (i == 0) { return u1; } if (i == n) { return u2; } return (u1 + i * du); // where du = (u2 - u1) / n } public static float interpolate(int i, int n, float u1, float u2) { float du = (u2 - u1) / n; return interpolate(i, n, u1, u2, du); } }