keremdemirer / 3dbinpackingjs

javascript conversion of https://github.com/wknechtel/3d-bin-pack/
83 stars 26 forks source link

Quick Sort Pivot Value #1

Closed davidmchapman closed 7 years ago

davidmchapman commented 7 years ago

In the quick sort partition function, the pivot is set to a layerlist object located in the items array. Instead, should it be set to one of the property values within that layerlist object? The layereval property or the layerdim property? Same question for the comparison expression in the following while loop. Instead of comparing items[i] < pivot, should it be items[i].layereval < pivot (or maybe items[i].layerdim < pivot)?

Edit: After looking at page 3-12 of the original source PDF, it states: "After having such a Layers[] array prepared, it is sorted ascending order with respect to its layereval values." That answers which property we should sort by.

keremdemirer commented 7 years ago

@davidmchapman To be honest, I have no idea about the methods of this repo. One of my colleagues ported from this repository. You can try to connect with them maybe?

davidmchapman commented 7 years ago

Pull request submitted. Thank you!

keremdemirer commented 7 years ago

Please note that I had to revert your pull request. Initial version has results closer to original repo.