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§
Sourcefn sample2a<Point>(&self, point: Point) -> f32
Available on crate feature nightly-simd
only.
fn sample2a<Point>(&self, point: Point) -> f32
nightly-simd
only.Samples the noise in 2D.
Sourcefn sample3a<Point>(&self, point: Point) -> f32
Available on crate feature nightly-simd
only.
fn sample3a<Point>(&self, point: Point) -> f32
nightly-simd
only.Samples the noise in 3D.
Sourcefn sample4a<Point>(&self, point: Point) -> f32
Available on crate feature nightly-simd
only.
fn sample4a<Point>(&self, point: Point) -> f32
nightly-simd
only.Samples the noise in 4D.
Sourcefn seed(self, seed: i32) -> Seeded<Self>where
Self: Sized,
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.
Sourcefn frequency<F>(self, frequency: F) -> Frequency<Self, F::Noise>where
Self: Sized,
F: ValueOrNoise,
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.
Sourcefn fbm(self, octaves: u32, gain: f32, lacunarity: f32) -> Fbm<Self>where
Self: Sized,
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.
Sourcefn ridged(self) -> Ridged<Self>where
Self: Sized,
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.
Sourcefn triangle_wave<F>(self, frequency: F) -> TriangleWave<Self, F::Noise>where
Self: Sized,
F: ValueOrNoise,
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.
Sourcefn tileable(self, width: f32, height: f32) -> Tileable<Self>where
Self: Sized,
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.
Sourcefn translate_x<X>(self, x: X) -> TranslateX<Self, X::Noise>where
Self: Sized,
X: ValueOrNoise,
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
.
Sourcefn translate_xy<X, Y>(self, x: X, y: Y) -> TranslateXy<Self, X::Noise, Y::Noise>
fn translate_xy<X, Y>(self, x: X, y: Y) -> TranslateXy<Self, X::Noise, Y::Noise>
Translates the point before it is used to sample self
.
Sourcefn translate_xyz<X, Y, Z>(
self,
x: X,
y: Y,
z: Z,
) -> TranslateXyz<Self, X::Noise, Y::Noise, Z::Noise>
fn translate_xyz<X, Y, Z>( self, x: X, y: Y, z: Z, ) -> TranslateXyz<Self, X::Noise, Y::Noise, Z::Noise>
Translates the point before it is used to sample self
.
Sourcefn 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>
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
.
Sourcefn add<Rhs>(self, rhs: Rhs) -> Add<Self, Rhs::Noise>where
Self: Sized,
Rhs: ValueOrNoise,
fn add<Rhs>(self, rhs: Rhs) -> Add<Self, Rhs::Noise>where
Self: Sized,
Rhs: ValueOrNoise,
Adds the output values.
Sourcefn sub<Rhs>(self, rhs: Rhs) -> Sub<Self, Rhs::Noise>where
Self: Sized,
Rhs: ValueOrNoise,
fn sub<Rhs>(self, rhs: Rhs) -> Sub<Self, Rhs::Noise>where
Self: Sized,
Rhs: ValueOrNoise,
Subtracts one output value from the other.
Sourcefn mul<Rhs>(self, rhs: Rhs) -> Mul<Self, Rhs::Noise>where
Self: Sized,
Rhs: ValueOrNoise,
fn mul<Rhs>(self, rhs: Rhs) -> Mul<Self, Rhs::Noise>where
Self: Sized,
Rhs: ValueOrNoise,
Multiplies the output values.
Sourcefn div<Rhs>(self, rhs: Rhs) -> Div<Self, Rhs::Noise>where
Self: Sized,
Rhs: ValueOrNoise,
fn div<Rhs>(self, rhs: Rhs) -> Div<Self, Rhs::Noise>where
Self: Sized,
Rhs: ValueOrNoise,
Divides one output value by the other.
Sourcefn rem<Rhs>(self, rhs: Rhs) -> Rem<Self, Rhs::Noise>where
Self: Sized,
Rhs: ValueOrNoise,
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.
Sourcefn min<Rhs>(self, rhs: Rhs) -> Min<Self, Rhs::Noise>where
Self: Sized,
Rhs: ValueOrNoise,
fn min<Rhs>(self, rhs: Rhs) -> Min<Self, Rhs::Noise>where
Self: Sized,
Rhs: ValueOrNoise,
Computes the minimum of the two output values.
Sourcefn max<Rhs>(self, rhs: Rhs) -> Max<Self, Rhs::Noise>where
Self: Sized,
Rhs: ValueOrNoise,
fn max<Rhs>(self, rhs: Rhs) -> Max<Self, Rhs::Noise>where
Self: Sized,
Rhs: ValueOrNoise,
Computes the maximum of the two output values.
Sourcefn clamp<Min, Max>(
self,
min: Min,
max: Max,
) -> Clamp<Self, Min::Noise, Max::Noise>
fn clamp<Min, Max>( self, min: Min, max: Max, ) -> Clamp<Self, Min::Noise, Max::Noise>
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)
.
Sourcefn lerp<B, T>(self, b: B, t: T) -> Lerp<Self, B::Noise, T::Noise>
fn lerp<B, T>(self, b: B, t: T) -> Lerp<Self, B::Noise, T::Noise>
Linearly interpolates between self
and b
.
Sourcefn pow<Rhs>(self, rhs: Rhs) -> Pow<Self, Rhs::Noise>where
Self: Sized,
Rhs: ValueOrNoise,
fn pow<Rhs>(self, rhs: Rhs) -> Pow<Self, Rhs::Noise>where
Self: Sized,
Rhs: ValueOrNoise,
Raises the output value to a power.
Sourcefn sqrt(self) -> Sqrt<Self>where
Self: Sized,
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
.
Sourcefn floor(self) -> Floor<Self>where
Self: Sized,
fn floor(self) -> Floor<Self>where
Self: Sized,
Computes the largest integer less than or equal to the output value.
Sourcefn ceil(self) -> Ceil<Self>where
Self: Sized,
fn ceil(self) -> Ceil<Self>where
Self: Sized,
Computes the smallest integer greater than or equal to self.
Sourcefn round(self) -> Round<Self>where
Self: Sized,
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.
Implementations on Foreign Types§
impl<N: Noise + ?Sized> Noise for Box<N>
alloc
only.