Hexagonal Grid

Author

Eric W. Weisstein
December 11, 2024

This notebook downloaded from http://mathworld.wolfram.com/notebooks/CoordinateGeometry/HexagonalGrid.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/HexagonalGrid.html.

©2024 Wolfram Research, Inc. except for portions noted otherwise

Graphic

Unfilled

Hexagon[x_]:=Line[x+#&/@(Through[{Cos,Sin}[Pi#/3]]&/@Range[0,6])]

HexagonalGrid[x_,y_]:=Module[{i,j},
Table[Hexagon[{3/2i,Sqrt[3]j+Mod[i,2]Sqrt[3]/2}],{i,x},{j,y}]
]

Graphics[HexagonalGrid[7,7],
PlotRange->{{.7,10.2},{.7,10.2}},
AspectRatio->Automatic]

Filled

xy[i_,j_]:={-j/2+i,(n-j)((Sqrt[3])/2)}

Graphics[Block[{n=4},Table[Text[{i,j},xy[i,j]],{j,n}, {i,j}]]]

v=Flatten[Block[{n=4},Table[xy[i,j],{j,n}, {i,j}]],1]

Graphics[{
FaceForm[LightGray],EdgeForm[Black],Polygon[CirclePoints[#,{1/Sqrt[3],Pi/2},6]]&/@v,
FaceForm[Black],Disk[v,.02]
}]