Skip to content

Commit

Permalink
Fix issue #574
Browse files Browse the repository at this point in the history
  • Loading branch information
skjolber committed Oct 21, 2022
1 parent f45048a commit e4dda95
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public DefaultPackResult pack(List<Stackable> stackables, Container targetContai

StackPlacement first = new StackPlacement(stackable, firstStackValue, 0, 0, 0, -1, -1);

levelStack.add(first);
levelStack.add(first);

int maxRemainingLevelWeight = levelStackValue.getMaxLoadWeight() - stackable.getWeight();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ public Point3D<P> rotate() {
@Override
public String toString() {
return getClass().getSimpleName() + " [" + minX + "x" + minY + "x" + minZ + " " + maxX + "x" + maxY
+ "x" + maxZ + " xy=" + xyPlane + " xz=" + xzPlane + " yz=" + yzPlane + "]";
+ "x" + maxZ + " " + "(" + dx + "x" + dy + "x" + dz + ") xy=" + xyPlane + " xz=" + xzPlane + " yz=" + yzPlane + "]";
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1550,7 +1550,7 @@ public long getMaxVolume() {
long maxPointVolume = -1L;
for(int i = 0; i < values.size(); i++) {
Point3D<P> point = values.get(i);
if(maxPointVolume < point.getArea()) {
if(maxPointVolume < point.getVolume()) {
maxPointVolume = point.getVolume();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -611,4 +611,20 @@ public void testLAFFPackager() throws Exception {

write(fits);
}

@Test
public void testFourForTwo() throws Exception {
List<Container> containers = new ArrayList<>();
containers.add(Container.newBuilder().withDescription("1").withEmptyWeight(0).withSize(60, 40, 25).withMaxLoadWeight(100).build());

LargestAreaFitFirstPackager packager = LargestAreaFitFirstPackager.newBuilder().withContainers(containers).build();

StackableItem b1 = new StackableItem(Box.newBuilder().withId("b1").withDescription("b1").withSize(35, 25, 14).withWeight(0).withRotate3D().build(), 1);
StackableItem b2 = new StackableItem(Box.newBuilder().withId("b2").withDescription("b2").withSize(35, 25, 14).withWeight(0).withRotate3D().build(), 1);
StackableItem b3 = new StackableItem(Box.newBuilder().withId("b3").withDescription("b3").withSize(35, 23, 13).withWeight(0).withRotate3D().build(), 1);
StackableItem b4 = new StackableItem(Box.newBuilder().withId("b4").withDescription("b4").withSize(35, 25, 14).withWeight(0).withRotate3D().build(), 1);

List<Container> packaging = packager.packList(Arrays.asList(b1, b2, b3, b4), 100);
write(packaging);
}
}

0 comments on commit e4dda95

Please sign in to comment.