Grid

Author

Eric W. Weisstein
August 29, 2005

This notebook downloaded from http://mathworld.wolfram.com/notebooks/PlaneGeometry/Grid.nb.

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

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

Figure

SquareGrid[m_,n_]:=Module[{i},
{Table[Line[{{0,i},{m,i}}],{i,0,n}],
Table[Line[{{i,0},{i,n}}],{i,0,m}]
}]

TriangularGrid[m_,n_]:=Module[{i,j,s=Sqrt[3]/2},
{Table[Line[{{-m,i s},{m,i s}}],{i,0,n}],
Table[Line[{{i,0},{i,0}+m{Cos[#],Sin[#]}&[Pi j/3]}],{i,-n,n},{j,2}]
}
]

HexagonalGrid[m_,n_]:=Module[{i,s=Sqrt[3]},
Table[Polyhex[Table[1,{m-1}],{3/2i,Mod[i,2] s/2}],{i,n}]
]

Show[GraphicsArray[{
Graphics[SquareGrid[5,5],AspectRatio->Automatic,PlotRange->{{.4,4.4},{.4,4.4}}],
Graphics[TriangularGrid[5,5],AspectRatio->Automatic,PlotRange->{{.1,4.1},{.1,4.1}}],
Graphics[HexagonalGrid[10,20],AspectRatio->Automatic,PlotRange->{{13.1,22.5},{.1,9}}]
}]]