rectpack: add_rect() in online packers doesn't return solution
I am using the online packer and calling add_rect()
when needed. However, the return value is inconsitent and never complete. The only way to get the full solution seems to be to iterate all bins which is O(n) for n rects packed so far. The solution is available and could be returned, but…
- BBF returns
bool
indicating whether packing succeeded. - BNF and BBF return a rect if successful or
None
otherwise - but not the bin ID it was packed into.
I would suggest changing the return value for all three to a tuple of the form (bin_id, rect)
.
About this issue
- Original URL
- State: open
- Created 5 years ago
- Comments: 31 (15 by maintainers)
Why uuid4 and not just sequential integer IDs? It’s surely unnecessary to need global unique identifiers, and they’re much more expensive to compute.
Now that i have written it I can’t see many cases where pop(bin_id) would be useful, a simple pop() should be enough and not require an ordereddict