using System.Collections.Generic; namespace OpenNest.Geometry { public class ShapeProfile { public ShapeProfile(Shape shape) { Update(shape.Entities); } public ShapeProfile(List entities) { Update(entities); } private void Update(List entities) { var shapes = ShapeBuilder.GetShapes(entities); Perimeter = shapes[0]; Cutouts = new List(); for (var i = 1; i < shapes.Count; i++) { var bb = shapes[i].BoundingBox; var perimBB = Perimeter.BoundingBox; if (bb.Width * bb.Length > perimBB.Width * perimBB.Length) { Cutouts.Add(Perimeter); Perimeter = shapes[i]; } else { Cutouts.Add(shapes[i]); } } } public Shape Perimeter { get; set; } public List Cutouts { get; set; } } }