Hex grid with adaptive density

Hi All,

I was looking at some sample scripts for hexagonal grids with varying cell densities and came across the below using Kangaroo by @DanielPiker:

In order to allow the pattern to act like a mass spring system, the set of cells/curves are flattened and fed into the kangaroo engine. I’m wondering if there’s any way of getting the data structure back after the system reaches equilibrium (such that one can still query each cell as a polyline)?

Files from the original thread attached.
nervsys.3dm (66.4 KB)
nervsys.ghx (300.0 KB)

In addition, since this was from 2011, might anyone have other thoughts on achieving a hex grid with varying density?
Is there a path in transforming circle packing to hexagonal grid (instead of delaunay/voronoi)?


distort_hexgrid.gh (21.2 KB)
Here’s a go at updating this for the current Kangaroo (and allowing you to get the hexagons out)

Not sure about what you’re after relating to circle packing. The dual of the Delaunay, or the Voronoi of the circle centres would be more hexagonal the more regular the circle packing is.


thank you for an updated version!
regarding circle packing, i was just hoping for a workflow that can map the desired density/distortion of the line distribution better(?) than simply being attracted by points. but am not sure if transforming the distribution of circles to a hexagon-filled pattern is possible.

Hi Daniel,

Could you explain a bit the first anchor component?
Why is it that two points are fed into the T input while one is into the P input - what is the component trying to do?
When unplugging that particular anchor component from the solver, I also don’t see much difference in the result.


About going from circle packings to hexagons - here’s a way of doing it using the image based circle packing goal:

imagehexdensity.gh (17.1 KB)

This file also uses the barycentric dual component from here and I made the initial coloured mesh using MeshPaint
(The barycentric dual of the Delaunay gives more even edge lengths than just using Voronoi (which would be the circumcentric dual))

You’ll notice if you look closely that they aren’t all hexagons with this approach. You need a few pentagons and heptagons in there to allow the size to change smoothly without the cells becoming very stretched like with the other approach shown above.

About the anchor component in the previous def - T is the target point, and P is the initial point. This is to allow you to drag the target around while the simulation is running without the solver thinking it needs to add a new particle. In that example the location of the initial point P doesn’t really matter.


this is great, thanks so much!

relating to the below link, if baycentric dual is taken from circle packing with a fixed number of radii, would the resulting polygonal pattern also feature a fixed number of unique units? I’m guessing not, but is there a way of doing so (for instance, 5 types of hexagons, 3 types of pentagons, and 2 types of heptagons…etc.)?

Hi Daniel,

How did you convert the image into a mesh as an input? I imported an image in rhino and converted it into a mesh but when I check it in grasshopper, it is showing me only the mesh grid and no image.

I hope I could convey my query.

You can use the ‘Import Image’ component like this - choosing the image file location in the highlighted component:

imagehexdensity2.gh (15.5 KB)



Thanks a lot Daniel, this worked perfectly. I tried many times by importing image in rhino, converting to mesh and taking in grasshopper but it never worked. Thank you so much.

1 Like

I’ve been trying to use a set of curves as attractors for changing the density of a hexagonal grid, increasing its density and lowering the radii as it moves closer to these curves and increasing it as it moves further.

I used kangaroo and @DanielPiker 's helpful script, but am still unable to get the desired results. I’m new to learning grasshopper and I tried a lot of other things but could not get the desired results yet. It would be really great if anyone could help.

gh_hex-distortion-curve_query.3dm (1.4 MB) gh_hex-distortion-curve_query.gh (41.3 KB)