Here you can find the source of interpolate(float s, float e, float t)
public static float interpolate(float s, float e, float t)
//package com.java2s; //License from project: LGPL public class Main { public static float interpolate(float s, float e, float t) { float t2 = (1.0f - fastCos(t * 3.14159265358979323f)) / 2.0f; return (s * (1.0f - t2) + (e) * t2); }//from ww w . j ava 2s . co m public static float fastCos(float x) { if (x < -3.14159265) { x += 6.28318531; } else { if (x > 3.14159265) { x -= 6.28318531; } } x += 1.57079632; if (x > 3.14159265) { x -= 6.28318531; } if (x < 0) { return (float) (1.27323954 * x + 0.405284735 * x * x); } else { return (float) (1.27323954 * x - 0.405284735 * x * x); } } }