[−][src]Struct worley_noise::WorleyNoise
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.
Use the WorleyNoise::values_3d_range
function if sampling a range of points, as it's even faster.
Implementations
impl WorleyNoise
[src]
pub const DEFAULT_RADIUS: u16
[src]
The default radius of cubes to include in the calculations
pub const DEFAULT_PERMUTATION_BITS: usize
[src]
The default bit length of the permutation table used for hashing.
pub const DEFAULT_DENSITY: f64
[src]
The default feature point density for each cube.
pub const DEFAULT_CACHE_CAPACITY: usize
[src]
The default cache capacity.
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]
&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]
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]
F: Fn(f64, 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]
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]
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.
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.
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.
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.
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.
pub fn values_3d_range(
&self,
start: (f64, f64, f64),
end: (f64, f64, f64),
sample_cnt: (u32, u32, u32)
) -> Vec<f64>
[src]
&self,
start: (f64, f64, f64),
end: (f64, f64, f64),
sample_cnt: (u32, u32, u32)
) -> Vec<f64>
Calculates the noise values between the given coordinates.
Significantly faster than sampling explicit points.
Does not cache values.
If the sample count is 0 in any dimension, the resulting vector will be empty.
Panics
- If one of the end coordinates is smaller than the start coordinates
pub fn values_2d_range(
&self,
start: (f64, f64),
end: (f64, f64),
sample_cnt: (u32, u32)
) -> Vec<f64>
[src]
&self,
start: (f64, f64),
end: (f64, f64),
sample_cnt: (u32, u32)
) -> Vec<f64>
Calculates the noise values between the given coordinates with z set to 0.0.
Significantly faster than sampling explicit points.
Does not cache values.
If the sample count is 0 in any dimension, the resulting vector will be empty.
Panics
- If one of the end coordinates is smaller than the start coordinates
pub fn clear_cache(&mut self)
[src]
Clears the internal cache to free up memory.
Auto Trait Implementations
impl !RefUnwindSafe for WorleyNoise
[src]
impl !Send for WorleyNoise
[src]
impl Sync for WorleyNoise
[src]
impl Unpin for WorleyNoise
[src]
impl !UnwindSafe for WorleyNoise
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,