Struct worley_noise::WorleyNoise
[−]
[src]
pub struct WorleyNoise { /* fields omitted */ }
The base noise struct.
Caches already sampled values.
Sampling individual points is relatively slow due to the internal locks.
Use the WorleyNoise::values
function if possible.
Methods
impl WorleyNoise
[src]
fn new() -> Self
[src]
Creates a new noise struct with random permutation arrays.
Uses a default density of 3.0 and a cache capacity of 1000.
fn with_cache_capacity(capacity: usize) -> Self
[src]
Initializes the struct with the specified cache capacity.
fn permutate(&mut self, permutation_table_bit_length: usize)
[src]
Calls permutate_seeded with a random seed.
fn permutate_seeded(&mut self, permutation_table_bit_length: usize, seed: usize)
[src]
Randomizes the internal permutation arrays.
Might be slow.
fn set_density(&mut self, density: f64)
[src]
Sets the density.
Might be slow since it precomputes a lot of stuff.
Default is 3.0.
fn set_distance_function<F>(&mut self, function: F) where
F: Fn(f64, f64) -> f64 + Sync + 'static,
[src]
F: Fn(f64, f64) -> f64 + Sync + 'static,
Sets the function to calculate the distance between feature points.
Default is the squared Euclidean distance.
fn set_value_function<F>(&mut self, function: F) where
F: Fn(Vec<f64>) -> f64 + Sync + 'static,
[src]
F: Fn(Vec<f64>) -> f64 + Sync + 'static,
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.
fn set_radius(&mut self, radius: u16)
[src]
Specifies how many adjacent cells should be included in the calculation.
A higher radius reduces the amount of possible errors but slows down sampling of individual points.
Shouldn't affect performance too much when iterating over a lot of points since the values get cached anyway.
Default is 1.
fn value(&self, x: f64, y: f64) -> f64
[src]
Calculates the noise value for the given point.
fn values(&self, points: &Vec<(f64, f64)>) -> Vec<f64>
[src]
Calculates the noise values for the given points.
Uses multiple threads.