protected void SplitSubcontainerHorizontallyThenVertically(GuillotineCutSubcontainer3D subcontainer, PlacedObject3D placedObject) { var topSubcontainerPosition = new Position3D(subcontainer.X, placedObject.Y2, subcontainer.Z); var topSubcontainerSize = new Cuboid(subcontainer.Width, subcontainer.Height - placedObject.Height, subcontainer.Depth); var topSubcontainer = new GuillotineCutSubcontainer3D(topSubcontainerPosition, topSubcontainerSize.Width, topSubcontainerSize.Height, topSubcontainerSize.Depth); var rightSubcontainerPosition = new Position3D(placedObject.X2, subcontainer.Y, subcontainer.Z); var rightSubcontainerSize = new Cuboid(subcontainer.Width - placedObject.Width, placedObject.Height, subcontainer.Depth); var rightSubcontainer = new GuillotineCutSubcontainer3D(rightSubcontainerPosition, rightSubcontainerSize.Width, rightSubcontainerSize.Height, rightSubcontainerSize.Depth); var behindSubcontainerPosition = new Position3D(subcontainer.X, subcontainer.Y, placedObject.Z2); var behindSubcontainerSize = new Cuboid(placedObject.Width, placedObject.Height, subcontainer.Depth - placedObject.Depth); var behindSubcontainer = new GuillotineCutSubcontainer3D(behindSubcontainerPosition, behindSubcontainerSize.Width, behindSubcontainerSize.Height, behindSubcontainerSize.Depth); // No need to add one ore two dimensional container if (topSubcontainer.Width != 0 && topSubcontainer.Height != 0 && topSubcontainer.Depth != 0) { Subcontainers.Add(topSubcontainer); } if (rightSubcontainer.Width != 0 && rightSubcontainer.Height != 0 && rightSubcontainer.Depth != 0) { Subcontainers.Add(rightSubcontainer); } if (behindSubcontainer.Width != 0 && behindSubcontainer.Height != 0 && behindSubcontainer.Depth != 0) { Subcontainers.Add(behindSubcontainer); } Subcontainers.Remove(subcontainer); }
protected override SubContainer2D CreateSubcontainer(Position2D position, Rectangle size) { GuillotineCutSubcontainer2D newSubcontainer = new GuillotineCutSubcontainer2D(position.X, position.Y, size.Width, size.Height); Subcontainers.Add(newSubcontainer); return(newSubcontainer); }
protected override SubContainer3D CreateSubcontainer(Position3D position, Cuboid size) { GuillotineCutSubcontainer3D newSubcontainer = new GuillotineCutSubcontainer3D(position.X, position.Y, position.Z, size.Width, size.Height, size.Depth); Subcontainers.Add(newSubcontainer); return(newSubcontainer); }
public void AddShelf() { if (Subcontainers.Count != 0) { (TopShelf as ShelfSubContainer2D).SetShelfHeight(); } ShelfSubContainer2D newShelf; if (Subcontainers.Count == 0) { newShelf = new ShelfSubContainer2D(0, 0, this.Width, 0); } else { newShelf = new ShelfSubContainer2D(0, TopShelf.Y2, this.Width, 0); } Subcontainers.Add(newShelf); }
protected void SplitSubcontainerHorizontally(GuillotineCutSubcontainer2D subcontainer, PlacedObject2D placedObject) { var topSubcontainerPosition = new Position2D(subcontainer.X, placedObject.Y2); var topSubcontainerSize = new Rectangle(subcontainer.Width, subcontainer.Height - placedObject.Height); var topSubcontainer = new GuillotineCutSubcontainer2D(topSubcontainerPosition, topSubcontainerSize.Width, topSubcontainerSize.Height); var rightSubcontainerPosition = new Position2D(placedObject.X2, subcontainer.Y); var rightSubcontainerSize = new Rectangle(subcontainer.Width - placedObject.Width, placedObject.Height); var rightSubcontainer = new GuillotineCutSubcontainer2D(rightSubcontainerPosition, rightSubcontainerSize.Width, rightSubcontainerSize.Height); // No need to add one dimensional container if (topSubcontainer.Width != 0 && topSubcontainer.Height != 0) { Subcontainers.Add(topSubcontainer); } if (rightSubcontainer.Width != 0 && rightSubcontainer.Height != 0) { Subcontainers.Add(rightSubcontainer); } Subcontainers.Remove(subcontainer); }