1.0.0 • Published 2 years ago
affineplane-circlepack v1.0.0
affineplane-circlepack
Deterministic and order-preserving 2D circle packing algorithm for data visualization.

Install
$ npm install affineplane-circlepack
$ yarn add affineplane-circlepackUsage
The basic usage is simple:
const pack = require('affineplane-circlepack')
const circles = [
{ x: 1, y: 0, r: 1 },
{ x: 2, y: 4, r: 2 },
{ x: 1, y: 5, r: 2 },
...
]
const packed = pack(circles)
// packed is an array that contains the same circles with x and y adjusted.Asynchronic runs are good for packing large sets of circles in a non-blocking way:
pack(circles, (batch) => {
console.log('A batch of packed circles fresh out of the oven.', batch)
}, () => {
console.log('All packed.')
})Contribute
Pull requests and bug reports are highly appreciated. Please test your contribution with the following scripts:
Run test suite:
$ npm run testRun only linter:
$ npm run lintSee also
This library uses some tools from affineplane geometry library.
License
1.0.0
2 years ago