Here you can find the source of interpolate(int a, int b, int theta, int reciprocal)
Parameter | Description |
---|---|
a | The first smooth noise value. |
b | The second smooth noise value. |
theta | The angle. |
reciprocal | The frequency reciprocal. |
private static int interpolate(int a, int b, int theta, int reciprocal)
//package com.java2s; public class Main { /**// w w w . j ava 2 s.c o m * The cosine table used for interpolation. */ private static final int[] COSINE = new int[2048]; /** * Interpolates two smooth noise values. * * @param a The first smooth noise value. * @param b The second smooth noise value. * @param theta The angle. * @param reciprocal The frequency reciprocal. * @return The interpolated value. */ private static int interpolate(int a, int b, int theta, int reciprocal) { int cosine = 65536 - COSINE[theta * COSINE.length / (2 * reciprocal)] / 2; return (a * (65536 - cosine)) / 65536 + (b * cosine) / 65536; } }