refactor(snap): keep the ellipse-arc parameter test private and plain

Only snap.rs uses it; the full-turn checks collapse into one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Hakan SevenandClaude Opus 5.5 committed 2026-10-01 01:22:43 +03:00
1 parent 66ca17e8fc
commit 34dfee032d
1 file changed
+10 -17
+10 -17
View File
@@ -3290,25 +3290,18 @@ fn arc_tangent_points(
.collect() .collect()
} }
pub fn is_ellipse_param_on_arc(t: f64, start_param: f64, end_param: f64) -> bool { /// Whether ellipse parameter `t` lies on the arc running counter-clockwise
let raw_sweep = end_param - start_param; /// from `start_param` to `end_param`. A zero or full-turn span is the whole
if (raw_sweep.abs() - std::f64::consts::TAU).abs() < 1e-9 /// ellipse.
|| raw_sweep.abs() >= std::f64::consts::TAU - 1e-9 fn is_ellipse_param_on_arc(t: f64, start_param: f64, end_param: f64) -> bool {
|| raw_sweep.abs() < 1e-9 use std::f64::consts::TAU;
{ let span = end_param - start_param;
if span.abs() < 1e-9 || span.abs() >= TAU - 1e-9 {
return true; return true;
} }
let sweep = raw_sweep.rem_euclid(std::f64::consts::TAU); let sweep = span.rem_euclid(TAU);
let sweep = if sweep.abs() <= 1e-9 && raw_sweep.abs() > 1e-5 { let along = (t - start_param).rem_euclid(TAU);
std::f64::consts::TAU along <= sweep + 1e-6 || along >= TAU - 1e-6
} else {
sweep
};
if sweep >= std::f64::consts::TAU - 1e-9 {
return true;
}
let d_t = (t - start_param).rem_euclid(std::f64::consts::TAU);
d_t <= sweep + 1e-6 || d_t >= std::f64::consts::TAU - 1e-6
} }
fn planar_ellipse_tangent_points( fn planar_ellipse_tangent_points(