Struct worley_noise::WorleyNoise [−][src]
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
function if sampling multiple points instead as it's concurrent.
Methods
impl WorleyNoise
[src]
impl WorleyNoise
pub const DEFAULT_RADIUS: u16
DEFAULT_RADIUS: u16 = 1
pub const DEFAULT_PERMUTATION_BITS: usize
DEFAULT_PERMUTATION_BITS: usize = 10
pub const DEFAULT_DENSITY: f64
DEFAULT_DENSITY: f64 = 3.0
pub const DEFAULT_CACHE_CAPACITY: usize
DEFAULT_CACHE_CAPACITY: usize = 2500
pub fn new() -> Self
[src]
pub fn new() -> Self
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]
pub fn with_cache_capacity(capacity: usize) -> Self
Initializes the struct with the specified cache capacity.
pub fn permutate(&mut self, permutation_table_bit_length: usize)
[src]
pub fn permutate(&mut self, permutation_table_bit_length: usize)
Calls WorleyNoise::permutate_seeded
with a random seed.
pub fn permutate_seeded(
&mut self,
permutation_table_bit_length: usize,
seed: u128
)
[src]
pub fn permutate_seeded(
&mut self,
permutation_table_bit_length: usize,
seed: u128
)
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]
pub fn set_density(&mut self, density: f64)
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 + Sync + 'static,
[src]
pub fn set_distance_function<F>(&mut self, function: F) where
F: Fn(f64, f64) -> f64 + Sync + 'static,
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]
pub fn set_value_function<F>(&mut self, function: F) where
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.
pub fn set_radius(&mut self, radius: u16)
[src]
pub fn set_radius(&mut self, radius: u16)
Specifies how many adjacent cells should be included in the value calculation.
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 value(&self, x: f64, y: f64) -> f64
[src]
pub fn value(&self, x: f64, y: f64) -> f64
Calculates the noise value for the given point.
pub fn values(&self, points: &Vec<(f64, f64)>) -> Vec<f64>
[src]
pub fn values(&self, points: &Vec<(f64, f64)>) -> Vec<f64>
Calculates the noise values for the given points in parallel.
Auto Trait Implementations
impl !Send for WorleyNoise
impl !Send for WorleyNoise
impl Sync for WorleyNoise
impl Sync for WorleyNoise