-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.html
183 lines (161 loc) · 6.18 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
<!DOCTYPE html>
<html lang="en">
<head>
<title>EscherSketch: hyperbolic tilings</title>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"
/>
<link
rel="icon"
href="https://discoverthreejs.com/favicon.ico"
type="image/x-icon"
/>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/water.css">
<link type="text/css" rel="stylesheet" href="main.css" />
<script type="module" src="./dist/main.js"></script>
</head>
<body>
<article id="article">
<h1>EscherSketch: hyperbolic tilings</h1>
<section class="content">
<p>
This is a prototype of an automatic hyperbolic art generator and
educational tool. It creates a regular edge to edge
<a
href="https://en.wikipedia.org/wiki/Uniform_tilings_in_hyperbolic_plane"
>tiling of the hyperbolic plane</a
>
represented as a
<a href="https://en.wikipedia.org/wiki/Poincar%C3%A9_disk_model"
>Poincaré disk</a
>, also known as a hyperbolic tesselation.
</p>
<p>
These were originally described by
<a href="https://en.wikipedia.org/wiki/Harold_Scott_MacDonald_Coxeter"
>H. S. M. Coxeter</a
>, but were made famous by
<a href="https://en.wikipedia.org/wiki/M._C._Escher">M.C. Escher</a>
in his series of Circle Limit woodcuts, back in the era when people
were known only by their initials and surnames.
</p>
<p>
Currently it can create images similar to Escher’s
<a href="https://www.wikiart.org/en/m-c-escher/circle-limit-i"
>Circle Limit I</a
>. These are regular two colored tilings, defined by the number of
sides of the polygons, and the number of polygons that meet at each
vertex.
</p>
<p>
The tiling is created out out of two Euclidean triangular pieces, one
representing half a white fish, the other half a black fish.
</p>
<figure class="figure-small">
<div id="drop-area">
<img
src="assets/tiles/fish-black.png"
alt="Black fish tile"
class="tile"
id="black-tile"
/>
<img
src="assets/tiles/fish-white.png"
alt="White fish tile"
class="tile"
id="white-tile"
/>
</div>
<figcaption>Fig 1: Black fish, white fish (drag&drop your own pictures above!)</figcaption>
</figure>
<p>
I had originally planned to extend this to include irregular tilings
of several colors, which would allow the creation of the rest oas a
teaching tool where students could create their own tiles.
</p>
<p>
Unfortunately, creating the tiles so that they match evenly turned out
to be more difficult than I expected. It’s quite unintuitive since the
Euclidean triangles get stretched to map onto hyperbolic triangles,
and the lines of opposing edges don’t match up where you would expect.
Since the intention was to create a simple educational tool where
students could quickly create their own designs, this was a bit of a
showstopper, and I halted development.
</p>
<p>
Note that once you go over around 8 for either values the polygons
will start to get very stretched at the edges.
</p>
<div id="controls">
<div id="p-selection">
<span>Central polygon sides: </span>
<button href="#" id="p-down">←</button>
<span id="p-value">6</span>
<button href="#" id="p-up">→</button>
</div>
<br><br>
<div id="q-selection">
<span>Polygons meeting at each vertex: </span>
<button href="#" id="q-down">←</button>
<span id="q-value">6</span>
<button href="#" id="q-up">→</button>
</div>
</div>
<p id="warn" class="hide"><strong>Invalid tiling!</strong></p>
<canvas
id="canvas"
__spector_context_type="webgl"
width="984"
height="984"
></canvas>
<p>
Your current tiling consists of
<span id="tiling-length">28308</span> hyperbolic polygons.
</p>
<p>
This way this works by mapping the two triangular images to hyperbolic
triangles (a non-affine texture mapping), and then covering the
central polygon with them. Then this central polygon is appropriately
rotated and repeated until the entire plane is covered.
</p>
<p>
The following figure is a {4, 5} tiling - that means 4 sided polygons,
with 5 meeting at each vertex.
</p>
<figure class="figure-medium">
<img
src="assets/uniform-hyperbolic-tiling-45.png"
alt="Hyperbolic tiling"
/>
<figcaption>Fig 2: A {4, 5} tiling</figcaption>
</figure>
<p>
The algorithm used was first described by
<a href="https://www.d.umn.edu/~ddunham/">Douglas Dunham</a> and as
far as I can tell first implemented in software by his PHD student
Ajit Datar.
</p>
<p>
However, this is almost certainly the first implementation using
JavaScript and WebGL.
</p>
<p>
If you are interested in reading more about hyperbolic tesselation,
check out the Dr. Dunham’s homepage linked above, or for a slightly
gentler introduction, try
<a href="https://mathcs.clarku.edu/~djoyce/poincare/poincare.html"
>this</a
>
page by Prof. Joyce at Clare university, as well the
<a
href="https://en.wikipedia.org/wiki/Uniform_tilings_in_hyperbolic_plane"
>wikpedia</a
>
page.
</p>
</section>
</article>
</body>
</html>