gradientPerturbFractal

fun gradientPerturbFractal(seed: Int, amplitude: Double = 1.0, frequency: Double = 2.0, lacunarity: Double = 2.0, gain: Double = 0.5, octaves: Int = 4, position: Vector3, interpolator: (Double) -> Double = ::quintic): Vector3(source)

Applies fractal gradient perturbation to a 3D position vector.

This method perturbs the input position vector using a fractal noise pattern based on multiple octaves of gradient noise. It combines parameters such as amplitude, frequency, lacunarity, and gain to control the noise characteristics, while supporting custom interpolation.

Return

The perturbed 3D position vector after applying the fractal gradient perturbation.

Parameters

seed

The initial seed value to generate the noise.

amplitude

The initial magnitude of the displacement during the perturbation.

frequency

The base frequency for the noise generation.

lacunarity

The frequency multiplier between successive octaves.

gain

The amplitude multiplier between successive octaves.

octaves

The number of noise layers (octaves) to combine in the fractal calculation.

position

The input 3D vector representing the position to perturb.

interpolator

A function to apply smooth interpolation, typically used for gradient noise transitions.


fun gradientPerturbFractal(seed: Int, amplitude: Double = 1.0, frequency: Double = 2.0, lacunarity: Double = 2.0, gain: Double = 0.5, octaves: Int = 4, position: Vector2, interpolator: (Double) -> Double = ::quintic): Vector2(source)

Applies fractal gradient perturbation to the given position vector using the specified parameters. This method introduces multiple layers of noise to create a fractal effect by perturbing the position iteratively based on the number of octaves, frequency, and amplitude adjustments.

Return

A 2D vector representing the perturbed position after applying the fractal gradient noise.

Parameters

seed

An integer seed used to initialize the random number generator for noise generation.

amplitude

The initial amplitude of the perturbation. Higher values result in larger displacements.

frequency

The initial frequency of the noise. Higher values increase the density of the noise variation.

lacunarity

The rate at which the frequency increases with each octave.

gain

The rate at which the amplitude decreases with each octave.

octaves

The number of fractal noise layers to apply. More octaves increase detail.

position

A 2D vector representing the original point to be perturbed.

interpolator

A function that defines how to interpolate values smoothly. Defaults to the quintic function.