Trait Noise

Source
pub trait Noise {
Show 36 methods // Provided methods fn sample2<Point>(&self, point: Point) -> f32 where Self: Sized + Sample<2>, Point: Into<[f32; 2]> { ... } fn sample3<Point>(&self, point: Point) -> f32 where Self: Sized + Sample<3>, Point: Into<[f32; 3]> { ... } fn sample4<Point>(&self, point: Point) -> f32 where Self: Sized + Sample<4>, Point: Into<[f32; 4]> { ... } fn sample2a<Point>(&self, point: Point) -> f32 where Self: Sized + Sample<2, f32x2>, Point: Into<f32x2> { ... } fn sample3a<Point>(&self, point: Point) -> f32 where Self: Sized + Sample<3, f32x4>, Point: Into<f32x4> { ... } fn sample4a<Point>(&self, point: Point) -> f32 where Self: Sized + Sample<4, f32x4>, Point: Into<f32x4> { ... } fn seed(self, seed: i32) -> Seeded<Self> where Self: Sized { ... } fn add_seed(self, value: i32) -> AddSeed<Self> where Self: Sized { ... } fn mul_seed(self, value: i32) -> MulSeed<Self> where Self: Sized { ... } fn frequency<F>(self, frequency: F) -> Frequency<Self, F::Noise> where Self: Sized, F: ValueOrNoise { ... } fn fbm(self, octaves: u32, gain: f32, lacunarity: f32) -> Fbm<Self> where Self: Sized { ... } fn ridged(self) -> Ridged<Self> where Self: Sized { ... } fn triangle_wave<F>(self, frequency: F) -> TriangleWave<Self, F::Noise> where Self: Sized, F: ValueOrNoise { ... } fn tileable(self, width: f32, height: f32) -> Tileable<Self> where Self: Sized { ... } fn translate_x<X>(self, x: X) -> TranslateX<Self, X::Noise> where Self: Sized, X: ValueOrNoise { ... } fn translate_xy<X, Y>( self, x: X, y: Y, ) -> TranslateXy<Self, X::Noise, Y::Noise> where Self: Sized, X: ValueOrNoise, Y: ValueOrNoise { ... } fn translate_xyz<X, Y, Z>( self, x: X, y: Y, z: Z, ) -> TranslateXyz<Self, X::Noise, Y::Noise, Z::Noise> where Self: Sized, X: ValueOrNoise, Y: ValueOrNoise, Z: ValueOrNoise { ... } fn translate_xyzw<X, Y, Z, W>( self, x: X, y: Y, z: Z, w: W, ) -> TranslateXyzw<Self, X::Noise, Y::Noise, Z::Noise, W::Noise> where Self: Sized, X: ValueOrNoise, Y: ValueOrNoise, Z: ValueOrNoise, W: ValueOrNoise { ... } fn add<Rhs>(self, rhs: Rhs) -> Add<Self, Rhs::Noise> where Self: Sized, Rhs: ValueOrNoise { ... } fn sub<Rhs>(self, rhs: Rhs) -> Sub<Self, Rhs::Noise> where Self: Sized, Rhs: ValueOrNoise { ... } fn mul<Rhs>(self, rhs: Rhs) -> Mul<Self, Rhs::Noise> where Self: Sized, Rhs: ValueOrNoise { ... } fn div<Rhs>(self, rhs: Rhs) -> Div<Self, Rhs::Noise> where Self: Sized, Rhs: ValueOrNoise { ... } fn rem<Rhs>(self, rhs: Rhs) -> Rem<Self, Rhs::Noise> where Self: Sized, Rhs: ValueOrNoise { ... } fn min<Rhs>(self, rhs: Rhs) -> Min<Self, Rhs::Noise> where Self: Sized, Rhs: ValueOrNoise { ... } fn max<Rhs>(self, rhs: Rhs) -> Max<Self, Rhs::Noise> where Self: Sized, Rhs: ValueOrNoise { ... } fn clamp<Min, Max>( self, min: Min, max: Max, ) -> Clamp<Self, Min::Noise, Max::Noise> where Self: Sized, Min: ValueOrNoise, Max: ValueOrNoise { ... } fn lerp<B, T>(self, b: B, t: T) -> Lerp<Self, B::Noise, T::Noise> where Self: Sized, B: ValueOrNoise, T: ValueOrNoise { ... } fn pow<Rhs>(self, rhs: Rhs) -> Pow<Self, Rhs::Noise> where Self: Sized, Rhs: ValueOrNoise { ... } fn neg(self) -> Neg<Self> where Self: Sized { ... } fn abs(self) -> Abs<Self> where Self: Sized { ... } fn sqrt(self) -> Sqrt<Self> where Self: Sized { ... } fn floor(self) -> Floor<Self> where Self: Sized { ... } fn ceil(self) -> Ceil<Self> where Self: Sized { ... } fn round(self) -> Round<Self> where Self: Sized { ... } fn map<F>(self, f: F) -> Map<Self, F> where Self: Sized, F: Fn(f32) -> f32 { ... } fn by_ref(&self) -> &Self where Self: Sized { ... }
}
Expand description

