Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

z-dimension stacking isn't accurate #12

Open
djkim9031 opened this issue Jul 17, 2020 · 3 comments
Open

z-dimension stacking isn't accurate #12

djkim9031 opened this issue Jul 17, 2020 · 3 comments

Comments

@djkim9031
Copy link

As the code only compares whether there is an overlapping part between two items in xy-plane, z-dimension stacking isn't accurate.
Just tested with
-> Bin('large-3-box', 23.6875, 11.75, 35.0, 1000.0)
and items
-> packer.add_item(Item('50g [powder 1]', 3.9370, 1.9685, 11.9685, 1))
packer.add_item(Item('50g [powder 2]', 3.9370, 1.9685, 1.9685, 2))
packer.add_item(Item('50g [powder 3]', 3.9370, 1.9685, 1.9685, 3))
packer.add_item(Item('250g [powder 4]', 7.8740, 3.9370, 1.9685, 4))
packer.add_item(Item('250g [powder 5]', 7.8740, 3.9370, 1.9685, 5))
packer.add_item(Item('250g [powder 6]', 7.8740, 3.9370, 1.9685, 6))
packer.add_item(Item('250g [powder 7]', 7.8740, 3.9370, 1.9685, 7))
packer.add_item(Item('250g [powder 8]', 7.8740, 3.9370, 1.9685, 8))
packer.add_item(Item('250g [powder 9]', 7.8740, 3.9370, 1.9685, 9))
packer.add_item(Item('250g [powder 10]', 7.8740, 3.9370, 1.9685, 10))
packer.add_item(Item('250g [powder 11]', 7.8740, 3.9370, 1.9685, 11))
packer.add_item(Item('250g [powder 12]', 7.8740, 3.9370, 1.9685, 6))
packer.add_item(Item('250g [powder 7]', 7.8740, 3.9370, 1.9685, 7))
packer.add_item(Item('250g [powder 8]', 7.8740, 3.9370, 1.9685, 8))
packer.add_item(Item('250g [powder 9]', 7.8740, 3.9370, 1.9685, 9))
packer.add_item(Item('250g [powder 4]', 7.8740, 3.9370, 1.9685, 4))
packer.add_item(Item('250g [powder 5]', 7.8740, 3.9370, 1.9685, 5))
packer.add_item(Item('250g [powder 6]', 7.8740, 3.9370, 1.9685, 6))
packer.add_item(Item('250g [powder 7]', 7.8740, 3.9370, 1.9685, 7))
packer.add_item(Item('250g [powder 8]', 7.8740, 3.9370, 1.9685, 8))
packer.add_item(Item('250g [powder 9]', 7.8740, 3.9370, 1.9685, 9))

I have arbitrarily given 11.9685 as the height of 'powder 1' for a bigger box with dimension [23.6875, 11.75, 35.0] just for the sake of random experiment. Each item gets stacked fine in the base layer (z=0) but when the base layer is all filled, things get stacked at z=11.9685 for the remainder of items, which makes the items float.

@lairdrt
Copy link

lairdrt commented Apr 1, 2022

I don't see that, must be missing something. From your data, I get the following output:

