pub struct ShapeBulkEval<E: BulkEvaluator> { /* private fields */ }Expand description
Wrapper around a BulkEvaluator
Unlike the raw bulk evaluator, a ShapeBulkEval knows about the
tape’s X, Y, Z axes and accepts a transform matrix.
Implementations§
Source§impl<E: BulkEvaluator> ShapeBulkEval<E>
impl<E: BulkEvaluator> ShapeBulkEval<E>
Sourcepub fn eval(
&mut self,
tape: &ShapeTape<E::Tape>,
x: &[E::Data],
y: &[E::Data],
z: &[E::Data],
) -> Result<&[E::Data], ShapeBulkEvalError>
pub fn eval( &mut self, tape: &ShapeTape<E::Tape>, x: &[E::Data], y: &[E::Data], z: &[E::Data], ) -> Result<&[E::Data], ShapeBulkEvalError>
Bulk evaluation of many samples, without any variables
If the shape includes variables other than X, Y, Z,
eval_with_vars or
eval_with_var_arrays should be used
instead (and this function will return an error).
Sourcepub fn eval_with_transform(
&mut self,
tape: &ShapeTape<E::Tape>,
x: &[E::Data],
y: &[E::Data],
z: &[E::Data],
transform: &Matrix4<f32>,
) -> Result<&[E::Data], ShapeBulkEvalError>
pub fn eval_with_transform( &mut self, tape: &ShapeTape<E::Tape>, x: &[E::Data], y: &[E::Data], z: &[E::Data], transform: &Matrix4<f32>, ) -> Result<&[E::Data], ShapeBulkEvalError>
Bulk evaluation of many samples with a transform
Sourcepub fn eval_with_var_arrays<V: Deref<Target = [G]>, G: Into<E::Data> + Copy>(
&mut self,
tape: &ShapeTape<E::Tape>,
x: &[E::Data],
y: &[E::Data],
z: &[E::Data],
vars: &ShapeVars<V>,
) -> Result<&[E::Data], ShapeBulkEvalError>
pub fn eval_with_var_arrays<V: Deref<Target = [G]>, G: Into<E::Data> + Copy>( &mut self, tape: &ShapeTape<E::Tape>, x: &[E::Data], y: &[E::Data], z: &[E::Data], vars: &ShapeVars<V>, ) -> Result<&[E::Data], ShapeBulkEvalError>
Bulk evaluation of many samples, with slices of variables
Each variable is a slice (or Vec) of values, which must be the same
length as the x, y, z slices. This is in contrast with
eval_with_vars, where variables have a single
value used for every position in the x, y, z slices.
Before evaluation, the transform matrix is applied to input coordinates.
Sourcepub fn eval_with_transform_and_var_arrays<V: Deref<Target = [G]>, G: Into<E::Data> + Copy>(
&mut self,
tape: &ShapeTape<E::Tape>,
x: &[E::Data],
y: &[E::Data],
z: &[E::Data],
transform: &Matrix4<f32>,
vars: &ShapeVars<V>,
) -> Result<&[E::Data], ShapeBulkEvalError>
pub fn eval_with_transform_and_var_arrays<V: Deref<Target = [G]>, G: Into<E::Data> + Copy>( &mut self, tape: &ShapeTape<E::Tape>, x: &[E::Data], y: &[E::Data], z: &[E::Data], transform: &Matrix4<f32>, vars: &ShapeVars<V>, ) -> Result<&[E::Data], ShapeBulkEvalError>
Bulk evaluation of many transformed samples, with slices of variables
Sourcepub fn eval_with_vars<G: Into<E::Data> + Copy>(
&mut self,
tape: &ShapeTape<E::Tape>,
x: &[E::Data],
y: &[E::Data],
z: &[E::Data],
vars: &ShapeVars<G>,
) -> Result<&[E::Data], ShapeBulkEvalError>
pub fn eval_with_vars<G: Into<E::Data> + Copy>( &mut self, tape: &ShapeTape<E::Tape>, x: &[E::Data], y: &[E::Data], z: &[E::Data], vars: &ShapeVars<G>, ) -> Result<&[E::Data], ShapeBulkEvalError>
Bulk evaluation of many samples, with fixed variables
Each variable has a single value, which is used for every position in
the x, y, z slices. This is in contrast with
eval_with_var_arrays, where variables
can be different for every position in the x, y, z slices.
Sourcepub fn eval_with_transform_and_vars<G: Into<E::Data> + Copy>(
&mut self,
tape: &ShapeTape<E::Tape>,
x: &[E::Data],
y: &[E::Data],
z: &[E::Data],
transform: &Matrix4<f32>,
vars: &ShapeVars<G>,
) -> Result<&[E::Data], ShapeBulkEvalError>
pub fn eval_with_transform_and_vars<G: Into<E::Data> + Copy>( &mut self, tape: &ShapeTape<E::Tape>, x: &[E::Data], y: &[E::Data], z: &[E::Data], transform: &Matrix4<f32>, vars: &ShapeVars<G>, ) -> Result<&[E::Data], ShapeBulkEvalError>
Bulk evaluation of many transformed samples, with fixed variables
Sourcepub fn var_array<V: Deref<Target = [G]>, G: Into<E::Data> + Copy>(
vars: &ShapeVars<V>,
) -> impl Fn(&mut [E::Data], VarIndex) -> Result<(), ShapeBulkEvalError>
pub fn var_array<V: Deref<Target = [G]>, G: Into<E::Data> + Copy>( vars: &ShapeVars<V>, ) -> impl Fn(&mut [E::Data], VarIndex) -> Result<(), ShapeBulkEvalError>
Helper to bind to a multi-value variable map
This is a building block for working with eval_raw,
and you probably don’t need it unless you’re deep in the weeds.
Sourcepub fn var_value<G: Into<E::Data> + Copy>(
vars: &ShapeVars<G>,
) -> impl Fn(&mut [E::Data], VarIndex) -> Result<(), ShapeBulkEvalError>
pub fn var_value<G: Into<E::Data> + Copy>( vars: &ShapeVars<G>, ) -> impl Fn(&mut [E::Data], VarIndex) -> Result<(), ShapeBulkEvalError>
Helper to bind to a single-variable map
This is a building block for working with eval_raw,
and you probably don’t need it unless you’re deep in the weeds.
Trait Implementations§
Source§impl<E: Debug + BulkEvaluator> Debug for ShapeBulkEval<E>
impl<E: Debug + BulkEvaluator> Debug for ShapeBulkEval<E>
Source§impl<E: Default + BulkEvaluator> Default for ShapeBulkEval<E>
impl<E: Default + BulkEvaluator> Default for ShapeBulkEval<E>
Source§fn default() -> ShapeBulkEval<E>
fn default() -> ShapeBulkEval<E>
Auto Trait Implementations§
impl<E> Freeze for ShapeBulkEval<E>where
E: Freeze,
impl<E> RefUnwindSafe for ShapeBulkEval<E>
impl<E> Send for ShapeBulkEval<E>
impl<E> Sync for ShapeBulkEval<E>
impl<E> Unpin for ShapeBulkEval<E>
impl<E> UnsafeUnpin for ShapeBulkEval<E>where
E: UnsafeUnpin,
impl<E> UnwindSafe for ShapeBulkEval<E>
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
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>
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>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.