Wang Tiles

 

edge and corner matched tilesets

menu

2-corner Wang Tiles

Wang tilesets are usually edge tilesets. But we can also create a Wang tileset by considering the tile corners. Each tile has four corners so for 2 different types of corner we have 2^4 or 16 different tiles, the same number as 2 different edges.

It may seem that matching corners will produce similar results as matching edges, but this is not so. An edge only affects one adjacent tile, while matching a corner affects three adjacent tiles.

Corner Wang tiles create areas (or patches) of matching terrain. Although not a maze of paths or passages, a complex layout of terrain patches, separated by barriers (ditches, walls, fences etc) can provide a difficult course to navigate through.

2-corner Tileset

Here is a typical set of corner Wang tiles. You can see that every tile has two different types of corner: blue or yellow. This gives 2x2x2x2 or 2 to the power 4, (written as 2^4), giving 16 possible combinations. Hence 16 different tiles, with index numbers 0 to 15.

All 16 combinations of two corners
tile tile tile tile tile tile tile tile tile tile tile tile tile tile tile tile
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

The tileset is said to be 'complete' as it includes every possible combination of two corners. We can use these to tile a grid where all tile corners match.

Bitwise Tile Index

With some bitwise maths, we can compute a unique 'index' number for each tile.
Ignore blue corners and add up yellow corners using the following binary weightings:

Yellow NorthEast corner = 1
Yellow SouthEast corner = 2
Yellow Sout-West corner = 4
Yellow NorthWest corner = 8

Blue corners are ignored.


2-corner weightings
NorthWest
= 8
  NorthEast
= 1
  tile  
SouthWest
= 4
  SouthEast
= 2

This tile has yellow corners NorthEast(1) and NorthWest(8). Adding up gives a tile index of '9'.

Random Wang Tiles

We can arrange Wang tiles in a grid array. For each position, a tile is selected at random from the tileset, always ensuring that all corners match adjacent tiles.

See Terrain Tiles.
See Stage for random terrain arrays.

Stage: Random 2-corner Wang Tiles

Wang 2 Corner Tiles

Path Tileset

Here is a path tileset which as you can see is very similar to the 2-edge path tileset, which is shown here for comparison. The corner tilset appears rotated by 45°. A few different tile variations are also shown.

Complete set of 2-edge Path tiles
tile tile tile tile tile tile tile tile tile tile tile tile tile tile tile tile
Complete set of 2-corner Path tiles with variations
tile tile tile tile tile tile tile tile tile tile tile tile tile tile tile tile
  tile tile tile tile tile tile tile tile tile tile tile tile tile tile tile
              tile       tile   tile tile tile
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Here are four pairs of tile-15 variations.
Four pairs of Tile-15 variations
tile tile
tile tile
tile tile
tile tile

We can use these 2-corner tiles to tile a grid where all tile corners match.

Stage: Random 2-corner Path Tiles

Path Tiles

Terrain Tilesets

Wang corner tiles make good terrain tiles. You can see that every tile has two different types of corner.

All 16 combinations of two corners
tile tile tile tile tile tile tile tile tile tile tile tile tile tile tile tile
tile tile tile tile tile tile tile tile tile tile tile tile tile tile tile tile
tile tile tile tile tile tile tile tile tile tile tile tile tile tile tile tile
tile tile tile tile tile tile tile tile tile tile tile tile tile tile tile tile
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

We can use these terrain tiles to create a grid where all tile corners match.
See Terrain Tiles for more info and images.
See Stage for random terrain arrays.

Stage: Random 2-corner Terrain Tiles

Terrain Tiles

Wang Tiles | cr31.co.uk | 2016

 

** use your browsers 'view zoom' option to enlarge layouts **