Stuffing
It's a packing algorithm.
The algorithm accepts any shape of 2D raster masks as inputs and is good at handling the packing problems of many gadgets. The implementation is based on Quadtree & gradient optimization. Also, it can be parallelized if you start julia
with julia --threads k
. This package is used by WordCloud.
Examples: collision detection, packing
Benchmark: benchmark
See WordCloud
▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩ ▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩ ▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▥▥▥▥▥▥▥▥▥▥▥▥▥▥▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩ ▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▥▥▥▥▥▢▢▢▢▢▢▢▢▢▢▢▢▢▢▥▥▥▥▥▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩ ▩▩▩▩▩▩▩▩▩▩▩▩▩▩▥▥▥▥▥▥▥▥▥▥▥▥▥▥▥▥▥▥▥▥▥▥▥▥▥▥▥▥▩▩▩▩▩▩▩▩▩▩▩▩▩▩ ▩▩▩▩▩▩▩▩▩▩▩▥▥▥▥▥▥▩▩▩▩▩▩▩▩▩▩▩▩▩▩▥▥▩▩▩▩▩▥▩▥▢▥▥▩▩▩▩▩▩▩▩▩▩▩▩ ▩▩▩▩▩▩▩▩▩▩▥▥▥▥▩▩▥▩▩▩▩▩▩▩▩▩▩▩▩▩▩▥▥▩▩▩▩▩▥▥▥▥▥▥▥▥▩▩▩▩▩▩▩▩▩▩ ▩▩▩▩▩▩▩▩▥▥▥▩▩▩▩▩▥▩▩▩▩▩▩▩▩▩▩▩▩▩▩▥▥▩▩▩▩▩▥▥▥▩▩▩▥▥▥▥▩▩▩▩▩▩▩▩ ▩▩▩▩▩▩▩▥▥▢▥▩▩▩▩▩▥▩▩▩▩▩▩▩▩▩▩▩▩▩▩▥▥▩▩▩▩▩▥▩▥▩▩▩▥▢▥▥▥▩▩▩▩▩▩▩ ▩▩▩▩▩▩▥▥▢▢▥▩▩▩▩▩▥▩▩▩▩▩▩▩▩▩▩▩▩▩▩▥▥▩▩▩▩▩▥▩▥▩▩▩▥▢▥▥▥▥▩▩▩▩▩▩ ▩▩▩▩▩▥▥▢▢▢▥▩▩▥▥▥▥▩▩▩▩▩▩▩▩▩▩▩▩▩▩▥▥▩▩▩▩▩▥▩▥▩▩▩▥▢▥▥▢▥▥▩▩▩▩▩ ▩▩▩▩▥▥▥▥▥▥▥▩▩▥▩▥▥▩▩▩▩▩▩▩▩▩▩▩▩▩▩▥▥▥▥▥▥▥▥▥▥▩▩▩▥▢▥▥▢▢▥▥▩▩▩▩ ▩▩▩▩▥▥▥▩▩▩▩▩▩▥▩▥▥▩▩▩▩▩▩▩▩▩▩▩▩▩▩▥▢▩▥▥▩▥▩▩▥▩▩▩▥▢▢▢▢▢▢▥▩▩▩▩ ▩▩▩▥▥▥▥▩▩▩▩▩▩▥▥▥▥▩▩▩▩▩▩▩▩▩▩▩▩▩▩▥▢▥▥▥▩▥▩▩▥▥▥▥▥▥▥▥▥▥▥▥▥▩▩▩ ▩▩▩▥▥▥▥▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▥▥▥▥▥▥▥▥▥▥▥▥▥▥▩▩▩▩▩▩▩▥▩▩▩ ▩▩▩▥▥▢▥▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▥▩▩▩▩▩▩▩▩▩▩▩▩▥▩▩▩▩▩▩▩▥▩▩▩ ▩▩▩▥▥▢▥▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▥▩▩▩▩▩▩▩▩▩▩▩▩▥▩▩▩▩▩▩▩▥▩▩▩ ▩▩▩▥▥▥▥▩▩▩▩▩▩▥▥▥▥▩▩▩▩▩▩▩▩▩▩▩▩▩▩▥▩▩▩▩▩▩▩▩▩▩▩▩▥▩▩▩▩▩▩▩▥▩▩▩ ▩▩▩▥▩▩▥▩▩▩▩▩▩▥▢▢▥▩▩▩▩▩▩▩▩▩▩▩▩▩▩▥▩▩▩▩▩▩▩▩▩▩▩▩▥▩▩▩▩▩▩▩▥▩▩▩ ▩▩▩▥▩▩▥▩▩▩▩▩▩▥▥▥▥▥▥▥▥▥▥▥▥▥▥▥▥▥▥▥▩▩▩▩▩▩▩▩▩▩▩▩▥▩▩▩▩▩▩▩▥▩▩▩ ▩▩▩▥▥▥▥▩▩▩▩▩▩▥▥▩▩▩▥▩▩▩▩▩▩▩▩▩▩▩▥▥▩▩▩▩▩▩▩▩▩▩▩▩▥▩▩▩▩▩▩▩▥▩▩▩ ▩▩▩▥▢▢▥▩▩▩▩▩▩▥▥▩▩▩▥▩▩▩▩▩▩▩▩▩▩▩▥▥▩▩▩▩▩▩▩▩▩▩▩▩▥▩▩▩▩▩▩▩▥▩▩▩ ▩▩▩▥▥▢▥▩▩▩▩▩▩▥▥▩▩▩▥▩▩▩▩▩▩▩▩▩▩▩▥▥▩▩▩▩▩▩▩▩▩▩▩▩▥▥▥▥▥▥▥▥▥▩▩▩ ▩▩▩▩▥▢▥▩▩▩▩▩▩▥▥▩▩▩▥▩▩▩▩▩▩▩▩▩▩▩▥▥▩▩▩▩▩▩▩▩▩▩▩▩▥▥▩▩▥▢▢▥▩▩▩▩ ▩▩▩▩▥▥▥▩▩▩▩▩▩▥▥▩▩▩▥▩▩▩▩▩▩▩▩▩▩▩▥▥▩▩▩▩▩▩▩▩▩▩▩▩▥▥▩▩▥▢▥▩▩▩▩▩ ▩▩▩▩▩▥▥▥▥▥▥▥▥▥▩▩▩▩▥▩▩▩▩▩▩▩▩▩▩▩▥▥▩▩▩▩▩▩▩▩▩▩▩▩▥▥▩▩▥▥▥▩▩▩▩▩ ▩▩▩▩▩▩▥▥▢▢▥▩▩▩▩▩▩▩▥▩▩▩▩▩▩▩▩▩▩▩▥▥▩▩▩▩▩▩▩▩▩▩▩▩▥▥▥▥▥▥▩▩▩▩▩▩ ▩▩▩▩▩▩▩▥▥▢▥▩▩▩▩▩▩▩▥▩▩▩▩▩▩▩▩▩▩▩▥▥▩▩▩▩▩▩▩▩▩▩▩▩▥▩▥▥▥▩▩▩▩▩▩▩ ▩▩▩▩▩▩▩▩▥▥▥▩▩▩▩▩▩▩▥▩▩▩▩▩▩▩▩▩▩▩▥▥▩▩▥▥▥▥▥▥▥▥▥▥▥▥▥▥▩▩▩▩▩▩▩▩ ▩▩▩▩▩▩▩▩▩▩▥▥▥▥▩▩▩▩▥▩▩▩▩▩▩▩▩▩▩▩▥▩▩▩▥▩▩▥▢▥▩▥▢▢▥▥▩▩▩▩▩▩▩▩▩▩ ▩▩▩▩▩▩▩▩▩▩▩▩▥▥▥▥▥▥▥▩▩▩▩▩▩▩▩▩▩▩▥▩▩▩▥▩▩▥▢▥▩▥▥▥▩▩▩▩▩▩▩▩▩▩▩▩ ▩▩▩▩▩▩▩▩▩▩▩▩▩▩▥▥▥▥▥▩▩▩▩▩▩▩▩▩▩▩▥▩▩▩▥▥▥▥▢▥▥▥▩▩▩▩▩▩▩▩▩▩▩▩▩▩ ▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▥▥▥▥▥▥▥▥▥▥▥▥▥▥▩▩▩▥▥▥▥▥▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩ ▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▥▥▥▥▥▥▥▥▥▥▥▥▥▥▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩ ▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩ ▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