Creates a new best-fit strip packing instance with rotation support.
The fixed width of the packing strip.
Gets the current total height of the packed strip.
This represents the vertical space used by all placed rectangles and is updated after each rectangle insertion.
Gets the current total width of the packed strip.
This represents the horizontal space used by all placed rectangles and is updated after each rectangle insertion.
Gets the fixed width of the strip.
This is the maximum allowable width for any rectangle to be inserted.
Inserts a rectangle into the strip, considering both orientations.
The algorithm evaluates both the original orientation (width × height) and
the rotated orientation (height × width) to determine which provides better
packing efficiency. The orientation and placement that results in the smallest
overall height increase is selected.
Rectangle width
Rectangle height
Placement coordinates and rotation flag.
Resets the instance to initial state.
Implementation of the Best-Fit Strip Packing algorithm with rotation support.
This class provides a concrete implementation of the best-fit heuristic that automatically considers both orientations of each rectangle (original and rotated) to find the optimal placement that minimizes the overall strip height.