Exact profiles for splines of any degree (a degree-4…7 Bézier segment kind, Seg2::Bezier, extruded as B-spline edges) and for free-form curves cut by crossings (exact sub-curves whose ends are moved to the true crossing, found by Newton; polylines only where that fails)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AS5Tn3xieewUSg3uxrMVdL
This commit is contained in:
1 parent
f79b5c1045
commit
b9bc75670c
11 files changed
+389
-34
No files matched your search
@@ -153,6 +153,15 @@ fn add_pieces(sk: &mut Sketch, segs: &[Seg2], start: Option<usize>, end: Option<
|
||||
let x = sk.add_point(apex, None)?;
|
||||
CurveKind::Conic { a: prev, b: to, apex: x, rho: w / (1.0 + w) }
|
||||
}
|
||||
Seg2::Bezier { n, p } => {
|
||||
let k = (n as usize).clamp(1, solvecraft_geom::MAX_BEZIER_DEGREE);
|
||||
let mut pts = vec![prev];
|
||||
for q in p.iter().take(k).skip(1) {
|
||||
pts.push(sk.add_point(*q, None)?);
|
||||
}
|
||||
pts.push(to);
|
||||
CurveKind::Spline { pts, control: true, degree: n }
|
||||
}
|
||||
Seg2::Arc { .. } => return Err(bad("trim", "unexpected arc piece")),
|
||||
};
|
||||
let c = sk.add_curve(kind, None)?;
|
||||
|
||||
Reference in new issue
Block a user