# Point lattice leading to triangle lattice

My main purpose is to eventually generate a triangle lattice from one original point, let's say the origin. So I want to start with the origin and generate 6 points around it, which are the vertices of an hexagon of side with length 1. Then, I would like to have those new six points to do the same and generate six other points (I know there will be repetitions). Then, I want those points to from a triangle lattice, but I am new to mathematica.

So far I constructed a function that generates the vertices of an hexagon:

h[x_, y_] := Point[Table[{Cos[2 Pi k/6] + x, Sin[2 Pi k/6] + y}, {k, 6}]]


Now i am looking to generate the other poits from my new ones.

You could do it recursively like this:

h[x_, y_, 0] := Table[{Cos[2 Pi k/6] + x, Sin[2 Pi k/6] + y}, {k, 6}]
h[x_, y_, n_] := DeleteDuplicates@Flatten[
Table[{Cos[2 Pi k/6] + #1, Sin[2 Pi k/6] + #2}, {k, 6}] & @@@ h[x, y, n - 1],
1]


Then,

Graphics@Point@h[0, 0, 2]


• But why not just generate it efficiently, i.e., directly? What's the value in iteration? Commented May 14, 2019 at 4:52
• @DavidG.Stork. Mainly because I was just following along on what the OP was asking. Clearly there are faster ways of doing this, but since the OP doesn't mention speed as a requirement, I figured it wasn't necessary (and this method can generate 1400 points in half a second). Finally, I couldn't quickly come up with a direct way that would yield a result that looks like a hexagon (as shown). I always end up getting points in a rectangular region. Commented May 14, 2019 at 4:57
• No no... not you. I was implicitly asking the OP. Commented May 14, 2019 at 5:06
• Because I want to control the amount of iterations i would like to get. By the way, i am really thankful to you for helping me! Could you explain me what «@» is used for? Commented May 14, 2019 at 17:33
• @user65572. f@x is the same as f[x] (aside from operator precedence issues). I could have just as easily done DeleteDuplicates[Flatten[ ... ] ]. Commented May 14, 2019 at 18:18