::::::::::: large-3-box(23.688x11.750x35.000, max_weight:1000.000) vol(9741.690)
FITTED ITEMS:
====> 50g [powder 2](3.937x1.968x1.968, weight: 2.000) pos([0, 0, 0]) rt(0) vol(15.248)
====> 50g [powder 3](3.937x1.968x1.968, weight: 3.000) pos([Decimal('3.937'), 0, 0]) rt(0) vol(15.248)
====> 250g [powder 4](7.874x3.937x1.968, weight: 4.000) pos([Decimal('7.874'), 0, 0]) rt(0) vol(61.008)
====> 250g [powder 5](7.874x3.937x1.968, weight: 5.000) pos([Decimal('15.748'), 0, 0]) rt(0) vol(61.008)
====> 250g [powder 6](7.874x3.937x1.968, weight: 6.000) pos([0, Decimal('1.968'), 0]) rt(0) vol(61.008)
====> 250g [powder 7](7.874x3.937x1.968, weight: 7.000) pos([Decimal('7.874'), Decimal('3.937'), 0]) rt(0) vol(61.008)
====> 250g [powder 8](7.874x3.937x1.968, weight: 8.000) pos([Decimal('15.748'), Decimal('3.937'), 0]) rt(0) vol(61.008)
====> 250g [powder 9](7.874x3.937x1.968, weight: 9.000) pos([0, Decimal('5.905'), 0]) rt(0) vol(61.008)
====> 250g [powder 10](7.874x3.937x1.968, weight: 10.000) pos([Decimal('7.874'), Decimal('7.874'), 0]) rt(2) vol(61.008)
====> 250g [powder 11](7.874x3.937x1.968, weight: 11.000) pos([Decimal('11.811'), Decimal('7.874'), 0]) rt(2) vol(61.008)
====> 250g [powder 12](7.874x3.937x1.968, weight: 6.000) pos([Decimal('15.748'), Decimal('7.874'), 0]) rt(2) vol(61.008)
====> 250g [powder 7](7.874x3.937x1.968, weight: 7.000) pos([Decimal('19.685'), Decimal('7.874'), 0]) rt(2) vol(61.008)
====> 250g [powder 8](7.874x3.937x1.968, weight: 8.000) pos([0, 0, Decimal('1.968')]) rt(0) vol(61.008)
====> 250g [powder 9](7.874x3.937x1.968, weight: 9.000) pos([Decimal('7.874'), 0, Decimal('1.968')]) rt(0) vol(61.008)
====> 250g [powder 4](7.874x3.937x1.968, weight: 4.000) pos([Decimal('15.748'), 0, Decimal('1.968')]) rt(0) vol(61.008)
====> 250g [powder 5](7.874x3.937x1.968, weight: 5.000) pos([0, Decimal('3.937'), Decimal('1.968')]) rt(0) vol(61.008)
====> 250g [powder 6](7.874x3.937x1.968, weight: 6.000) pos([Decimal('7.874'), Decimal('3.937'), Decimal('1.968')]) rt(0) vol(61.008)
====> 250g [powder 7](7.874x3.937x1.968, weight: 7.000) pos([Decimal('15.748'), Decimal('3.937'), Decimal('1.968')]) rt(0) vol(61.008)
====> 250g [powder 8](7.874x3.937x1.968, weight: 8.000) pos([0, Decimal('7.874'), Decimal('1.968')]) rt(2) vol(61.008)
====> 250g [powder 9](7.874x3.937x1.968, weight: 9.000) pos([Decimal('3.937'), Decimal('7.874'), Decimal('1.968')]) rt(2) vol(61.008)
====> 50g [powder 1](3.937x1.968x11.969, weight: 1.000) pos([Decimal('7.874'), Decimal('7.874'), Decimal('7.874')]) rt(0) vol(92.736)
UNFITTED ITEMS:
***************************************************
***************************************************

First item I see at z-axis > 0 is @ 1.968?

@lairdrt
Copy link

lairdrt commented Apr 5, 2022

After removing the decimal formatting methods (which seem to result in highly rounded item positions), for your data set, I now get the following:

