Consider the following 3x3 blocks which the marching squares algorithm would identify for every cell (with 0-based labeled ID):
0:
...
...
...
1:
...
...
\..
2:
...
...
../
3:
...
---
...
4:
..\
...
...
5:
/..
...
../
6:
.|.
.|.
.|.
7:
/..
...
...
8:
/..
...
...
9:
.|.
.|.
.|.
10:
..\
...
\..
11:
..\
...
...
12:
...
---
...
13:
...
...
../
14:
...
...
\..
15:
...
...
...
The goal of this challenge is given a 2D matrix of block ID's, draw the full contour plot by tiling these smaller cells together. Note that there are some repeated cases (ex.: 0 and 15 visually are the same)
Input
Your program/function should take as input a 2D rectangular matrix of integers in the range [0+a,15+a]
(where a
is an arbitrary integer shift of your choice; this allows you to use zero-based indexing or 1-based indexing for the blocks). This may be from any source desired (stdin, function parameter, etc.).
Output
Your program/function should output a single string representing the full contour plot. There should be no extra leading/trailing whitespace, but a single trailing newline is allowed. There should be no separation between adjacent blocks vertically or horizontally.
Note that you do not have to do any kind of special treatment for blocks which map to a "saddle"; just draw the block with the given ID as-is.
The output may be to any sink desired (stdout, return value, etc.)
Examples
All examples below use 0-based block ID's.
case 1:
2 1
4 8
......
......
../\..
..\/..
......
......
case 2:
15 13 12 14 15
13 8 0 4 14
11 1 0 2 7
15 11 3 7 15
...............
......---......
...../...\.....
.../.......\...
...............
../.........\..
..\........./..
...............
...\......./...
.....\.../.....
......---......
...............
case 3:
12 12 12 8 4
0 0 0 0 2
0 0 0 2 7
0 2 3 7 15
........./....\
---------......
...............
...............
...............
............../
............/..
...............
.........../...
........./.....
......---......
...../.........
case 4:
0 1 2 3
4 5 6 7
8 9 10 11
12 13 14 15
............
.........---
...\..../...
..\/...|./..
.......|....
...../.|....
/...|...\..\
....|.......
....|.\.....
............
---.........
...../\.....
case 5:
0 0 0 0 6 15 15
0 0 0 0 6 15 15
0 0 0 0 6 15 15
0 0 0 2 7 15 15
0 0 2 5 14 15 15
0 2 5 8 4 12 14
0 4 8 0 0 0 6
0 0 0 0 0 0 4
.............|.......
.............|.......
.............|.......
.............|.......
.............|.......
.............|.......
.............|.......
.............|.......
.............|.......
............/........
.....................
.........../.........
........./...........
.....................
......../../\........
....../../....\......
...............---...
...../../.........\..
.....\/............|.
...................|.
...................|.
....................\
.....................
.....................
Scoring
This is code golf; shortest code in bytes wins. Standard loopholes apply.