Modern Apps git

← Modern-Apps.git

measure: move VIO point helpers into vio_part1.rs

Commit
1b58b3765b789eeb4ac092256f22bea058fb9f15
Author
Vayun Mathur <[email protected]>
When
2026-11-07 20:14 UTC (28 days ago)
Parents
9a414e9
The keyframe-correspondence fix grew vio.rs to 527 lines, over the
repo's 500-line rustFileLength gate. Move the free helpers
(detect_points, merge_points, median) into vio_part1.rs, which
vio.rs already includes, so they stay in the same module with no
call-site changes. No behaviour change.

Verification: cargo test -p measure_vio --lib: 44 passed;
:measure:compileDevKotlin now reaches Kotlin compilation.

Diff

measure/src/main/rust/src/vio.rs
diff --git a/measure/src/main/rust/src/vio.rs b/measure/src/main/rust/src/vio.rsindex 968b09f113..12c6580450 100644--- a/measure/src/main/rust/src/vio.rs+++ b/measure/src/main/rust/src/vio.rs@@ -495,33 +495,4 @@ impl VioSession {     } } -fn detect_points(gray: &Gray) -> Vec<(f32, f32)> {-    let f = detect_and_describe(gray, TARGET_FEATURES, FAST_THRESHOLD);-    f.kps.iter().map(|k| (k.x, k.y)).collect()-}--/// Add fresh detections that are not already covered, up to `target`.-fn merge_points(existing: &mut Vec<(f32, f32)>, fresh: &[(f32, f32)], target: usize) {-    const MIN_SEP2: f32 = 100.0; // 10 px-    for &f in fresh {-        if existing.len() >= target {-            break;-        }-        let too_close = existing-            .iter()-            .any(|&e| (e.0 - f.0).powi(2) + (e.1 - f.1).powi(2) < MIN_SEP2);-        if !too_close {-            existing.push(f);-        }-    }-}--fn median(v: &mut [f32]) -> f32 {-    if v.is_empty() {-        return 0.0;-    }-    v.sort_by(|a, b| a.total_cmp(b));-    v[v.len() / 2]-}- include!("vio_part1.rs");\ No newline at end of file
measure/src/main/rust/src/vio_part1.rs
diff --git a/measure/src/main/rust/src/vio_part1.rs b/measure/src/main/rust/src/vio_part1.rsindex 9ed8c64056..e2818dd5ed 100644--- a/measure/src/main/rust/src/vio_part1.rs+++ b/measure/src/main/rust/src/vio_part1.rs@@ -1,3 +1,33 @@+fn detect_points(gray: &Gray) -> Vec<(f32, f32)> {+    let f = detect_and_describe(gray, TARGET_FEATURES, FAST_THRESHOLD);+    f.kps.iter().map(|k| (k.x, k.y)).collect()+}++/// Add fresh detections that are not already covered, up to `target`.+fn merge_points(existing: &mut Vec<(f32, f32)>, fresh: &[(f32, f32)], target: usize) {+    const MIN_SEP2: f32 = 100.0; // 10 px+    for &f in fresh {+        if existing.len() >= target {+            break;+        }+        let too_close = existing+            .iter()+            .any(|&e| (e.0 - f.0).powi(2) + (e.1 - f.1).powi(2) < MIN_SEP2);+        if !too_close {+            existing.push(f);+        }+    }+}++fn median(v: &mut [f32]) -> f32 {+    if v.is_empty() {+        return 0.0;+    }+    v.sort_by(|a, b| a.total_cmp(b));+    v[v.len() / 2]+}++ #[cfg(test)] mod tests {     use super::*;