rect_packer

Pack rects into bigger rect

Pure Nim score 30/100 · tests present · docs generated

Summary

Latest Version Unknown
License MIT
CI Status Passing
Downloads 0
Last Indexed 2026-07-21 05:24

Installation

nimble install rect_packer
choosenim install rect_packer
git clone https://github.com/yglukhov/rect_packer

OS Compatibility

Platform Linux macOS Windows FreeBSD OpenBSD NetBSD Android iOS WASM Embedded
rect_packer - - - - - - -

Source

Repository https://github.com/yglukhov/rect_packer
Homepage https://github.com/yglukhov/rect_packer
Documentation View Documentation
Registry Source nimble_official

README

rect_packer nimble

Simple algorithm for packing rects into a bigger rect.

Usage

import rect_packer

let p = newPacker(1024, 1024)
let sizesToPack = [ (100, 100), (50, 50), (100, 50) ]
for i, s in sizesToPack:
    let res = p.pack(s[0].int32, s[1].int32)
    echo "Rect ", i, " coords: ", res

Output:

Rect 0 coords: (x: 0, y: 0)
Rect 1 coords: (x: 100, y: 0)
Rect 2 coords: (x: 150, y: 0)