MCPcopy Create free account
hub / github.com/donkeyteethUX/iced_plot / advance_segment_to_x

Function advance_segment_to_x

src/plot_state.rs:1054–1059  ·  view source on GitHub ↗
(points: &[[f64; 2]], seg_idx: &mut usize, x: f64)

Source from the content-addressed store, hash-verified

1052 })
1053 .collect()
1054}
1055
1056/// Keep only strictly increasing-x points in their original order.
1057///
1058/// This avoids sorting and lets fill interpolation run in linear time.
1059/// Out-of-order (or duplicate-x) points are skipped.
1060fn monotonic_increasing_x(points: Vec<[f64; 2]>) -> Vec<[f64; 2]> {
1061 let mut out = Vec::with_capacity(points.len());
1062 let mut last_x: Option<f64> = None;

Calls

no outgoing calls

Tested by

no test coverage detected