wave_gradient

Function wave_gradient 

Source
pub fn wave_gradient(
    rows: usize,
    cols: usize,
    period: f64,
    direction: Option<f64>,
) -> Vec<Vec<f64>>
Expand description

Returns a wave gradient NLM with values ranging [0, 1).

A wave gradient cycles through 0->1->0… repeatedly from one end of the array to the other. The gradient falls across the array in a random direction.

§Arguments

  • rows - Number of rows in the array.
  • cols - Number of columns in the array.
  • period - Period of the wave function (smaller = larger wave).
  • direction - Direction of the gradient in degrees [0, 360).

Implementation ported from NLMpy.