fix(diagnostics): close the tiny-clamp finding rectangle

PlateOverlapRegion vertices repeat their closing vertex, and the
desktop overlay drops that last vertex when it builds the fill path.
The tolerance-free tiny-clamp finding returned four open corners, so
the overlay drew it as a triangle. Close the ring like every other
region.
This commit is contained in:
aj committed 2026-10-15 23:31:14 -04:00
1 parent 1c05f65571
commit 8663463945
2 files changed
+17

No files matched your search

@@ -339,6 +339,7 @@ public static class PlateOverlapAnalyzer
{
new Vector(zone.Left, zone.Bottom), new Vector(zone.Right, zone.Bottom),
new Vector(zone.Right, zone.Top), new Vector(zone.Left, zone.Top),
new Vector(zone.Left, zone.Bottom), // Regions repeat their closing vertex exactly.
};
var centre = new Vector((zone.Left + zone.Right) / 2, (zone.Bottom + zone.Top) / 2);
return new PlateOverlapPair(part.Input.Id, ClampFindingSlot.IdFor(clamp.Ordinal), part.Input.Name,
@@ -214,6 +214,22 @@ public class PlateOverlapAnalyzerClampZoneTests
Assert.Equal(overlaps, report.ClampFindings.Any(f => f.PartBName.Contains("tiny")));
}
// Region vertices repeat their closing vertex (PlateOverlapRegion contract); the desktop
// overlay drops the last vertex, so an open tiny-clamp rectangle drew as a triangle.
[Fact]
public void TinyClampFindingRegionIsAClosedRectangle()
{
var tiny = new ClampZone("tiny", new Box(8, 0, 1e-5, 1e-5));
var parts = new List<Part> { new(Square("p", 2), new Vector(7.5, 0)) };
var report = PlateOverlapAnalyzer.Analyze(PlateOverlapAnalyzer.Capture(parts, new[] { tiny }));
var region = Assert.Single(Assert.Single(report.ClampFindings).Regions);
Assert.Equal(5, region.Vertices.Count);
Assert.Equal(region.Vertices[0], region.Vertices[^1]);
Assert.Equal(4, region.Vertices.Take(4).Distinct().Count());
}
// PM 407f5eb7: real material, not the 0.001 arc flattening, decides a tiny clamp.
[Theory]
[InlineData("rect", 8.00002, 0.5, true)]