algorithmic modeling for Rhino

Here's an example definition showing how to generate a circle packing from an arbitrary triangulation:

as shown here

Views: 45195

Replies to This Discussion

Hi Jeremy,

This definition tries to make a compact circle packing (3 mutually tangent circles around each gap) from a predefined topology (given by the input mesh, where each edge corresponds to a pair of circles that should be tangent in the end result).

Given a starting mesh like this with such elongated triangles, and a fixed boundary does not leave enough freedom for it to be possible to satisfy this goal.

There are many other approaches to circle packing though which could be used here. For instance, ones based on collisions, in which the topology is not fixed at the start.

Could you clarify what is the intended result - ie, do you need 3 circles around each gap or not? do you need a particular number or size of circles?

For example, here's a way of doing it using K2, which fills the mesh with circles of random radii within a given range.


Many thanks Daniel, that is exactly what  i was after. 

Hi Daniel this is brilliant ...!

Would you know a way to achieve the circle outlines packing against the mesh boundary instead of the centre points?

All the best - Jeroen

(artwork by Yayoi Kusama)

Hi Jeroen,


Here is a modified version which keeps the circles themselves within the boundary instead of just the centre points. It works by doing collision between a curve and spheres of given radii, so it can be any curve, not necessarily just the mesh boundary.

It uses a custom goal, so you'll need to update the referenced assembly location when you open it.



This appears to be exactly what I am looking for. BUT it fails with an error in the Solver component 1. Solution exception:Unable to cast object of type 'SphereCurveCollide' to type 'KangarooSolver.IGoal'.

Rhino v 5 SR13 64-bit

Grasshopper v 0.9.0076

Any thoughts?



Hi Robb,

You will need to set the referenced assembly to your own local copy of the KangarooSolver.dll by right clicking the C# component.

Also, you may need to turn off the COFF loading option (on the Rhino command line type GrasshopperDeveloperSettings, then untick the 'Memory Load...' box)

Many thanks Daniel... I got it running now. Looks like it will get me to where I need to go. I'll get back to you with any other thoughts.


This is working really well, it's a great piece of code. Can you explain the intent of the "Strength" input parameter please? I have been playing around with that integer (1<->9) and it doesn't seem to have a discernible effect. Can that be used to eliminate any overlap of the base circles? IOW it will force excess circles out of the confining curve?

Hi Robb,

The strength controls how much each goal will be prioritized. So yes - if the Collider goal is much stronger than the goal keeping the circles within the curve, then there will be less overlap between them, but they will get more pushed outside the curve. It is a number parameter and doesn't need to be in any particular range - if you want you can set one goal to 10000 and another to 0.0001

Daniel Hi, what do you mean by "setting the referenced assembly to my own local copy of the KangarooSolver.dll" ? I mean how/where do you do that in the C# script? I turned off the memory load in grasshopper settings but to no avail. I'm running Rhino 6 w/ grasshopper v 1.0.0004. Any suggestions? Would be nice for ones who want to upgrade as well. Many thanks!






  • Add Photos
  • View All

© 2019   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service