mirror of
https://github.com/bherbruck/solidcraft.git
synced 2026-11-03 10:35:58 +00:00
Tests: thicken and raised-band histories checked as SMLib reports them, Meet edges and seams included
check_kept panicked on any edge origin that was not an operand's edge, but a new edge where two faces meet has a Meet origin by the history's contract (EdgeOrigin::Meet), and SMLib's history gives them: the raised band's and the thickened sheet's new edges. It now checks the edges an operand still owns and passes over the meetings. The thickened sheet is the whole cylinder side (SMLib's one face, truck's half): a wall stands along each of its free edges, the two rims, and none along its seam, which the face meets itself along (2 + 2 faces, not 2 + its 3 edges). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -468,7 +468,8 @@ fn sweeps_along_paths() {
|
||||
check_sweep(&b, &side, &ring, Some(1));
|
||||
}
|
||||
|
||||
/// Kept faces are their origins, unchanged; each edge an operand still owns is that edge.
|
||||
/// Kept faces are their origins, unchanged; each edge an operand still owns is that edge (a new
|
||||
/// edge, where two faces meet, has a Meet origin instead).
|
||||
fn check_kept(result: &Body, input: &Body) {
|
||||
let h = result.history().unwrap();
|
||||
h.check(result, &[input]).unwrap();
|
||||
@@ -482,7 +483,11 @@ fn check_kept(result: &Body, input: &Body) {
|
||||
let mut owned = 0;
|
||||
for (e, p) in re.iter().zip(&h.edges) {
|
||||
for o in &p.origins {
|
||||
let crate::history::EdgeOrigin::Edge { operand: 0, edge } = o else { panic!("{o:?}") };
|
||||
let edge = match o {
|
||||
crate::history::EdgeOrigin::Edge { operand: 0, edge } => edge,
|
||||
crate::history::EdgeOrigin::Meet { .. } => continue,
|
||||
_ => panic!("{o:?}"),
|
||||
};
|
||||
assert!(e.mid.dist(ie[*edge].mid) < 1e-6, "edge {}", e.index);
|
||||
owned += 1;
|
||||
}
|
||||
@@ -506,12 +511,14 @@ fn thicken_reports_copies_offsets_and_walls() {
|
||||
let h = t.history().unwrap();
|
||||
assert_eq!(h.faces[0].origins, [FaceOrigin::Face { operand: 0, face: 0 }]);
|
||||
assert_eq!(h.faces[1].origins, [FaceOrigin::Offset { operand: 0, face: 0 }]);
|
||||
let free: Vec<usize> = (0..half.edge_count()).collect();
|
||||
// A wall along each free edge of the sheet: the side's two rims, not its seam (an edge the
|
||||
// one face meets itself along, no boundary).
|
||||
let free: Vec<usize> = (0..half.edge_count()).filter(|e| half.record().edges[*e].uses.len() == 1).collect();
|
||||
for (i, f) in h.faces.iter().enumerate().skip(2) {
|
||||
let [FaceOrigin::Edge { operand: 0, edge }] = f.origins.as_slice() else { panic!("{f:?}") };
|
||||
assert_eq!(*edge, nearest_edge(&t, i, &half, &free));
|
||||
}
|
||||
assert_eq!(h.faces.len(), 2 + half.edge_count());
|
||||
assert_eq!(h.faces.len(), 2 + free.len());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user