# Hexagonal lattice points with center points in 2D

I am using the follwing coder from here, answered by Michael E2, to create 2d lattice points, without the center ponts of the cells.

hexTile[n_, m_] :=
With[{hex =
Table[{Cos[2 Pi k/6] + #, Sin[2 Pi k/6] + #2}, {k, 6}] &},
Table[hex[3 i + 3 ((-1)^j + 1)/4, Sqrt[3]/2 j], {i, n}, {j, m}]];
factor = 12;
coordinates = Flatten[hexTile[4, 10], 2]*factor;
ListPlot[coordinates, AspectRatio -> Automatic]


One problem here is that double coordinates are produced, which I don't need:

Length@coordinates
240

Length@DeleteDuplicates@coordinates
106


How can I modify the function hexTile[n_, m_] that no double coordinates are produced and how can I add center points to the hexagonal cells?

• Possible duplicate of How to create an hexagonal lattice structure – yarchik May 7 '19 at 12:45
• A honeycomb lattice with the centers filled in is also called a triangular lattice; the question becomes what do you want to do about the boundaries? – evanb May 7 '19 at 13:06

hexTile[n_,m_]:=With[{hex=Join[t=Table[{Cos[2 Pi k/6]+#,Sin[2 Pi k/6]+#2},{k,6}],

• Please see my updated question. Do you know why there are a lot of duble coordinates produced? I find for your solutionLength@coordinates = 280 and Length@DeleteDuplicates@coordinates = 146 – lio May 14 '19 at 16:24