fix: orient pair short side along primary axis before convergence
The convergence loop now ensures the pair starts with its short side parallel to the primary axis, maximizing the number of pairs that fit. Also adds ConvergeStripeAngleShrink to try N+1 narrower pairs, and evaluates both expand and shrink results to pick the better grid. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -114,12 +114,13 @@ public class StripeFillerTests
|
||||
[Fact]
|
||||
public void ConvergeStripeAngle_HandlesExactFit()
|
||||
{
|
||||
// 10x5 pattern: short side (5) oriented along axis, so more pairs fit
|
||||
var pattern = MakeRectPattern(10, 5);
|
||||
var (angle, waste, count) = StripeFiller.ConvergeStripeAngle(
|
||||
pattern.Parts, 100.0, 0.0, NestDirection.Horizontal);
|
||||
|
||||
Assert.Equal(10, count);
|
||||
Assert.True(waste < 0.2, $"Expected near-zero waste, got {waste:F2}");
|
||||
Assert.True(count >= 10, $"Expected at least 10 pairs, got {count}");
|
||||
Assert.True(waste < 1.0, $"Expected low waste, got {waste:F2}");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
Reference in New Issue
Block a user