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.001on 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: SmoothingToleranceMaximum 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: usizeMaximum number of adaptive knot-refinement passes.
The default is 20. Reaching this limit before the continuous interval
audit passes returns PathError::Smoothing.
max_segments: usizeMaximum 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: OutOfRangeModeBehavior 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
impl Clone for SmoothingConfig
Source§fn clone(&self) -> SmoothingConfig
fn clone(&self) -> SmoothingConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SmoothingConfig
impl Debug for SmoothingConfig
Auto Trait Implementations§
impl Freeze for SmoothingConfig
impl RefUnwindSafe for SmoothingConfig
impl Send for SmoothingConfig
impl Sync for SmoothingConfig
impl Unpin for SmoothingConfig
impl UnwindSafe for SmoothingConfig
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> 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>
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 more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§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).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.