Geometry needed to layout points in a grid for a centered hexagonal number?

45 Views Asked by At

I asked this as a programming question, but perhaps it is a better math question. What is the math needed to compute the positions of the points along the flat edges of the hexagon? I could then translate that math into code to layout the points :). Are there simple equations to do it? Or does it just require brute force thinking about each point?

1

There are 1 best solutions below

2
On

I had coded Regular polygons $ r=f(\theta)$for plotting using PolarPlot as follows:

n = 6; a = 1; PolarPlot[ 
 a Sec[ArcCos[Cos[ n theta ]]/n],  {theta, 0, 2 Pi}]

enter image description here

This regular polygon of $n$ sides escribes a unit circle.