SampleableFor

Trait SampleableFor 

Source
pub trait SampleableFor<I, T> {
    // Required method
    fn sample(&self, loc: I) -> T;
}
Expand description

Indicates that this noise is samplable by type I for type T. See also Sampleable.

Required Methods§

Source

fn sample(&self, loc: I) -> T

Samples the noise at loc for a result of type T. If both the result and input type can be inferred (as is often the case in practice), this can be more convenient than Sampleable::sample_for.

let noise = Noise::<common_noise::Perlin>::default();
let value: f32 = noise.sample(Vec2::new(1.0, -1.0));

This is generally inlined. This is useful to enable additional optimizations when sampling similar locs in a tight loop. If you are not calling this from a tight loop, maybe try DynamicSampleable::sample_dyn instead.

Implementors§

Source§

impl<T, I, N: NoiseFunction<I, Output: Into<T>>> SampleableFor<I, T> for RawNoise<N>

Source§

impl<T, I: VectorSpace<Scalar = f32>, N: NoiseFunction<I, Output: Into<T>>> SampleableFor<I, T> for Noise<N>