pub struct LutF64 { /* private fields */ }Expand description
A pre-computed interpolating lookup table mapping [0, 1] → f64.
Built at assembly time. Immutable and thread-safe after construction.
Implementations§
Source§impl LutF64
impl LutF64
Sourcepub fn from_fn(f: impl Fn(f64) -> f64, resolution: usize) -> Self
pub fn from_fn(f: impl Fn(f64) -> f64, resolution: usize) -> Self
Build from an arbitrary function over [0, 1].
f(p) is evaluated at resolution + 1 evenly spaced points
from 0.0 to 1.0. Non-finite results are replaced with the
nearest finite neighbor.
Sourcepub fn from_values(values: &[f64]) -> Self
pub fn from_values(values: &[f64]) -> Self
Build from a pre-computed slice of values.
Sourcepub fn sample(&self, u: f64) -> f64
pub fn sample(&self, u: f64) -> f64
Query the LUT with linear interpolation.
u should be in [0.0, 1.0]. Values outside are clamped.
Sourcepub fn resolution(&self) -> usize
pub fn resolution(&self) -> usize
The resolution (number of intervals).
Trait Implementations§
impl PolydatSetup for LutF64
Auto Trait Implementations§
impl Freeze for LutF64
impl RefUnwindSafe for LutF64
impl Send for LutF64
impl Sync for LutF64
impl Unpin for LutF64
impl UnsafeUnpin for LutF64
impl UnwindSafe for LutF64
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more