mirror of
https://github.com/bherbruck/solidcraft.git
synced 2026-11-03 10:35:58 +00:00
kernel: an arc's knots built without a borrowed temporary
(not built: base in progress) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017itGh5fpMEousnZ91cYcVt
This commit is contained in:
@@ -45,7 +45,11 @@ fn net(s: &Seg2) -> Result<(Vec<Vec2>, Vec<f64>, Vec<f64>)> {
|
||||
pts.push(at(a0 + d, radius));
|
||||
weights.push(1.0);
|
||||
let u = (j + 1) as f64 / m as f64;
|
||||
knots.extend(if j + 1 < m { [u, u].as_slice() } else { [1.0, 1.0, 1.0].as_slice() });
|
||||
if j + 1 < m {
|
||||
knots.extend([u, u]);
|
||||
} else {
|
||||
knots.extend([1.0; 3]);
|
||||
}
|
||||
}
|
||||
(pts, weights, knots)
|
||||
}
|
||||
@@ -95,6 +99,7 @@ pub(crate) fn segment(plane: &Plane, s: &Seg2) -> Result<(Curve, Curve2)> {
|
||||
[x * h, y * h, z * h, *h]
|
||||
})
|
||||
.collect();
|
||||
let pcurve = Curve2::RationalSpline { knots: knots.clone(), homogeneous: pts.iter().zip(&weights).map(|(q, h)| [q.x * h, q.y * h, *h]).collect() };
|
||||
let pcurve =
|
||||
Curve2::RationalSpline { knots: knots.clone(), homogeneous: pts.iter().zip(&weights).map(|(q, h)| [q.x * h, q.y * h, *h]).collect() };
|
||||
Ok((Curve::RationalSpline { knots, homogeneous }, pcurve))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user