From 48e8988528926e27930444e1c3b1dcf570eff944 Mon Sep 17 00:00:00 2001 From: Hakan Seven Date: Wed, 22 Jul 2026 23:36:15 +0300 Subject: [PATCH] fix(spline): honour end tangents on a two-fit-point spline MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fit_spline_polyline bailed to a straight chord below three fit points, ignoring the stored begin/end tangents — a short tangent-clamped spline rendered as a line. The C² solver handles n=2 as-is (both end rows are clamp or natural conditions), so only the guard drops to n<2; tangentless two-point splines still solve to the straight chord. Co-Authored-By: Claude Fable 5 --- src/entities/spline.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/entities/spline.rs b/src/entities/spline.rs index 6329bcca6..00912332a 100644 --- a/src/entities/spline.rs +++ b/src/entities/spline.rs @@ -200,8 +200,7 @@ fn catmull_rom_polyline(pts: &[acadrust::types::Vector3], closed: bool) -> Vec<[ fn fit_spline_polyline(spl: &Spline) -> Vec<[f64; 3]> { let p: Vec<[f64; 3]> = spl.fit_points.iter().map(|q| [q.x, q.y, q.z]).collect(); let n = p.len(); - if n < 3 { - // A single segment can't be C²-fit; a straight chord is the honest draw. + if n < 2 { return p; }