Tests: an engraved face's letters project as conics, their exact quadratic Béziers

a_face_engraved_with_text_projects_its_letters_exactly_and_extrudes counted the letters' pieces
as control-point splines. A TrueType outline's curves are quadratic Béziers, which are parabolic
arcs, and the cut made on SMLib keeps them exact: the projection gives 222 conics and 154 lines,
no splines. The count now takes conics with the splines. (The cut itself needs SMLib 1a1bebc;
with it the test passes.)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jyviko
2026-10-29 01:30:09 -04:00
committed by Irakli Kourtis
parent 0e3f01ec01
commit b3dfcf1ff2
+10 -3
View File
@@ -709,11 +709,18 @@ fn a_face_engraved_with_text_projects_its_letters_exactly_and_extrudes() {
assert!(r.error.is_none(), "{r:?}");
let face = before - volume(&mut s);
assert!((face - taken).abs() < 1e-6 * before, "{face} {taken}");
// Its sketch got the letters as Bézier pieces.
// Its sketch got the letters as their exact pieces: the outline's quadratic Béziers, which are
// parabolic arcs, come in as conics (or as control-point splines).
let st = s.model.state();
let sketch = &st.sketches.last().unwrap().sketch;
let pieces =
sketch.curves.iter().filter(|c| c.link.is_some() && matches!(c.kind, solidcraft_sketch::CurveKind::Spline { control: true, .. })).count();
let pieces = sketch
.curves
.iter()
.filter(|c| {
c.link.is_some()
&& matches!(c.kind, solidcraft_sketch::CurveKind::Spline { control: true, .. } | solidcraft_sketch::CurveKind::Conic { .. })
})
.count();
assert!(pieces > 100, "{pieces}");
}