07-26-2023, 04:58 PM
I am currently developing a carrier module for [Kuroneko][1] which is a door-to-door Japanese delivery company. This carrier, along with the weight, takes the size of the box into consideration. But it doe not use the volume, it would be too easy. It uses the sum of the three dimensions (height, weight and depth).
If you've got only one product to box, it's still easy but what happens when you need to box 2 products? Let's say you have two products of dimensions (x1,y1,z1) and (x2,y2,z2), how do you calculate the final box size X,Y,Z in a way you keep X+Y+Z minimal?
Here is my provisional solution, but tell me if there's a better way to calculate:
let m1 be the minimal dimension of the first product, min(x1,y1,z1) and m2 for the second. You have to account for rotations of the products in the box to fit them in the best way and thus define new dimensions nx,ny,nz for both products. Let's suppose that nx = m. If m = x then ny = y, nz = z, else if m=y then, ny= x, nz = z, else if m=z, ny = y, nz= x. The total box size thus become 2*nx,max(ny1,ny2),max(nz1,nz2).
But as far as I see, I don't think this method will work for more than 2 products. Any idea?
[1]:
If you've got only one product to box, it's still easy but what happens when you need to box 2 products? Let's say you have two products of dimensions (x1,y1,z1) and (x2,y2,z2), how do you calculate the final box size X,Y,Z in a way you keep X+Y+Z minimal?
Here is my provisional solution, but tell me if there's a better way to calculate:
let m1 be the minimal dimension of the first product, min(x1,y1,z1) and m2 for the second. You have to account for rotations of the products in the box to fit them in the best way and thus define new dimensions nx,ny,nz for both products. Let's suppose that nx = m. If m = x then ny = y, nz = z, else if m=y then, ny= x, nz = z, else if m=z, ny = y, nz= x. The total box size thus become 2*nx,max(ny1,ny2),max(nz1,nz2).
But as far as I see, I don't think this method will work for more than 2 products. Any idea?
[1]:
[To see links please register here]