MedicalVisualization

## 3 D Perlin Noise Interpolation

Interpolating functions between two data values a and b in the range $x\in[0,1]$.

Linear interpolation: graph by Hugo Elias

double linear_interpolate(double a, double b, double x)
{
return(a*(1-x) + b*x);
}

Rating: Linear interpolation is unsuitable for 3D Perlin Noise, because sharp corners look ugly.

Cosine Interpolation: graph by Hugo Elias

double cosine_interpolate(double a, double b, double x)
{
double ft = x*3.1415927;
f = (1 - cos(ft)) * 0.5;

return(a*(1-f) + b*f);
}

Rating: Cosine interpolation is very suitable for 3D Perlin Noise, because it is smooth and easy to implement.

Cubic interpolation with the polynom $p(x)=ax^3+bx^2+cx+d$: graph by Hugo Elias

// v0 = the point before a
// v1 = the point a
// v2 = the point b
// v3 = the point after b
double cubic_interpolate(double v0, double v1, double v2, double v3, double x)
{
double a = (v3 - v2) - (v0 - v1);
double b = (v0 - v1) - a;
double c = v2 - v0;
double d = v1;

return(d+(c+(b+a*x)*x)*x);
}

Rating: Cosine interpolation is suitable for 3D Perlin Noise, because it is smooth, but the additional effort and computation time are not justified by a hardly noticeable visual improvement. Also the cubically interpolated function is not bounded by the corner values, leading to interpolation shoot over.