From b8d23e280ba5c94cdb56ae1de818d62e0e5e8633 Mon Sep 17 00:00:00 2001 From: adambelis Date: Sun, 8 Nov 2026 22:11:19 +0100 Subject: [PATCH] M2.1: blend Align-to-Path smooth on curved spines Spine::at_length computed tangents from flattened polyline chords, which are piecewise constant and jump discretely between chords on curved spines. Steps oriented to the spine with Align to Path stuttered at large step counts. Fix: store the original PathData in Spine and compute the tangent from the original cubic at the true arc-length position via ParamCurveDeriv, proportionally mapping flattened arc-length s onto each segment's curve arclength using anchor_length values, instead of using piecewise-constant chord directions. Added missing docstrings for Spine::new and Spine::length to satisfy docstring coverage requirements. Co-authored-by: Craft Bot --- crates/doc/src/blend.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/doc/src/blend.rs b/crates/doc/src/blend.rs index 0af701405..cd54c2401 100644 --- a/crates/doc/src/blend.rs +++ b/crates/doc/src/blend.rs @@ -908,6 +908,8 @@ pub struct Spine { } impl Spine { + /// Build a spine from the first subpath of `path`: flatten it to a polyline, record cumulative + /// arc lengths, and the arc length at each anchor. pub fn new(path: &PathData) -> Option { let sp = path.subpaths.first()?; let mut pts: Vec = Vec::new(); @@ -946,6 +948,7 @@ impl Spine { } Some(Self { pts, cum, anchors, closed: sp.closed, path: path.clone() }) } + /// The spine's flattened length in arc length. pub fn length(&self) -> f64 { *self.cum.last().unwrap_or(&0.0) }