package grenier
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=dec7f84b9e93d5825f10c7dea84d5a74d7365ede45664ae63c26b5e8045c1c44
sha512=b8aa1569c2e24b89674d1b34de34cd1798896bb6a53aa5a1287f68cee880125e6b687f66ad73da9069a01cc3ece1f0684f48328b099d43529bff736b772c8fd8
doc/grenier.binpacking/Maxrects/index.html
Module MaxrectsSource
make ~width ~height return a packer ready to place stuff in a width * height area
type 'tag box = {tag : 'tag;width : int;height : int;allow_rotation : bool;(*can the box be rotated to optimize packing
*)
}Input to packing is a box
type ('bin, 'tag) rect = {x : int;y : int;w : int;h : int;rotated : bool;(*True iff the input box was rotated. If true, w = box.height && h = box.width Otherwise, w = box.width && h = box.height
*)bin : 'bin;box : 'tag box;
}Output of packing is an optional rectangle
type heuristic = [ | `Short_side_fit(*BSSF. Positions the rectangle against the short side of a free rectangle into which it fits the best.
*)| `Long_side_fit(*BLSF: Positions the rectangle against the long side of a free rectangle into which it fits the best.
*)| `Area_fit(*BAF: Positions the rectangle into the smallest free rect into which it fits.
*)| `Bottom_left(*BL: Does the Tetris placement.
*)
]Online insertion of one item. Efficient but the packing is not very good.
Worst-case: O(n^3) (n is total number of items inserted).
val insert_batch :
'bin t ->
?heuristic:heuristic ->
'tag box list ->
'bin t * ('bin, 'tag) rect option listOnline insertion of a batch of items. Runtime is roughly the cost of inserting each item independently, but order of insertion is chosen to give a better packing.
Worst-case: O(n^4) (n is total number of items inserted).