double InterpolatedNoise1D (double x) { double xInt, xFrac = modf (x, &xInt); double v1 = SmoothedNoise1D ((long) xInt); double v2 = SmoothedNoise1D ((long) xInt + 1); return CosineInterpolate (v1, v2, xFrac); }
float vsPerlinOctave::InterpolatedNoise1D(float x) { int integer_X = int(x); float fractional_X = x - integer_X; vsAssert( fractional_X >= 0.f && fractional_X < 1.f, "Maths error: fractional_X out of bounds!" ); fractional_X = (3.0f * fractional_X * fractional_X) - (2.0f * fractional_X * fractional_X * fractional_X); float v1 = SmoothedNoise1D(integer_X); float v2 = SmoothedNoise1D(integer_X + 1); return vsInterpolate(fractional_X, v1 , v2); }