Skip to content

06. Circle Packing

John Seung Youp Baek edited this page Oct 26, 2017 · 2 revisions

Intro

Visualizes animated Circle Packing in 2D.
Reads image and picks random position to spawn circle and circle grows until it reaches maximum size or touches other circle.
My implementation doesn't pack the circles evenly in radius (Search google Circle Packing and check images with evenly spaced circles).
It picks random position and let them grow which results all different size of circles.

Preview (Click GIF to view on Youtube)

Flocking Preview

Circle

All circles that spawns on screen grows in fixed rate. If circle collides(touches) with another circle, both circles stop growing.
Circle's position is 'sort-of' random. The algorithm collects all possible spawn point in image and then randomly polls the position.

Usage

Click the images on the left panel to run algorithm.
Press R to restart.
Press C to clear.
Press I to see original image.
Press Space to toggle update.
Press S to save circle packed image. Path: Working directory(Directory where you run the program)/CirclePacking.png

Clone this wiki locally