ink_stroke_modeler_rs

Struct ModelerParams

source
pub struct ModelerParams {
    pub wobble_smoother_timeout: f64,
    pub wobble_smoother_speed_floor: f64,
    pub wobble_smoother_speed_ceiling: f64,
    pub position_modeler_spring_mass_constant: f64,
    pub position_modeler_drag_constant: f64,
    pub sampling_min_output_rate: f64,
    pub sampling_end_of_stroke_stopping_distance: f64,
    pub sampling_end_of_stroke_max_iterations: usize,
    pub sampling_max_outputs_per_call: usize,
    pub stylus_state_modeler_max_input_samples: usize,
}
Expand description

all parameters for the modeler

Fields§

§wobble_smoother_timeout: f64

these parameters are used to apply smoothing to the input to reduce wobble in the prediction

The length of the window over which the moving average of speed and position is calculated

Check if this can’t be done with the rust time types as this probably comes from a conversion to float (DURATION)

A good starting point is 2.5 / f input rate Should be positive

§wobble_smoother_speed_floor: f64

The range of speed considered for wobble smoothing. At ModelerParams::wobble_smoother_speed_floor the maximum amount of smoothing is applied. At ModelerParams::wobble_smoother_speed_ceiling, no smoothing is applied

Good starting points are 2 - 3 % of the expected speed of the inputs Should be positive and the speed floor smaller than the ceiling

§wobble_smoother_speed_ceiling: f64§position_modeler_spring_mass_constant: f64

The mass of the “weight” being pulled along the path, multiplied by the spring constant.

Should be positive

§position_modeler_drag_constant: f64

The ratio of the pen’s velocity that is subtracted from the pen’s acceleration per unit time, to simulate drag.

Should be positive

§sampling_min_output_rate: f64

The minimum number of modeled inputs to output per unit time. If inputs are received at a lower rate, they will be upsampled to produce output of atleast ModelerParams::sampling_min_output_rate. If inputs are received at a higher rate, the output rate will match the input rate.

Should be positive

§sampling_end_of_stroke_stopping_distance: f64

This determines the stop condition for the end-of-stroke modeling If the position is within this distance of the final raw input, or if the last update iteration moved less than this distance, it stops iterating.

this should be a small distance, good heuristic is 2-3 orders of magnitude smaller than the expected distance between input points

Should be positive

§sampling_end_of_stroke_max_iterations: usize

The maximum number of iterations to perform at the end of the stroke, if it does not stop due to the constraint of the sampling_end_of_stroke_stopping_distance

Should be positive and is capped at 1000 (to limit the memory requirements)

§sampling_max_outputs_per_call: usize

Maximum number of outputs to generate per call to Update or Predict. related to issues if input events are received with too long of a delay See what’s done in the rnote call and on this end to limit things like this

Should be strictly positive

§stylus_state_modeler_max_input_samples: usize

the maximum number of raw inputs to look at when searching for the nearest states when interpolating

Should be strictly positive

Implementations§

Trait Implementations§

source§

impl Clone for ModelerParams

source§

fn clone(&self) -> ModelerParams

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for ModelerParams

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl PartialEq for ModelerParams

source§

fn eq(&self, other: &ModelerParams) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for ModelerParams

source§

fn partial_cmp(&self, other: &ModelerParams) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Copy for ModelerParams

source§

impl StructuralPartialEq for ModelerParams

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.