Skip to main content

Circle packing utility using numpy arrays.

Project description

Circle Packing

Example image

Image generated by python3 example/small.py

This library provides a tool for circle packing in python, using the front-chain packing algorithm by Wang et al. and enclosed by a circle computed using the Matoušek-Sharir-Welzl algorithm.

Adapted From D3

The circle pack code is adapted from d3-hierarchy, which comes with the ISC license found in the LICENSE file.

Why?

I was doing some circle-packing visualizations with in the order of 1 million total leaf nodes. Performing the layout in the front-end each time was not only wasteful, but taking too long. I didn't find a Python equivalent that met my needs, so I made this. The output of x, y, and r ar ein a numpy array so it's easier to output as a binary dump. This library could be faster, but it is enough for my purposes.

Installation

Install through pip. E.g. python3 -m pip install npcirclepack.

Note: if you are getting errors, try installing numpy first, then npcirclepack.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

npcirclepack-0.1.0.tar.gz (6.2 kB view hashes)

Uploaded Source

Built Distribution

npcirclepack-0.1.0-py3-none-any.whl (7.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page