1

I want to create a hexagonal lattice but it should be centered basically the whole lattice is a central hexagon and then layers of hexagon around, like shown in the figure. (may be my description is confusion, but right now that is how I am seeing it).

So I want to generate the coordinates for lattice below. I found many algorithm to create square lattice of hexagons but I want to ask if there is a algorithm for following lattice too.

enter image description here

John Paul
  • 12,196
  • 6
  • 55
  • 75
jkhadka
  • 2,443
  • 8
  • 34
  • 56

1 Answers1

1

Note:

N-th layer consists of 6N cells.

First cell of that layer in your representation has coordinate shift

(N*A*Sqrt(3)/2, N*A*3/2), where A is edge length.

First cell of that layer has number

2+3*N*(N-1)                     //(you have missed 14)  

You can start from the first cell of Nth layer, make N more cells to left, N cells to left-down and so on...

MBo
  • 77,366
  • 5
  • 53
  • 86
  • Hey @MBo, thanks for the reply. but I am confused. what do you mean by `First cell of that layer` . Also by `First cell of that layer`? I am quite confused by the description. Would appreciate it if you can elaborate a bit on this? – jkhadka May 02 '16 at 21:47
  • Cell number 2 is the first cell of the first layer (it contains cells 2..7), Cell number 8 is the first cell in the second layer (8..19). – MBo May 03 '16 at 12:12