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§
Sourcefn sample(&self, loc: I) -> T
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.