pub fn billow_elevation_fn(opts: &MultiFractalOptions) -> impl Fn(f64, f64) -> f32 {
  // need to extract these values so they can be moved into the closure
  let MultiFractalOptions {
    noise_scale,
    z_scale,
    seed,
    ..
  } = *opts;
  // Fractal brownian motion looks real cool here! And is super configurable
  let noisefn = Billow::new()
    .set_octaves(opts.octaves)
    .set_frequency(opts.frequency)
    .set_lacunarity(opts.lacunarity)
    .set_persistence(opts.persistence);

  move |x, y| {
    let noise = noisefn.get([x / noise_scale, y / noise_scale, seed]) as f32;
    map_range(noise, -1.0, 1.0, 0.0, z_scale)
  }
}
/// Returns a closure that calculates the elevation for a given (x,y) coordinate.
/// The elevation is based on a noise function which is modulated by the
/// model.seed and model.noise_scale parameters.
/// The height of the resulting "topography" ranges from 0.0 to model.z_scale
Returns a closure that calculates the elevation for a given (x,y) coordinate.
The elevation is based on a noise function which is modulated by the
model.seed and model.noise_scale parameters.
The height of the resulting "topography" ranges from 0.0 to model.z_scale
Returns a closure that calculates the elevation for a given ( x y ) coordinate . The elevation is based on a noise function which is modulated by the model . seed and model . noise_scale parameters . The height of the resulting " topography " ranges from 0 . 0 to model . z_scale
pub fn billow_elevation_fn(opts: &MultiFractalOptions) -> impl Fn(f64, f64) -> f32 {
  // need to extract these values so they can be moved into the closure
  let MultiFractalOptions {
    noise_scale,
    z_scale,
    seed,
    ..
  } = *opts;
  // Fractal brownian motion looks real cool here! And is super configurable
  let noisefn = Billow::new()
    .set_octaves(opts.octaves)
    .set_frequency(opts.frequency)
    .set_lacunarity(opts.lacunarity)
    .set_persistence(opts.persistence);
  move |x, y| {
    let noise = noisefn.get([x / noise_scale, y / noise_scale, seed]) as f32;
    map_range(noise, -1.0, 1.0, 0.0, z_scale)
  }
}
pub fn billow_elevation_fn ( opts : & MultiFractalOptions ) -> impl Fn ( f64 , f64 ) -> f32 { // need to extract these values so they can be moved into the closure let MultiFractalOptions { noise_scale , z_scale , seed , .. } = * opts ; // Fractal brownian motion looks real cool here! And is super configurable let noisefn = Billow :: new ( ) . set_octaves ( opts . octaves ) . set_frequency ( opts . frequency ) . set_lacunarity ( opts . lacunarity ) . set_persistence ( opts . persistence ) ; move | x , y | { let noise = noisefn . get ( [ x / noise_scale , y / noise_scale , seed ] ) as f32 ; map_range ( noise , - 1.0 , 1.0 , 0.0 , z_scale ) } }
Returns a closure that calculates the elevation for a given (x,y) coordinate.
Returns a closure that calculates the elevation for a given ( x y ) coordinate .
opts
&MultiFractalOptions