Skip to content

Circle Packing Algorithm in C# / XAML

I recently (translation: not very recently) put up an post on circle packing in Processing and completely forgot to follow up with a port of that algorithm porting that to C#.

300SNPs

Since then, I’ve refined my implementation of it and put up all the code. I’ve tried to abstract the actual algorithmic piece somewhat into the “shared” part of the project. The “heavy lifting” of the algorithm is in the Circle.cs file and the CirclePacker.cs file.

I’ve also added a helper that is a great class if you’re doing any kind of circle size visualization.

This is a Universal project so the app runs as both a Windows Modern app and a Windows Phone app.