pub struct Clut {
pub inputs: usize,
pub outputs: usize,
pub grid: Vec<usize>,
pub data: Vec<f32>,
/* private fields */
}Fields§
§inputs: usize§outputs: usize§grid: Vec<usize>Grid points per input dimension (each ≥ 2, or 1 for a degenerate dimension).
data: Vec<f32>Normalised node values, outputs per node.
Implementations§
Source§impl Clut
impl Clut
Sourcepub fn new(grid: Vec<usize>, outputs: usize, data: Vec<f32>) -> Self
pub fn new(grid: Vec<usize>, outputs: usize, data: Vec<f32>) -> Self
Builds a table from node data. Panics if data has the wrong length.
Sourcepub fn sample(
grid: Vec<usize>,
outputs: usize,
f: impl FnMut(&[f32], &mut [f32]),
) -> Self
pub fn sample( grid: Vec<usize>, outputs: usize, f: impl FnMut(&[f32], &mut [f32]), ) -> Self
Builds a table by sampling f at every node (inputs normalised to [0, 1]).
Sourcepub fn eval(&self, input: &[f32], out: &mut [f32])
pub fn eval(&self, input: &[f32], out: &mut [f32])
Interpolates at input (inputs values) into out (outputs values).
Sourcepub fn eval_trilinear(&self, input: &[f32], out: &mut [f32])
pub fn eval_trilinear(&self, input: &[f32], out: &mut [f32])
Trilinear interpolation (3 inputs), kept as a reference for accuracy comparisons.
Sourcepub fn eval_multilinear(&self, input: &[f32], out: &mut [f32])
pub fn eval_multilinear(&self, input: &[f32], out: &mut [f32])
Multilinear interpolation over all 2^n cube corners.
Trait Implementations§
impl StructuralPartialEq for Clut
Auto Trait Implementations§
impl Forget for Clut
impl Freeze for Clut
impl Move for Clut
impl RefUnwindSafe for Clut
impl Send for Clut
impl Sync for Clut
impl Unpin for Clut
impl UnsafeUnpin for Clut
impl UnwindSafe for Clut
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more