This repository has been archived by the owner on Dec 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
/
cormullion — 2½ D graphics.jl
393 lines (371 loc) · 19.9 KB
/
cormullion — 2½ D graphics.jl
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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
### A Pluto.jl notebook ###
# v0.12.21
using Markdown
using InteractiveUtils
# This Pluto notebook uses @bind for interactivity. When running this notebook outside of Pluto, the following 'mock version' of @bind gives bound variables a default value (instead of an error).
macro bind(def, element)
quote
local el = $(esc(element))
global $(esc(def)) = Core.applicable(Base.get, el) ? Base.get(el) : missing
el
end
end
# ╔═╡ 22644f64-7e9b-11eb-3ba3-0dcdec7e57c6
using Luxor, Thebes, Colors, PlutoUI
# ╔═╡ fc459dbe-7ea0-11eb-04f3-1b7a7ba7f14d
md""" ## 2½ D graphics """
# ╔═╡ 6e73574e-7ea3-11eb-3032-3b9a1352bef7
md""" cormullion, 6th March 2021 """
# ╔═╡ 8646f864-7ea1-11eb-34c3-8d7fc241b6d4
md""" This is a short and very silly Pluto notebook to draw 2½D graphics."""
# ╔═╡ 916a319e-7ea3-11eb-0a55-ad133c6dd750
md""" Here's a list of vertices and the faces they make. I've hidden the contents of the cell because they're pretty boring..."""
# ╔═╡ c3a6d98a-7e9d-11eb-30da-5fbcd64d956b
sphere2 = (Point3D[Point3D(1.0, -0.0, 0.0),
Point3D(0.981, -0.195, 0.0),
Point3D(0.981, -0.0, 0.195),
Point3D(0.924, -0.383, 0.0),
Point3D(0.96, -0.199, 0.199),
Point3D(0.924, -0.0, 0.383),
Point3D(0.707, -0.707, 0.0),
Point3D(0.789, -0.577, 0.211),
Point3D(0.831, -0.556, 0.0),
Point3D(0.816, -0.408, 0.408),
Point3D(0.89, -0.405, 0.209),
Point3D(0.707, -0.0, 0.707),
Point3D(0.831, -0.0, 0.556),
Point3D(0.789, -0.211, 0.577),
Point3D(0.89, -0.209, 0.405),
Point3D(0.0, -1.0, 0.0),
Point3D(0.0, -0.981, 0.195),
Point3D(0.195, -0.981, 0.0),
Point3D(0.0, -0.924, 0.383),
Point3D(0.199, -0.96, 0.199),
Point3D(0.383, -0.924, 0.0),
Point3D(0.0, -0.707, 0.707),
Point3D(0.211, -0.789, 0.577),
Point3D(0.0, -0.831, 0.556),
Point3D(0.408, -0.816, 0.408),
Point3D(0.209, -0.89, 0.405),
Point3D(0.556, -0.831, 0.0),
Point3D(0.577, -0.789, 0.211),
Point3D(0.405, -0.89, 0.209),
Point3D(0.0, -0.0, 1.0),
Point3D(0.195, -0.0, 0.981),
Point3D(0.0, -0.195, 0.981),
Point3D(0.383, -0.0, 0.924),
Point3D(0.199, -0.199, 0.96),
Point3D(0.0, -0.383, 0.924),
Point3D(0.577, -0.211, 0.789),
Point3D(0.556, -0.0, 0.831),
Point3D(0.408, -0.408, 0.816),
Point3D(0.405, -0.209, 0.89),
Point3D(0.0, -0.556, 0.831),
Point3D(0.211, -0.577, 0.789),
Point3D(0.209, -0.405, 0.89),
Point3D(0.64, -0.64, 0.426),
Point3D(0.426, -0.64, 0.64),
Point3D(0.64, -0.426, 0.64),
Point3D(0.981, 0.195, 0.0),
Point3D(0.924, 0.383, 0.0),
Point3D(0.96, 0.199, 0.199),
Point3D(0.707, 0.707, 0.0),
Point3D(0.789, 0.577, 0.211),
Point3D(0.831, 0.556, 0.0),
Point3D(0.816, 0.408, 0.408),
Point3D(0.89, 0.405, 0.209),
Point3D(0.789, 0.211, 0.577),
Point3D(0.89, 0.209, 0.405),
Point3D(0.0, 1.0, 0.0),
Point3D(0.0, 0.981, 0.195),
Point3D(0.195, 0.981, 0.0),
Point3D(0.0, 0.924, 0.383),
Point3D(0.199, 0.96, 0.199),
Point3D(0.383, 0.924, 0.0),
Point3D(0.0, 0.707, 0.707),
Point3D(0.211, 0.789, 0.577),
Point3D(0.0, 0.831, 0.556),
Point3D(0.408, 0.816, 0.408),
Point3D(0.209, 0.89, 0.405),
Point3D(0.556, 0.831, 0.0),
Point3D(0.577, 0.789, 0.211),
Point3D(0.405, 0.89, 0.209),
Point3D(0.0, 0.195, 0.981),
Point3D(0.199, 0.199, 0.96),
Point3D(0.0, 0.383, 0.924),
Point3D(0.577, 0.211, 0.789),
Point3D(0.408, 0.408, 0.816),
Point3D(0.405, 0.209, 0.89),
Point3D(0.0, 0.556, 0.831),
Point3D(0.211, 0.577, 0.789),
Point3D(0.209, 0.405, 0.89),
Point3D(0.64, 0.64, 0.426),
Point3D(0.426, 0.64, 0.64),
Point3D(0.64, 0.426, 0.64),
Point3D(0.981, -0.0, -0.195),
Point3D(0.96, -0.199, -0.199),
Point3D(0.924, -0.0, -0.383),
Point3D(0.789, -0.577, -0.211),
Point3D(0.816, -0.408, -0.408),
Point3D(0.89, -0.405, -0.209),
Point3D(0.707, -0.0, -0.707),
Point3D(0.831, -0.0, -0.556),
Point3D(0.789, -0.211, -0.577),
Point3D(0.89, -0.209, -0.405),
Point3D(0.0, -0.981, -0.195),
Point3D(0.0, -0.924, -0.383),
Point3D(0.199, -0.96, -0.199),
Point3D(0.0, -0.707, -0.707),
Point3D(0.211, -0.789, -0.577),
Point3D(0.0, -0.831, -0.556),
Point3D(0.408, -0.816, -0.408),
Point3D(0.209, -0.89, -0.405),
Point3D(0.577, -0.789, -0.211),
Point3D(0.405, -0.89, -0.209),
Point3D(0.0, -0.0, -1.0),
Point3D(0.195, -0.0, -0.981),
Point3D(0.0, -0.195, -0.981),
Point3D(0.383, -0.0, -0.924),
Point3D(0.199, -0.199, -0.96),
Point3D(0.0, -0.383, -0.924),
Point3D(0.577, -0.211, -0.789),
Point3D(0.556, -0.0, -0.831),
Point3D(0.408, -0.408, -0.816),
Point3D(0.405, -0.209, -0.89),
Point3D(0.0, -0.556, -0.831),
Point3D(0.211, -0.577, -0.789),
Point3D(0.209, -0.405, -0.89),
Point3D(0.64, -0.64, -0.426),
Point3D(0.426, -0.64, -0.64),
Point3D(0.64, -0.426, -0.64),
Point3D(0.96, 0.199, -0.199),
Point3D(0.789, 0.577, -0.211),
Point3D(0.816, 0.408, -0.408),
Point3D(0.89, 0.405, -0.209),
Point3D(0.789, 0.211, -0.577),
Point3D(0.89, 0.209, -0.405),
Point3D(0.0, 0.981, -0.195),
Point3D(0.0, 0.924, -0.383),
Point3D(0.199, 0.96, -0.199),
Point3D(0.0, 0.707, -0.707),
Point3D(0.211, 0.789, -0.577),
Point3D(0.0, 0.831, -0.556),
Point3D(0.408, 0.816, -0.408),
Point3D(0.209, 0.89, -0.405),
Point3D(0.577, 0.789, -0.211),
Point3D(0.405, 0.89, -0.209),
Point3D(0.0, 0.195, -0.981),
Point3D(0.199, 0.199, -0.96),
Point3D(0.0, 0.383, -0.924),
Point3D(0.577, 0.211, -0.789),
Point3D(0.408, 0.408, -0.816),
Point3D(0.405, 0.209, -0.89),
Point3D(0.0, 0.556, -0.831),
Point3D(0.211, 0.577, -0.789),
Point3D(0.209, 0.405, -0.89),
Point3D(0.64, 0.64, -0.426),
Point3D(0.426, 0.64, -0.64),
Point3D(0.64, 0.426, -0.64),
Point3D(-1.0, -0.0, 0.0),
Point3D(-0.981, -0.195, 0.0),
Point3D(-0.981, -0.0, 0.195),
Point3D(-0.924, -0.383, 0.0),
Point3D(-0.96, -0.199, 0.199),
Point3D(-0.924, -0.0, 0.383),
Point3D(-0.707, -0.707, 0.0),
Point3D(-0.789, -0.577, 0.211),
Point3D(-0.831, -0.556, 0.0),
Point3D(-0.816, -0.408, 0.408),
Point3D(-0.89, -0.405, 0.209),
Point3D(-0.707, -0.0, 0.707),
Point3D(-0.831, -0.0, 0.556),
Point3D(-0.789, -0.211, 0.577),
Point3D(-0.89, -0.209, 0.405),
Point3D(-0.195, -0.981, 0.0),
Point3D(-0.199, -0.96, 0.199),
Point3D(-0.383, -0.924, 0.0),
Point3D(-0.211, -0.789, 0.577),
Point3D(-0.408, -0.816, 0.408),
Point3D(-0.209, -0.89, 0.405),
Point3D(-0.556, -0.831, 0.0),
Point3D(-0.577, -0.789, 0.211),
Point3D(-0.405, -0.89, 0.209),
Point3D(-0.195, -0.0, 0.981),
Point3D(-0.383, -0.0, 0.924),
Point3D(-0.199, -0.199, 0.96),
Point3D(-0.577, -0.211, 0.789),
Point3D(-0.556, -0.0, 0.831),
Point3D(-0.408, -0.408, 0.816),
Point3D(-0.405, -0.209, 0.89),
Point3D(-0.211, -0.577, 0.789),
Point3D(-0.209, -0.405, 0.89),
Point3D(-0.64, -0.64, 0.426),
Point3D(-0.426, -0.64, 0.64),
Point3D(-0.64, -0.426, 0.64),
Point3D(-0.981, 0.195, 0.0),
Point3D(-0.924, 0.383, 0.0),
Point3D(-0.96, 0.199, 0.199),
Point3D(-0.707, 0.707, 0.0),
Point3D(-0.789, 0.577, 0.211),
Point3D(-0.831, 0.556, 0.0),
Point3D(-0.816, 0.408, 0.408),
Point3D(-0.89, 0.405, 0.209),
Point3D(-0.789, 0.211, 0.577),
Point3D(-0.89, 0.209, 0.405),
Point3D(-0.195, 0.981, 0.0),
Point3D(-0.199, 0.96, 0.199),
Point3D(-0.383, 0.924, 0.0),
Point3D(-0.211, 0.789, 0.577),
Point3D(-0.408, 0.816, 0.408),
Point3D(-0.209, 0.89, 0.405),
Point3D(-0.556, 0.831, 0.0),
Point3D(-0.577, 0.789, 0.211),
Point3D(-0.405, 0.89, 0.209),
Point3D(-0.199, 0.199, 0.96),
Point3D(-0.577, 0.211, 0.789),
Point3D(-0.408, 0.408, 0.816),
Point3D(-0.405, 0.209, 0.89),
Point3D(-0.211, 0.577, 0.789),
Point3D(-0.209, 0.405, 0.89),
Point3D(-0.64, 0.64, 0.426),
Point3D(-0.426, 0.64, 0.64),
Point3D(-0.64, 0.426, 0.64),
Point3D(-0.981, -0.0, -0.195),
Point3D(-0.96, -0.199, -0.199),
Point3D(-0.924, -0.0, -0.383),
Point3D(-0.789, -0.577, -0.211),
Point3D(-0.816, -0.408, -0.408),
Point3D(-0.89, -0.405, -0.209),
Point3D(-0.707, -0.0, -0.707),
Point3D(-0.831, -0.0, -0.556),
Point3D(-0.789, -0.211, -0.577),
Point3D(-0.89, -0.209, -0.405),
Point3D(-0.199, -0.96, -0.199),
Point3D(-0.211, -0.789, -0.577),
Point3D(-0.408, -0.816, -0.408),
Point3D(-0.209, -0.89, -0.405),
Point3D(-0.577, -0.789, -0.211),
Point3D(-0.405, -0.89, -0.209),
Point3D(-0.195, -0.0, -0.981),
Point3D(-0.383, -0.0, -0.924),
Point3D(-0.199, -0.199, -0.96),
Point3D(-0.577, -0.211, -0.789),
Point3D(-0.556, -0.0, -0.831),
Point3D(-0.408, -0.408, -0.816),
Point3D(-0.405, -0.209, -0.89),
Point3D(-0.211, -0.577, -0.789),
Point3D(-0.209, -0.405, -0.89),
Point3D(-0.64, -0.64, -0.426),
Point3D(-0.426, -0.64, -0.64),
Point3D(-0.64, -0.426, -0.64),
Point3D(-0.96, 0.199, -0.199),
Point3D(-0.789, 0.577, -0.211),
Point3D(-0.816, 0.408, -0.408),
Point3D(-0.89, 0.405, -0.209),
Point3D(-0.789, 0.211, -0.577),
Point3D(-0.89, 0.209, -0.405),
Point3D(-0.199, 0.96, -0.199),
Point3D(-0.211, 0.789, -0.577),
Point3D(-0.408, 0.816, -0.408),
Point3D(-0.209, 0.89, -0.405),
Point3D(-0.577, 0.789, -0.211),
Point3D(-0.405, 0.89, -0.209),
Point3D(-0.199, 0.199, -0.96),
Point3D(-0.577, 0.211, -0.789),
Point3D(-0.408, 0.408, -0.816),
Point3D(-0.405, 0.209, -0.89),
Point3D(-0.211, 0.577, -0.789),
Point3D(-0.209, 0.405, -0.89),
Point3D(-0.64, 0.64, -0.426),
Point3D(-0.426, 0.64, -0.64),
Point3D(-0.64, 0.426, -0.64)], Array{Int64,1}[[1, 2, 3], [4, 5, 2], [6, 3, 5], [2, 5, 3], [7, 8, 9], [10, 11, 8], [4, 9, 11], [8, 11, 9], [12, 13, 14], [6, 15, 13], [10, 14, 15], [13, 15, 14], [4, 11, 5], [10, 15, 11], [6, 5, 15], [11, 15, 5], [16, 17, 18], [19, 20, 17], [21, 18, 20], [17, 20, 18], [22, 23, 24], [25, 26, 23], [19, 24, 26], [23, 26, 24], [7, 27, 28], [21, 29, 27], [25, 28, 29], [27, 29, 28], [19, 26, 20], [25, 29, 26], [21, 20, 29], [26, 29, 20], [30, 31, 32], [33, 34, 31], [35, 32, 34], [31, 34, 32], [12, 36, 37], [38, 39, 36], [33, 37, 39], [36, 39, 37], [22, 40, 41], [35, 42, 40], [38, 41, 42], [40, 42, 41], [33, 39, 34], [38, 42, 39], [35, 34, 42], [39, 42, 34], [7, 28, 8], [25, 43, 28], [10, 8, 43], [28, 43, 8], [22, 41, 23], [38, 44, 41], [25, 23, 44], [41, 44, 23], [12, 14, 36], [10, 45, 14], [38, 36, 45], [14, 45, 36], [25, 44, 43], [38, 45, 44], [10, 43, 45], [44, 45, 43], [3, 46, 1], [46, 48, 47], [48, 3, 6], [3, 48, 46], [51, 50, 49], [50, 53, 52], [53, 51, 47], [51, 53, 50], [54, 13, 12], [13, 55, 6], [55, 54, 52], [54, 55, 13], [48, 53, 47], [53, 55, 52], [55, 48, 6], [48, 55, 53], [58, 57, 56], [57, 60, 59], [60, 58, 61], [58, 60, 57], [64, 63, 62], [63, 66, 65], [66, 64, 59], [64, 66, 63], [68, 67, 49], [67, 69, 61], [69, 68, 65], [68, 69, 67], [60, 66, 59], [66, 69, 65], [69, 60, 61], [60, 69, 66], [70, 31, 30], [31, 71, 33], [71, 70, 72], [70, 71, 31], [37, 73, 12], [73, 75, 74], [75, 37, 33], [37, 75, 73], [77, 76, 62], [76, 78, 72], [78, 77, 74], [77, 78, 76], [71, 75, 33], [75, 78, 74], [78, 71, 72], [71, 78, 75], [50, 68, 49], [68, 79, 65], [79, 50, 52], [50, 79, 68], [63, 77, 62], [77, 80, 74], [80, 63, 65], [63, 80, 77], [73, 54, 12], [54, 81, 52], [81, 73, 74], [73, 81, 54], [79, 80, 65], [80, 81, 74], [81, 79, 52], [79, 81, 80], [82, 2, 1], [2, 83, 4], [83, 82, 84], [82, 83, 2], [9, 85, 7], [85, 87, 86], [87, 9, 4], [9, 87, 85], [90, 89, 88], [89, 91, 84], [91, 90, 86], [90, 91, 89], [83, 87, 4], [87, 91, 86], [91, 83, 84], [83, 91, 87], [18, 92, 16], [92, 94, 93], [94, 18, 21], [18, 94, 92], [97, 96, 95], [96, 99, 98], [99, 97, 93], [97, 99, 96], [100, 27, 7], [27, 101, 21], [101, 100, 98], [100, 101, 27], [94, 99, 93], [99, 101, 98], [101, 94, 21], [94, 101, 99], [104, 103, 102], [103, 106, 105], [106, 104, 107], [104, 106, 103], [109, 108, 88], [108, 111, 110], [111, 109, 105], [109, 111, 108], [113, 112, 95], [112, 114, 107], [114, 113, 110], [113, 114, 112], [106, 111, 105], [111, 114, 110], [114, 106, 107], [106, 114, 111], [85, 100, 7], [100, 115, 98], [115, 85, 86], [85, 115, 100], [96, 113, 95], [113, 116, 110], [116, 96, 98], [96, 116, 113], [108, 90, 88], [90, 117, 86], [117, 108, 110], [108, 117, 90], [115, 116, 98], [116, 117, 110], [117, 115, 86], [115, 117, 116], [1, 46, 82], [47, 118, 46], [84, 82, 118], [46, 118, 82], [49, 119, 51], [120, 121, 119], [47, 51, 121], [119, 121, 51], [88, 89, 122], [84, 123, 89], [120, 122, 123], [89, 123, 122], [47, 121, 118], [120, 123, 121], [84, 118, 123], [121, 123, 118], [56, 124, 58], [125, 126, 124], [61, 58, 126], [124, 126, 58], [127, 128, 129], [130, 131, 128], [125, 129, 131], [128, 131, 129], [49, 67, 132], [61, 133, 67], [130, 132, 133], [67, 133, 132], [125, 131, 126], [130, 133, 131], [61, 126, 133], [131, 133, 126], [102, 103, 134], [105, 135, 103], [136, 134, 135], [103, 135, 134], [88, 137, 109], [138, 139, 137], [105, 109, 139], [137, 139, 109], [127, 140, 141], [136, 142, 140], [138, 141, 142], [140, 142, 141], [105, 139, 135], [138, 142, 139], [136, 135, 142], [139, 142, 135], [49, 132, 119], [130, 143, 132], [120, 119, 143], [132, 143, 119], [127, 141, 128], [138, 144, 141], [130, 128, 144], [141, 144, 128], [88, 122, 137], [120, 145, 122], [138, 137, 145], [122, 145, 137], [130, 144, 143], [138, 145, 144], [120, 143, 145], [144, 145, 143], [148, 147, 146], [147, 150, 149], [150, 148, 151], [148, 150, 147], [154, 153, 152], [153, 156, 155], [156, 154, 149], [154, 156, 153], [159, 158, 157], [158, 160, 151], [160, 159, 155], [159, 160, 158], [150, 156, 149], [156, 160, 155], [160, 150, 151], [150, 160, 156], [161, 17, 16], [17, 162, 19], [162, 161, 163], [161, 162, 17], [24, 164, 22], [164, 166, 165], [166, 24, 19], [24, 166, 164], [168, 167, 152], [167, 169, 163], [169, 168, 165], [168, 169, 167], [162, 166, 19], [166, 169, 165], [169, 162, 163], [162, 169, 166], [32, 170, 30], [170, 172, 171], [172, 32, 35], [32, 172, 170], [174, 173, 157], [173, 176, 175], [176, 174, 171], [174, 176, 173], [177, 40, 22], [40, 178, 35], [178, 177, 175], [177, 178, 40], [172, 176, 171], [176, 178, 175], [178, 172, 35], [172, 178, 176], [153, 168, 152], [168, 179, 165], [179, 153, 155], [153, 179, 168], [164, 177, 22], [177, 180, 175], [180, 164, 165], [164, 180, 177], [173, 159, 157], [159, 181, 155], [181, 173, 175], [173, 181, 159], [179, 180, 165], [180, 181, 175], [181, 179, 155], [179, 181, 180], [146, 182, 148], [183, 184, 182], [151, 148, 184], [182, 184, 148], [185, 186, 187], [188, 189, 186], [183, 187, 189], [186, 189, 187], [157, 158, 190], [151, 191, 158], [188, 190, 191], [158, 191, 190], [183, 189, 184], [188, 191, 189], [151, 184, 191], [189, 191, 184], [56, 57, 192], [59, 193, 57], [194, 192, 193], [57, 193, 192], [62, 195, 64], [196, 197, 195], [59, 64, 197], [195, 197, 64], [185, 198, 199], [194, 200, 198], [196, 199, 200], [198, 200, 199], [59, 197, 193], [196, 200, 197], [194, 193, 200], [197, 200, 193], [30, 170, 70], [171, 201, 170], [72, 70, 201], [170, 201, 70], [157, 202, 174], [203, 204, 202], [171, 174, 204], [202, 204, 174], [62, 76, 205], [72, 206, 76], [203, 205, 206], [76, 206, 205], [171, 204, 201], [203, 206, 204], [72, 201, 206], [204, 206, 201], [185, 199, 186], [196, 207, 199], [188, 186, 207], [199, 207, 186], [62, 205, 195], [203, 208, 205], [196, 195, 208], [205, 208, 195], [157, 190, 202], [188, 209, 190], [203, 202, 209], [190, 209, 202], [196, 208, 207], [203, 209, 208], [188, 207, 209], [208, 209, 207], [146, 147, 210], [149, 211, 147], [212, 210, 211], [147, 211, 210], [152, 213, 154], [214, 215, 213], [149, 154, 215], [213, 215, 154], [216, 217, 218], [212, 219, 217], [214, 218, 219], [217, 219, 218], [149, 215, 211], [214, 219, 215], [212, 211, 219], [215, 219, 211], [16, 92, 161], [93, 220, 92], [163, 161, 220], [92, 220, 161], [95, 221, 97], [222, 223, 221], [93, 97, 223], [221, 223, 97], [152, 167, 224], [163, 225, 167], [222, 224, 225], [167, 225, 224], [93, 223, 220], [222, 225, 223], [163, 220, 225], [223, 225, 220], [102, 226, 104], [227, 228, 226], [107, 104, 228], [226, 228, 104], [216, 229, 230], [231, 232, 229], [227, 230, 232], [229, 232, 230], [95, 112, 233], [107, 234, 112], [231, 233, 234], [112, 234, 233], [227, 232, 228], [231, 234, 232], [107, 228, 234], [232, 234, 228], [152, 224, 213], [222, 235, 224], [214, 213, 235], [224, 235, 213], [95, 233, 221], [231, 236, 233], [222, 221, 236], [233, 236, 221], [216, 218, 229], [214, 237, 218], [231, 229, 237], [218, 237, 229], [222, 236, 235], [231, 237, 236], [214, 235, 237], [236, 237, 235], [210, 182, 146], [182, 238, 183], [238, 210, 212], [210, 238, 182], [187, 239, 185], [239, 241, 240], [241, 187, 183], [187, 241, 239], [242, 217, 216], [217, 243, 212], [243, 242, 240], [242, 243, 217], [238, 241, 183], [241, 243, 240], [243, 238, 212], [238, 243, 241], [192, 124, 56], [124, 244, 125], [244, 192, 194], [192, 244, 124], [129, 245, 127], [245, 247, 246], [247, 129, 125], [129, 247, 245], [248, 198, 185], [198, 249, 194], [249, 248, 246], [248, 249, 198], [244, 247, 125], [247, 249, 246], [249, 244, 194], [244, 249, 247], [134, 226, 102], [226, 250, 227], [250, 134, 136], [134, 250, 226], [230, 251, 216], [251, 253, 252], [253, 230, 227], [230, 253, 251], [254, 140, 127], [140, 255, 136], [255, 254, 252], [254, 255, 140], [250, 253, 227], [253, 255, 252], [255, 250, 136], [250, 255, 253], [239, 248, 185], [248, 256, 246], [256, 239, 240], [239, 256, 248], [245, 254, 127], [254, 257, 252], [257, 245, 246], [245, 257, 254], [251, 242, 216], [242, 258, 240], [258, 251, 252], [251, 258, 242], [256, 257, 246], [257, 258, 252], [258, 256, 240], [256, 258, 257]]);
# ╔═╡ 34c81e7e-7e9b-11eb-0f31-2be4cd8a9f6e
# make a color lighter
function lighten(col::Colorant, f)
c = convert(RGB, col)
return RGB(f * c.r, f* c.g, f * c.b)
end
# ╔═╡ 34c77a82-7e9b-11eb-01c6-65fd78885b74
function drawobject(o;
color=colorant"red")
setlinejoin("bevel")
if !isempty(o.faces)
@layer begin
for (n, f) in enumerate(o.faces)
vertices = o.vertices[f]
sn = surfacenormal(vertices)
ang = anglebetweenvectors(sn, eyepoint())
sethue(lighten(color, rescale(ang, 0, π, 0, 1.75)))
pin(vertices, gfunction = (p3, p2) -> begin
poly(p2, :fillstroke)
#sethue(edgecolor)
#poly(p2, :stroke)
end)
end
end
end
end
# ╔═╡ 34d23ecc-7e9b-11eb-0781-1f1709f25469
function sphere(size, origin, color;
upto=1,
edgecolor=colorant"black")
s1 = make(sphere2)
scaleby!(s1, size, size, size)
moveby!(s1, origin)
sethue(color)
setline(.5)
sortfaces!(s1)
drawobject(s1, color=color)
end
# ╔═╡ cc118d16-7ea1-11eb-0e95-45e2606042fa
md""" These four sliders adjust the `r, θ, ϕ` parameters (the spherical projection) of your `eyepoint()`, and `P` - the amount of perspective foreshortening."""
# ╔═╡ b7dadac2-7e9b-11eb-3f59-0940a80d3b11
@bind r Slider(100:600)
# ╔═╡ c4ccb0fc-7e9b-11eb-0b2b-0f8dfd08b339
@bind θ Slider(0:0.001:2π)
# ╔═╡ dd5252a8-7e9b-11eb-1e46-4f9a4161a1be
@bind ϕ Slider(0.1:0.001:π-0.1)
# ╔═╡ 69e37e9a-7e9c-11eb-2562-7dd5f0c032d0
@bind P Slider(200:800)
# ╔═╡ 3d721dde-7ea2-11eb-2bd2-05e395043188
md""" Now all you have to do is adjust the sliders to make the Julia logo!"""
# ╔═╡ 34dd3386-7e9b-11eb-2979-0f785dc44aa0
begin
Drawing(800, 800, :svg)
origin()
background("black")
helloworld()
eyepoint(sphericaltocartesian(r, θ, ϕ))
perspective(P)
sphere(90, Point3D(150, 0, 0), RGB(Luxor.julia_red...))
sphere(90, Point3D(0, 150, 0), RGB(Luxor.julia_purple...))
sphere(90, Point3D(0, 0, 150), RGB(Luxor.julia_green...))
axes3D(300)
sethue("white")
text("$(eyepoint())", boxtopleft(BoundingBox()) + (0, 20))
finish()
preview()
end
# ╔═╡ c4a6daec-7ea2-11eb-2509-e58195371d3a
md""" You'll notice that the three spheres are completely independent of each other; they exist in parallel 3D worlds... Making them aware of each other is a task for the reader!"""
# ╔═╡ 5aa09a66-7ea2-11eb-249e-412766035e22
md""" That's all!"""
# ╔═╡ Cell order:
# ╟─fc459dbe-7ea0-11eb-04f3-1b7a7ba7f14d
# ╟─6e73574e-7ea3-11eb-3032-3b9a1352bef7
# ╟─8646f864-7ea1-11eb-34c3-8d7fc241b6d4
# ╠═22644f64-7e9b-11eb-3ba3-0dcdec7e57c6
# ╟─916a319e-7ea3-11eb-0a55-ad133c6dd750
# ╟─c3a6d98a-7e9d-11eb-30da-5fbcd64d956b
# ╠═34c81e7e-7e9b-11eb-0f31-2be4cd8a9f6e
# ╠═34c77a82-7e9b-11eb-01c6-65fd78885b74
# ╠═34d23ecc-7e9b-11eb-0781-1f1709f25469
# ╟─cc118d16-7ea1-11eb-0e95-45e2606042fa
# ╠═b7dadac2-7e9b-11eb-3f59-0940a80d3b11
# ╠═c4ccb0fc-7e9b-11eb-0b2b-0f8dfd08b339
# ╠═dd5252a8-7e9b-11eb-1e46-4f9a4161a1be
# ╠═69e37e9a-7e9c-11eb-2562-7dd5f0c032d0
# ╟─3d721dde-7ea2-11eb-2bd2-05e395043188
# ╠═34dd3386-7e9b-11eb-2979-0f785dc44aa0
# ╟─c4a6daec-7ea2-11eb-2509-e58195371d3a
# ╟─5aa09a66-7ea2-11eb-249e-412766035e22