package grenier
Install
    
    dune-project
 Dependency
Authors
Maintainers
Sources
sha256=e5362e6ad0e888526517415e78b9e8243bb0cc1b0c952201884148832ac4442f
    
    
  sha512=4e2f16b52b3c2786a1b8e93156184fd69d448cea571ca839b6cb88ab73f380994d1561fe24c1523c43ed8fc42d2ac01b673a13b6151fff4af4f009923d3aaf37
    
    
  doc/grenier.binpacking/Maxrects/index.html
Module Maxrects
val empty : 'bin tmake ~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
val box : ?allow_rotation:bool -> 'tag -> int -> int -> 'tag boxtype ('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).