[][src]Struct worley_noise::WorleyNoise

pub struct WorleyNoise { /* fields omitted */ }

The base noise struct.

Uses permutation arrays for efficiency. Use the WorleyNoise::permutate function to randomize it / adjust the size.

Caches already sampled values.

Sampling individual points is relatively slow due to the internal locks. Use the WorleyNoise::values_3d function if sampling multiple points instead as it's concurrent.

Methods

impl WorleyNoise[src]

pub const DEFAULT_RADIUS: u16[src]

pub const DEFAULT_PERMUTATION_BITS: usize[src]

pub const DEFAULT_DENSITY: f64[src]

pub const DEFAULT_CACHE_CAPACITY: usize[src]

pub fn new() -> Self[src]

Creates a new noise struct with random permutation arrays.

Uses the default cache capacity of 2500.

pub fn with_cache_capacity(capacity: usize) -> Self[src]

Initializes the struct with the specified cache capacity.

pub fn permutate(&mut self, permutation_table_bit_length: usize)[src]

Calls WorleyNoise::permutate_seeded with a random seed.

pub fn permutate_seeded(
    &mut self,
    permutation_table_bit_length: usize,
    seed: u128
)
[src]

Randomizes the internal permutation arrays.

Generates permutation arrays with two to the power of permutation_table_bit_length entries.

This operation is fairly slow.

pub fn set_density(&mut self, density: f64)[src]

Sets the feature point density.

Might be slow since it precomputes a lot of stuff.

Default is 3.0.

pub fn set_distance_function<F>(&mut self, function: F) where
    F: Fn(f64, f64, f64) -> f64 + Sync + 'static, 
[src]

Sets the function to calculate the distance between feature points.

Default is the squared Euclidean distance.

pub fn set_value_function<F>(&mut self, function: F) where
    F: Fn(Vec<f64>) -> f64 + Sync + 'static, 
[src]

Sets the function to pick the final value from the nearby feature points.

The values are in no particular order.

Default is the minimum value.

pub fn set_radius(&mut self, radius: u16)[src]

Specifies how many adjacent cells should be included in the value calculation for all directions.

A higher radius reduces the amount of possible errors but slows down sampling of individual points.

Default is 1. That means it includes the feature points of the surrounding cells.

pub fn set_radius_x(&mut self, radius: u16)[src]

Specifies how many adjacent cells should be included in the value calculation for the x direction.

See WorleyNoise::set_radius.

pub fn set_radius_y(&mut self, radius: u16)[src]

Specifies how many adjacent cells should be included in the value calculation for the y direction.

See WorleyNoise::set_radius.

pub fn set_radius_z(&mut self, radius: u16)[src]

Specifies how many adjacent cells should be included in the value calculation for the z direction.

See WorleyNoise::set_radius.

pub fn value_3d(&self, x: f64, y: f64, z: f64) -> f64[src]

Calculates the noise value for the given point.

pub fn value_2d(&self, x: f64, y: f64) -> f64[src]

Calculates the noise value for the given point with z set to 0.0.

pub fn values_3d(&self, points: &Vec<(f64, f64, f64)>) -> Vec<f64>[src]

Calculates the noise values for the given points.

Uses multiple threads if available.

pub fn values_2d(&self, points: &Vec<(f64, f64)>) -> Vec<f64>[src]

Calculates the noise values for the given points with z set to 0.0.

Uses multiple threads if available.

Auto Trait Implementations

impl !Send for WorleyNoise

impl Sync for WorleyNoise

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]