Provides utility methods for noise types.

Provided Methods§

Source

fn sample2<Point>(&self, point: Point) -> f32
where Self: Sized + Sample<2>, Point: Into<[f32; 2]>,

Samples the noise in 2D.

Source

fn sample3<Point>(&self, point: Point) -> f32
where Self: Sized + Sample<3>, Point: Into<[f32; 3]>,

Samples the noise in 3D.

Source

fn sample4<Point>(&self, point: Point) -> f32
where Self: Sized + Sample<4>, Point: Into<[f32; 4]>,

Samples the noise in 3D.

Source

fn sample2a<Point>(&self, point: Point) -> f32
where Self: Sized + Sample<2, f32x2>, Point: Into<f32x2>,

Available on crate feature nightly-simd only.

Samples the noise in 2D.

Source

fn sample3a<Point>(&self, point: Point) -> f32
where Self: Sized + Sample<3, f32x4>, Point: Into<f32x4>,

Available on crate feature nightly-simd only.

Samples the noise in 3D.

Source

fn sample4a<Point>(&self, point: Point) -> f32
where Self: Sized + Sample<4, f32x4>, Point: Into<f32x4>,

Available on crate feature nightly-simd only.

Samples the noise in 4D.

Source

fn seed(self, seed: i32) -> Seeded<Self>
where Self: Sized,

Overwrites the seed to be sampled with.

For the sake of composition it can be better to use add_seed instead.

Source

fn add_seed(self, value: i32) -> AddSeed<Self>
where Self: Sized,

Adds value to the seed.

Source

fn mul_seed(self, value: i32) -> MulSeed<Self>
where Self: Sized,

Multiplies the seed by value.

Source

fn frequency<F>(self, frequency: F) -> Frequency<Self, F::Noise>
where Self: Sized, F: ValueOrNoise,

Modifies a noise with a frequency multiplier.

This multiplies the point by the provided frequency before sampling.

Source

fn fbm(self, octaves: u32, gain: f32, lacunarity: f32) -> Fbm<Self>
where Self: Sized,

Creates a fractal from this noise with the provided octaves, gain and lacunarity.

The seed, with which the fractal is sampled with, will be incremented after each octave.

Source

fn ridged(self) -> Ridged<Self>
where Self: Sized,

Modifies a noise to create a peak at 0.

This outputs values is in the [-1, 1] range.

Note: This modifier assumes self returns values in the [-1, 1] range.

Source

fn triangle_wave<F>(self, frequency: F) -> TriangleWave<Self, F::Noise>
where Self: Sized, F: ValueOrNoise,

Applies a triangle wave to the output of a noise function.

This outputs values is in the [-1, 1] range.

Note: This modifier assumes self returns values in the [-1, 1] range.

Source

fn tileable(self, width: f32, height: f32) -> Tileable<Self>
where Self: Sized,

Creates a tileable 2D noise from a 4D noise.

The parameters width and height describe the size of the repeating tile.

Source

fn translate_x<X>(self, x: X) -> TranslateX<Self, X::Noise>
where Self: Sized, X: ValueOrNoise,

Translates the point before it is used to sample self.

Source

fn translate_xy<X, Y>(self, x: X, y: Y) -> TranslateXy<Self, X::Noise, Y::Noise>
where Self: Sized, X: ValueOrNoise, Y: ValueOrNoise,

Translates the point before it is used to sample self.

Source

fn translate_xyz<X, Y, Z>( self, x: X, y: Y, z: Z, ) -> TranslateXyz<Self, X::Noise, Y::Noise, Z::Noise>
where Self: Sized, X: ValueOrNoise, Y: ValueOrNoise, Z: ValueOrNoise,

Translates the point before it is used to sample self.

Source

fn translate_xyzw<X, Y, Z, W>( self, x: X, y: Y, z: Z, w: W, ) -> TranslateXyzw<Self, X::Noise, Y::Noise, Z::Noise, W::Noise>

Translates the point before it is used to sample self.

Source

fn add<Rhs>(self, rhs: Rhs) -> Add<Self, Rhs::Noise>
where Self: Sized, Rhs: ValueOrNoise,

Adds the output values.

Source

fn sub<Rhs>(self, rhs: Rhs) -> Sub<Self, Rhs::Noise>
where Self: Sized, Rhs: ValueOrNoise,

Subtracts one output value from the other.

Source

fn mul<Rhs>(self, rhs: Rhs) -> Mul<Self, Rhs::Noise>
where Self: Sized, Rhs: ValueOrNoise,

Multiplies the output values.

Source

fn div<Rhs>(self, rhs: Rhs) -> Div<Self, Rhs::Noise>
where Self: Sized, Rhs: ValueOrNoise,

Divides one output value by the other.

Source

fn rem<Rhs>(self, rhs: Rhs) -> Rem<Self, Rhs::Noise>
where Self: Sized, Rhs: ValueOrNoise,

Calculates the remainder from dividing one output value by the other.

Source

fn min<Rhs>(self, rhs: Rhs) -> Min<Self, Rhs::Noise>
where Self: Sized, Rhs: ValueOrNoise,

