-
Notifications
You must be signed in to change notification settings - Fork 12
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.
triTriGrid s
returns a triangular grid with sides of length s
, using 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.
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.
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.
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.
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.
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.