Struct noise::Brownian4 [] [src]

pub struct Brownian4<T, F: GenFn4<T>> {
    pub function: F,
    pub octaves: usize,
    pub frequency: T,
    pub persistence: T,
    pub lacunarity: T,
}

A callable struct for applying 4-dimensional fractional Brownian motion.

Fractional Brownian motion is a way of combining multiple octaves of a noise function to create a richer and more varied output. It can theoretically be used with any noise function, but it tends to only produce good results with gradient noise functions.

The struct contains many parameters, which can either be set using the builder methods provided, or by constructing the type manually.

Example

extern crate noise;
extern crate rand;

use noise::{Brownian4, perlin4};

let seed = rand::random();
let noise = Brownian4::new(perlin4, 4).wavelength(32.0);
let val = noise.apply(&seed, &[42.0, 37.0, 2.0, 3.0]);

Fields

function: F

The underlying noise function to call on each octave.

octaves: usize

The number of times to call the noise function.

frequency: T

The base frequency of the noise

persistence: T

The rate at which the amplitude of the noise is reduced on each octave.

lacunarity: T

The rate at which the frequency of the noise increases on each octave.

Methods

impl<T: Float, F: GenFn4<T>> Brownian4<T, F>
[src]

fn new(function: F, octaves: usize) -> Brownian4<T, F>

Constructs a new brownian noise function, defaulting to:

  • frequency: 1.0
  • lacunarity: 2.0
  • persistence: 0.5

fn function<Q: GenFn4<T>>(self, function: Q) -> Brownian4<T, Q>

A builder method that sets underlying noise function to call on each octave.

fn octaves(self, octaves: usize) -> Brownian4<T, F>

A builder method that sets the number of times to call the noise function.

fn wavelength(self, wavelength: T) -> Brownian4<T, F>

A builder method that sets the wavelength of the brownian noise. This is equivalent to self.frequency(wavelength.recip()).

fn frequency(self, frequency: T) -> Brownian4<T, F>

A builder method that sets the base frequency of the noise.

fn persistence(self, persistence: T) -> Brownian4<T, F>

A builder method that sets the rate at which the amplitude of the noise is reduced on each octave.

fn lacunarity(self, lacunarity: T) -> Brownian4<T, F>

A builder method that sets the rate at which the frequency of the noise increases on each octave.

fn apply(&self, seed: &Seed, point: &Point4<T>) -> T

Apply the Brownian noise function for the supplied seed and point.

Trait Implementations

impl<T: Clone, F: Clone + GenFn4<T>> Clone for Brownian4<T, F>
[src]

fn clone(&self) -> Brownian4<T, F>

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)
1.0.0

Performs copy-assignment from source. Read more

impl<T: Copy, F: Copy + GenFn4<T>> Copy for Brownian4<T, F>
[src]