Computes the minimum of the two output values.

Source

fn max<Rhs>(self, rhs: Rhs) -> Max<Self, Rhs::Noise>
where Self: Sized, Rhs: ValueOrNoise,

Computes the maximum of the two output values.

Source

fn clamp<Min, Max>( self, min: Min, max: Max, ) -> Clamp<Self, Min::Noise, Max::Noise>
where Self: Sized, Min: ValueOrNoise, Max: ValueOrNoise,

Returns max if value is greater than max and min if value is less than min. Otherwise this will return value.

Unlike f32::clamp, this modifier won’t panic if !(min <= max).

Source

fn lerp<B, T>(self, b: B, t: T) -> Lerp<Self, B::Noise, T::Noise>
where Self: Sized, B: ValueOrNoise, T: ValueOrNoise,

Linearly interpolates between self and b.

Source

fn pow<Rhs>(self, rhs: Rhs) -> Pow<Self, Rhs::Noise>
where Self: Sized, Rhs: ValueOrNoise,

Raises the output value to a power.

Source

fn neg(self) -> Neg<Self>
where Self: Sized,

Performs negation on the output value.

Source

fn abs(self) -> Abs<Self>
where Self: Sized,

Computes the absolute value of the output value.

Source

fn sqrt(self) -> Sqrt<Self>
where Self: Sized,

Returns the square root of a number.

Returns NaN if self is a negative number other than -0.0.

Source

fn floor(self) -> Floor<Self>
where Self: Sized,

Computes the largest integer less than or equal to the output value.

Source

fn ceil(self) -> Ceil<Self>
where Self: Sized,

Computes the smallest integer greater than or equal to self.

Source

fn round(self) -> Round<Self>
where Self: Sized,

Computes the nearest integer to the output value. If a value is half-way between two integers, round away from 0.0.

Source

fn map<F>(self, f: F) -> Map<Self, F>
where Self: Sized, F: Fn(f32) -> f32,

Maps the output value.

Source

fn by_ref(&self) -> &Self
where Self: Sized,

Returns the Noise by reference.

This reference also implements Noise.

Implementations on Foreign Types§

Source§

impl<N: Noise + ?Sized> Noise for Box<N>

Available on crate feature alloc only.
Source§

impl<N: Noise> Noise for &N

Implementors§

Source§

impl Noise for CellDistance

Source§

impl Noise for CellDistanceSq

Source§

impl Noise for CellValue

Source§

impl Noise for Constant

Source§

impl Noise for OpenSimplex2

Source§

impl Noise for OpenSimplex2s

Source§

impl Noise for Perlin

Source§

impl Noise for Simplex

Source§

impl Noise for Value

Source§

impl Noise for ValueCubic

Source§

impl<A, B> Noise for Add<A, B>

Source§

impl<A, B> Noise for Div<A, B>

Source§

impl<A, B> Noise for Max<A, B>

Source§

impl<A, B> Noise for Min<A, B>

Source§

impl<A, B> Noise for Mul<A, B>

Source§

impl<A, B> Noise for Pow<A, B>

Source§

impl<A, B> Noise for Rem<A, B>

Source§

impl<A, B> Noise for Sub<A, B>

Source§

impl<A, B, T> Noise for Lerp<A, B, T>

Source§

impl<F, const WITH_SEED: bool> Noise for NoiseFn<F, WITH_SEED>

Source§

impl<Fractal> Noise for Weighted<Fractal>

Source§

impl<N> Noise for Improve2X<N>

Source§

impl<N> Noise for Improve3Xy<N>

Source§

impl<N> Noise for Improve3Xz<N>

Source§

impl<N> Noise for Improve4XyZw<N>

Source§

impl<N> Noise for Improve4Xyz<N>

Source§

impl<N> Noise for Improve4XyzXy<N>

Source§

impl<N> Noise for Improve4XyzXz<N>

Source§

impl<N> Noise for Abs<N>

Source§

impl<N> Noise for AddSeed<N>

Source§

impl<N> Noise for Ceil<N>

Source§

impl<N> Noise for Fbm<N>

Source§

impl<N> Noise for Floor<N>

Source§

impl<N> Noise for MulSeed<N>

Source§

impl<N> Noise for Neg<N>

Source§

impl<N> Noise for Ridged<N>

Source§

impl<N> Noise for Round<N>

Source§

impl<N> Noise for Seeded<N>

Source§

impl<N> Noise for Sqrt<N>

Source§

impl<N> Noise for Tileable<N>

Source§

impl<N, F> Noise for Frequency<N, F>

Source§

impl<N, F> Noise for Map<N, F>

Source§

impl<N, F> Noise for TriangleWave<N, F>

Source§

impl<N, X> Noise for TranslateX<N, X>

Source§

impl<N, X, Y> Noise for TranslateXy<N, X, Y>

Source§

impl<N, X, Y, Z> Noise for TranslateXyz<N, X, Y, Z>

Source§

impl<N, X, Y, Z, W> Noise for TranslateXyzw<N, X, Y, Z, W>

Source§

impl<Value, Min, Max> Noise for Clamp<Value, Min, Max>