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:
1 parent
0e3f01ec01
commit
b3dfcf1ff2
1 file changed
+10
-3
@@ -709,11 +709,18 @@ fn a_face_engraved_with_text_projects_its_letters_exactly_and_extrudes() {
|
|||||||
assert!(r.error.is_none(), "{r:?}");
|
assert!(r.error.is_none(), "{r:?}");
|
||||||
let face = before - volume(&mut s);
|
let face = before - volume(&mut s);
|
||||||
assert!((face - taken).abs() < 1e-6 * before, "{face} {taken}");
|
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 st = s.model.state();
|
||||||
let sketch = &st.sketches.last().unwrap().sketch;
|
let sketch = &st.sketches.last().unwrap().sketch;
|
||||||
let pieces =
|
let pieces = sketch
|
||||||
sketch.curves.iter().filter(|c| c.link.is_some() && matches!(c.kind, solidcraft_sketch::CurveKind::Spline { control: true, .. })).count();
|
.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}");
|
assert!(pieces > 100, "{pieces}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user