Ejemplo n.º 1
0
        public override PackingPosition FindExtremePointForItem(PackingItem item, bool rotated, bool stackingConstraints)
        {
            PackingItem newItem = new PackingItem(
                rotated ? item.Depth : item.Width,
                item.Height,
                rotated ? item.Width : item.Depth,
                item.TargetBin);

            int epIndex = 0;

            while (epIndex < ExtremePoints.Count && (
                       !IsPositionFeasible(newItem, ExtremePoints.ElementAt(epIndex)) ||
                       !IsSupportedByAtLeastOnePoint(newItem, ExtremePoints.ElementAt(epIndex)) ||
                       (stackingConstraints && !IsStaticStable(newItem, ExtremePoints.ElementAt(epIndex))) ||
                       (stackingConstraints && !IsWeightSupported(newItem, ExtremePoints.ElementAt(epIndex)))
                       ))
            {
                epIndex++;
            }

            if (epIndex < ExtremePoints.Count)
            {
                var origPoint = ExtremePoints.ElementAt(epIndex);
                var result    = new PackingPosition(origPoint.AssignedBin, origPoint.X, origPoint.Y, origPoint.Z, rotated);
                return(result);
            }
            return(null);
        }
Ejemplo n.º 2
0
        public override PackingPosition FindExtremePointForItem(PackingItem item, bool rotated, bool stackingConstraints)
        {
            PackingItem rotatedItem = new PackingItem(
                rotated ? item.Height : item.Width,
                rotated ? item.Width : item.Height,
                item.TargetBin);

            int epIndex = 0;

            while (epIndex < ExtremePoints.Count && (!IsPositionFeasible(rotatedItem, ExtremePoints.ElementAt(epIndex))))
            {
                epIndex++;
            }

            if (epIndex < ExtremePoints.Count)
            {
                var currentPoint = ExtremePoints.ElementAt(epIndex);

                var result = new PackingPosition(currentPoint.AssignedBin, currentPoint.X, currentPoint.Y, rotated);
                return(result);
            }
            return(null);
        }