gradientPerturb

fun gradientPerturb(seed: Int, amplitude: Double, frequency: Double, position: Vector3, interpolator: (Double) -> Double = ::quintic): Vector3(source)

Perturbs a position vector in 3D space by applying a gradient noise algorithm.

Return

A new position vector that has been perturbed by the gradient noise algorithm.

Parameters

seed

The seed value used for generating deterministic patterns.

amplitude

The amplitude of the perturbation, which controls the scale of displacement.

frequency

The frequency of the perturbation, which determines the scale of the noise.

position

The original position vector to be perturbed.

interpolator

The interpolation function used to smooth the noise transitions, defaulting to the quintic function.


fun gradientPerturb(seed: Int, amplitude: Double, frequency: Double, position: Vector2, interpolator: (Double) -> Double = ::quintic): Vector2(source)

Calculates a perturbed position based on gradient noise.

Return

A 2D vector that represents the new perturbed position.

Parameters

seed

An integer seed value used to initialize the pseudo-random number generator.

amplitude

A double value that determines the strength of the perturbation applied to the position.

frequency

A double value that defines how frequent the perturbation occurs in the space.

position

A 2D vector specifying the initial position to perturb.

interpolator

A function used for interpolation between gradient values, defaults to the quintic interpolation function.