Skip to content
mhwombat edited this page Jun 27, 2013 · 1 revision

Octagons can't tile a flat surface (there would be gaps in-between the tiles), but they can tile a hyperbolic plane, as illustrated below. (Alternatively, you can think of these as squares on a board game where diagonal moves are allowed.)

Tiling a hyperbolic plane with octagonal tiles

With the above image, it may be difficult to visualise an indexing scheme. I find it easier to visualise the tiles on a flat plane, with diamond-shaped "holes" in space. Two tiles on opposite sides of a "hole" are neighbours, just as are two tiles that share a common edge.

UnboundedOctGrid is an infinite, unbounded, grid filled with octagonal tiles. The indexing scheme is illustrated below.

Unbounded grid with octagonal tiles

rectOctGrid r c returns a rectangular grid with r rows and c columns, using octagonal tiles. Depending on whether the number of rows and columns is even or odd, the centre of the grid may consist of one, two, or four tiles.

torOctGrid r c returns a toroidal grid with r rows and c columns, using octagonal tiles. The indexing scheme is the same as for torRectGrid. A toroidal grid has no boundary, and no defined centre.

Clone this wiki locally