::::::::::: large-3-box(23.6875 x 11.75 x 35.0, max_weight:1000.0) vol(9741.484375)
FITTED ITEMS:
====> 50g [powder 2](3.937 x 1.9685 x 1.9685, weight: 2) pos(0.0000, 0.0000, 0.0000) rt(0) vol(15.2558)
====> 50g [powder 3](3.937 x 1.9685 x 1.9685, weight: 3) pos(3.9370, 0.0000, 0.0000) rt(0) vol(15.2558)
====> 250g [powder 4](7.874 x 3.937 x 1.9685, weight: 4) pos(7.8740, 0.0000, 0.0000) rt(0) vol(61.0234)
====> 250g [powder 5](7.874 x 3.937 x 1.9685, weight: 5) pos(15.7480, 0.0000, 0.0000) rt(1) vol(61.0234)
====> 250g [powder 6](7.874 x 3.937 x 1.9685, weight: 6) pos(0.0000, 1.9685, 0.0000) rt(0) vol(61.0234)
====> 250g [powder 7](7.874 x 3.937 x 1.9685, weight: 7) pos(7.8740, 3.9370, 0.0000) rt(0) vol(61.0234)
====> 250g [powder 8](7.874 x 3.937 x 1.9685, weight: 8) pos(15.7480, 7.8740, 0.0000) rt(2) vol(61.0234)
====> 250g [powder 9](7.874 x 3.937 x 1.9685, weight: 9) pos(0.0000, 5.9055, 0.0000) rt(0) vol(61.0234)
====> 250g [powder 10](7.874 x 3.937 x 1.9685, weight: 10) pos(7.8740, 7.8740, 0.0000) rt(2) vol(61.0234)
====> 250g [powder 11](7.874 x 3.937 x 1.9685, weight: 11) pos(0.0000, 0.0000, 1.9685) rt(0) vol(61.0234)
====> 250g [powder 12](7.874 x 3.937 x 1.9685, weight: 6) pos(7.8740, 0.0000, 1.9685) rt(0) vol(61.0234)
====> 250g [powder 7](7.874 x 3.937 x 1.9685, weight: 7) pos(15.7480, 0.0000, 1.9685) rt(1) vol(61.0234)
====> 250g [powder 8](7.874 x 3.937 x 1.9685, weight: 8) pos(0.0000, 3.9370, 1.9685) rt(0) vol(61.0234)
====> 250g [powder 9](7.874 x 3.937 x 1.9685, weight: 9) pos(7.8740, 3.9370, 1.9685) rt(0) vol(61.0234)
====> 250g [powder 4](7.874 x 3.937 x 1.9685, weight: 4) pos(0.0000, 7.8740, 1.9685) rt(2) vol(61.0234)
====> 250g [powder 5](7.874 x 3.937 x 1.9685, weight: 5) pos(15.7480, 7.8740, 7.8740) rt(2) vol(61.0234)
====> 250g [powder 6](7.874 x 3.937 x 1.9685, weight: 6) pos(7.8740, 7.8740, 7.8740) rt(2) vol(61.0234)
====> 250g [powder 7](7.874 x 3.937 x 1.9685, weight: 7) pos(0.0000, 0.0000, 3.9370) rt(2) vol(61.0234)
====> 250g [powder 8](7.874 x 3.937 x 1.9685, weight: 8) pos(3.9370, 0.0000, 3.9370) rt(2) vol(61.0234)
====> 250g [powder 9](7.874 x 3.937 x 1.9685, weight: 9) pos(7.8740, 0.0000, 3.9370) rt(3) vol(61.0234)
====> 50g [powder 1](3.937 x 1.9685 x 11.9685, weight: 1) pos(9.8425, 0.0000, 3.9370) rt(0) vol(92.7557)
UNFITTED ITEMS:
/***************************************************
/***************************************************

Tall item is at z=3.9370 (no rotation), which still seems valid?

@jeffery9
Copy link

test data as .

  ['大会议桌', [200.000, 40.000, 150.000],  [0, 0, 0], 0 ] , 
  ['大会议桌', [200.000, 40.000, 150.000],  [0, 40.000, 0], 0 ] , 
  ['大会议桌', [200.000, 40.000, 150.000],  [0, 80.000, 0], 0 ] , 
  ['办公椅子', [40.000, 30.000, 40.000],  [0, 120.000, 0], 0 ] , 
  ['办公椅子', [40.000, 30.000, 40.000],  [40.000, 120.000, 0], 0 ] , 
  ['办公台灯', [30.000, 50.000, 30.000],  [200.000, 0, 0], 0 ] , 
  ['办公台灯', [30.000, 50.000, 30.000],  [200.000, 80.000, 0], 0 ] , 
  ['办公台灯', [30.000, 50.000, 30.000],  [80.000, 120.000, 0], 0 ] , 
  ['办公台灯', [30.000, 50.000, 30.000],  [110.000, 120.000, 0], 0 ] , 
  ['办公台灯', [30.000, 50.000, 30.000],  [140.000, 120.000, 0], 0 ] , 
  ['办公台灯', [30.000, 50.000, 30.000],  [170.000, 120.000, 0], 0 ] , 
  ['办公台灯', [30.000, 50.000, 30.000],  [0, 150.000, 0], 0 ] , 
  ['办公台灯', [30.000, 50.000, 30.000],  [30.000, 150.000, 0], 0 ] , 
  ['办公台灯', [30.000, 50.000, 30.000],  [200.000, 130.000, 0], 0 ] , 
  ['办公台灯', [30.000, 50.000, 30.000],  [80.000, 170.000, 0], 0 ] , 

空间分布
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants