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

Triangular tiles

UnboundedTriGrid is an infinite, unbounded, grid filled with triangular tiles. The indexing scheme is illustrated below. If the x-coordinate is even, the triangle points up; if it's odd, the triangle points down. A line of tiles on a diagonal like / will have the same value for x. The quations used are presented in Implementation: Triangular tiles.

Unbounded grid with triangular tiles

triTriGrid s returns a triangular grid with sides of length s, using triangular tiles.

Triangular grid with triangular tiles

As the size increases, the centre of the grid cycles between being a triangle pointing up, a triangle pointing down, and three triangles arranged to form a trefoil. In the diagram below, the central tiles are shaded grey.

Centre of triangular grid with triangular tiles

paraTriGrid r c returns a grid in the shape of a parallelogram with r rows and c columns, using triangular tiles. The indexing scheme is illustrated below. If the x-coordinate is even, the triangle points up; if it's odd, the triangle points down. A line of tiles on a diagonal like / will have the same value for x.

Parallelogram-shaped grid with triangular tiles

Depending on whether the number of rows and columns is even or odd, the centre of the grid may be two tiles forming a lozenge leaning to the left, two tiles forming a lozenge leaning to the right, two tiles forming an upright lozenge, or tiles arranged to one or three "bowties". In the diagram below, the central tiles are shaded grey.

Centre of a parallelogram-shaped grid with triangular tiles

rectTriGrid r c returns a rectangular grid with r rows and c columns, using triangular tiles. In the current implementation, the number of rows must be even. The indexing scheme is illustrated below. If the x-coordinate is even, the triangle points up; if it's odd, the triangle points down. A line of tiles on a diagonal like / will have the same value for x.

Rectangular grid with triangular tiles

Centre of a rectangular grid with triangular tiles

torTriGrid r c returns a toroidal grid with r rows and c columns, using triangular tiles. The indexing scheme is illustrated below. If the x-coordinate is even, the triangle points up; if it's odd, the triangle points down. A line of tiles on a diagonal like / will have the same value for x.

Toroidal grid with triangular tiles

yCylTriGrid r c returns a cylindrical grid with r rows and c columns, using triangular tiles. The indexing scheme is illustrated below. If the x-coordinate is even, the triangle points up; if it's odd, the triangle points down. A line of tiles on a diagonal like / will have the same value for x.

Cylindrical grid with triangular tiles