static void DrawLayoutResult(ICloudLayouter layouter, Size[] rects, string layoutName) { foreach (var el in rects) { layouter.PutNextRectangle(el); } var resultImagePath = Path.Combine(Directory.GetCurrentDirectory(), $"{layoutName}.png"); CloudLayoutVisualizer.SaveAsPngImage(layouter.GetLayout(), resultImagePath); System.Console.WriteLine($"Layout {layoutName} saved to {resultImagePath}"); }
public void Should_PlaceManyRectanglesWithoutOverlaps() { foreach (var rect in _testRectsSizes) { _layouter.PutNextRectangle(rect); } var layout = _layouter.GetLayout(); foreach (var rectA in layout) { foreach (var rectB in layout) { if (rectA == rectB) { break; } rectA.IntersectsWith(rectB).Should().BeFalse(); } } }