Skip to main content

SmoothingConfig

Struct SmoothingConfig 

Source
pub struct SmoothingConfig {
    pub tolerance: SmoothingTolerance,
    pub axes: Option<Vec<usize>>,
    pub parameters: Option<Vec<f64>>,
    pub max_refinements: usize,
    pub max_segments: usize,
    pub out_of_range_mode: OutOfRangeMode,
}
Expand description

Configuration for tolerance-bounded waypoint fitting.

Error is measured against the input polyline at the same parameter over the complete parameter domain, not only at waypoint columns. No kinematics, angle unwrapping, nearest-point search, or unit conversion is performed.

§Defaults

  • smooth every input row;
  • use absolute tolerance 0.001 on each selected row;
  • assign waypoint parameters uniformly on [0, 1];
  • allow at most 20 local refinement passes and 20,000 selected-axis spans;
  • reject queries outside the parameter domain.

§Example

This example smooths translational rows 0..=2 to 1e-3 input units and rotary rows 3..=4 to 1e-2 input units. Tolerance entries follow axes order.

use copp::path::{Path, SmoothingConfig, SmoothingTolerance};
use nalgebra::DMatrix;

let waypoints = DMatrix::from_fn(5, 4, |axis, point| {
    axis as f64 * 0.1 + point as f64
});
let config = SmoothingConfig {
    axes: Some(vec![0, 1, 2, 3, 4]),
    tolerance: SmoothingTolerance::PerAxis(vec![
        0.001, 0.001, 0.001, 0.01, 0.01,
    ]),
    ..Default::default()
};

let path = Path::from_waypoints_fitting(&waypoints, config)?;
assert_eq!(path.smoothing_report().unwrap().axes, vec![0, 1, 2, 3, 4]);

Fields§

§tolerance: SmoothingTolerance

Maximum absolute deviation from the reference polyline.

The default is SmoothingTolerance::Uniform(0.001). Every value is interpreted in the corresponding input row’s unit.

§axes: Option<Vec<usize>>

Input rows allowed to deviate from their reference polylines.

None selects every row. An explicit vector must be nonempty and contain distinct, in-range row indices. Its order also defines the order of SmoothingTolerance::PerAxis values and SmoothingReport::max_errors.

Unselected rows retain quintic C4 interpolation through all input columns, with zero first and second parameter derivatives at both ends.

§parameters: Option<Vec<f64>>

Common parameter assigned to each input column.

An explicit vector must have waypoints.ncols() finite, strictly increasing entries. Its first and last entries become the public path range. None assigns columns uniformly on [0, 1].

Relative parameter spacing affects the reference correspondence, data weights, smoothing penalty, and fitted geometry; it is not merely output metadata. A positive affine rescaling leaves the internally normalized geometry unchanged but rescales derivatives returned with respect to s.

§max_refinements: usize

Maximum number of adaptive knot-refinement passes.

The default is 20. Reaching this limit before the continuous interval audit passes returns PathError::Smoothing.

§max_segments: usize

Maximum number of polynomial spans used by the selected axes.

The default is 20,000. Spans belonging to the separate unselected-axis interpolant are reported independently and do not consume this budget.

§out_of_range_mode: OutOfRangeMode

Behavior when evaluating outside the configured parameter domain.

The default is OutOfRangeMode::Error. Clamping affects later queries, not fitting or auditing.

Trait Implementations§

Source§

impl Clone for SmoothingConfig

Source§

fn clone(&self) -> SmoothingConfig

Returns a duplicate 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 SmoothingConfig

Source§

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

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

impl Default for SmoothingConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
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.