Control Spacing of circles in Hex Grid

As I understand it, there are two basic parts to this question:

  1. Distance between centers?
  2. How many rows and columns can fit on a given rectangle? (for a given distance between centers)

Part 1 is basic geometry, and I’m pretty sure someone mentioned this already:

30-60-90-example-diagram

This is some GH that illustrates the “Qualities of a 30-60-90 Triangle”. Blue lines are the polygon’s radius (the ‘S’ input to HexGrid). White lines are half the distance between centers in a HexGrid. In other words, the distance between center points is half the radius times the square root of three times two. Or simply radius * √3 .

For radius = 2 as shown, distance between center points in a HexGrid is 3.4641.


The rest of the code addresses Part 2: How many rows and columns can fit on a given rectangle? As you can see by changing the ‘count’ slider, the ‘col/row average’ is useless because it changes constantly (can you see why?).


CPP1 7-15_2019Jul16a.gh (23.6 KB)

What remains constant, however, is:

  • vertical (Y) distance between rows = distance between center points.
  • horizontal (X) distance between columns is […] (another 30-60-90 triangle).
    (CORRECTION: In a rush to get out the door, I posted wrong information - sorry!
    Should be:

    horizontal (X) distance between columns is (distance between center points / 2) * √3
    OR… ((radius * √3) / 2) * √3.

The edges are a different matter but that’s all I have time for today. You have all the information needed to answer your questions. Think it though!

P.S. Have you tried yet to cut ~14,000 holes in your 18" X 24" surface? (using the code I posted yesterday) Good luck with that.

P.P.S. My plans today were changed by someone else… so here are more hints. Working backward from this to calculating ‘col count’ and ‘row count’ based on radius (HexGrid “Size”) and target rectangle size are left undone. But very close!


CPP1 7-15_2019Jul16b.gh (24.3 KB)