Straight edges stay one edge after cuts (#1049) (#1101)

* Straight edges stay one edge after cuts (#1049)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Robustness goldens: cuts join straight edges along untouched walls (#1049)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fmt

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Robustness goldens note: what each changed seed shows when replayed on both builds

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
bherbruckandClaude Opus 5.5 authored and GitHub committed 2026-10-14 10:51:07 -04:00
1 parent ec64564f21
commit d019f2d5bf
7 files changed
+271 -41

No files matched your search

+38
View File
@@ -883,3 +883,41 @@ fn exact_profiles_for_high_degree_and_cut_free_form_curves() {
let uncut: f64 = find_profiles(&sk).iter().map(|p| p.area).sum();
assert!((whole - uncut).abs() < 1e-6 * uncut, "{whole} vs {uncut}");
}
/// A face boundary saved with stations along its straight edges (#1049: booleans used to leave
/// vertices nothing else used) keeps its saved pieces when the face comes back with each
/// straight edge whole: the same region, and features that name the pieces still find them.
#[test]
fn projected_boundary_keeps_its_pieces_when_only_stations_go() {
use crate::{LinkGeom, LinkKind, LinkSource};
let mut sk = Sketch::new();
let v = Vec2::new;
let split = vec![
LinkGeom::Line(v(0.0, 0.0), v(5.0, 0.0)),
LinkGeom::Line(v(5.0, 0.0), v(10.0, 0.0)),
LinkGeom::Line(v(10.0, 0.0), v(10.0, 4.0)),
LinkGeom::Line(v(10.0, 4.0), v(10.0, 10.0)),
LinkGeom::Line(v(10.0, 10.0), v(0.0, 10.0)),
LinkGeom::Line(v(0.0, 10.0), v(0.0, 0.0)),
];
let j = sk.add_link(LinkKind::Project, LinkSource::Origin, &split).unwrap();
let ids: Vec<String> = sk.link_curves(&j).iter().map(|c| sk.curves[*c].id.clone()).collect();
let whole = vec![
LinkGeom::Line(v(0.0, 0.0), v(10.0, 0.0)),
LinkGeom::Line(v(10.0, 0.0), v(10.0, 10.0)),
LinkGeom::Line(v(10.0, 10.0), v(0.0, 10.0)),
LinkGeom::Line(v(0.0, 10.0), v(0.0, 0.0)),
];
assert!(!sk.update_link(&j, &whole).unwrap(), "only the stations went: the pieces stay");
let kept: Vec<String> = sk.link_curves(&j).iter().map(|c| sk.curves[*c].id.clone()).collect();
assert_eq!(ids, kept);
// A boundary that really changed is rebuilt.
let smaller = vec![
LinkGeom::Line(v(0.0, 0.0), v(8.0, 0.0)),
LinkGeom::Line(v(8.0, 0.0), v(8.0, 10.0)),
LinkGeom::Line(v(8.0, 10.0), v(0.0, 10.0)),
LinkGeom::Line(v(0.0, 10.0), v(0.0, 0.0)),
];
assert!(sk.update_link(&j, &smaller).unwrap());
assert_eq!(sk.link_curves(&j).len(), 4);
}