RepliCAD

Форк
0
725 строк · 20.1 Кб
1
import { expect, test } from "vitest";
2
import {
3
  drawRoundedRectangle,
4
  draw,
5
  drawCircle,
6
  drawPolysides,
7
  Drawing,
8
  Point2D,
9
} from "../../src/index";
10

11
test("fuses two rectangles", () => {
12
  const d1 = drawRoundedRectangle(80, 80, 30);
13
  const d2 = drawRoundedRectangle(10, 100);
14
  expect(d1.fuse(d2).toSVG()).toMatchSVGSnapshot();
15
});
16

17
test("fuses two circles", () => {
18
  const d1 = drawCircle(80).translate(-10, 0);
19
  const d2 = drawCircle(60).translate(30, 0);
20
  expect(d1.fuse(d2).toSVG()).toMatchSVGSnapshot();
21
});
22

23
test("cuts one rectangle from the other", () => {
24
  const d1 = drawRoundedRectangle(80, 80, 30);
25
  const d2 = drawRoundedRectangle(10, 100);
26
  expect(d1.cut(d2).toSVG()).toMatchSVGSnapshot();
27
});
28

29
test("intersects two rectangles", () => {
30
  const d1 = drawRoundedRectangle(80, 80, 30);
31
  const d2 = drawRoundedRectangle(10, 100);
32
  expect(d1.intersect(d2).toSVG()).toMatchSVGSnapshot();
33
});
34

35
test("fuse two rectangles with corners", () => {
36
  const d1 = drawRoundedRectangle(80, 80, 30).rotate(20);
37
  const d2 = drawRoundedRectangle(40, 100);
38
  expect(d1.fuse(d2).toSVG()).toMatchSVGSnapshot();
39
});
40

41
test("cut two rectangles with corners", () => {
42
  const d1 = drawRoundedRectangle(80, 80, 30).rotate(20);
43
  const d2 = drawRoundedRectangle(40, 100);
44
  expect(d1.cut(d2).toSVG()).toMatchSVGSnapshot();
45
});
46

47
test("handles the case when a compound is created from fusion", () => {
48
  const d1 = draw([0, -50])
49
    .hLine(-50)
50
    .vLine(100)
51
    .hLine(50)
52
    .vLine(10)
53
    .hLine(-60)
54
    .vLine(-120)
55
    .hLine(60)
56
    .close();
57
  const d2 = drawRoundedRectangle(10, 120).translate(5, 0);
58
  expect(d1.fuse(d2).toSVG()).toMatchSVGSnapshot();
59
});
60

61
test("cut such that a hole becomes the outside", () => {
62
  const d1 = drawRoundedRectangle(80, 80);
63
  const d2 = drawCircle(30);
64
  const d3 = drawRoundedRectangle(40, 10).translate(20, 0);
65
  expect(d1.cut(d2).cut(d3).toSVG()).toMatchSVGSnapshot();
66
});
67

68
const polarCopies = (shape: Drawing, count: number, radius: number) => {
69
  const base = shape.translate(0, radius);
70
  const angle = 360 / count;
71

72
  const copies: Drawing[] = [];
73
  for (let i = 0; i < count; i++) {
74
    copies.push(base.rotate(i * angle));
75
  }
76
  return copies;
77
};
78

79
const fuseAll = (shapes: Drawing[]) => {
80
  let result = shapes[0];
81
  shapes.slice(1).forEach((shape) => {
82
    result = result.fuse(shape);
83
  });
84
  return result;
85
};
86

87
test.each([5, 11, 13])(
88
  "handles a complex example of merging shapes with %d copies",
89
  (n) => {
90
    const shape = drawPolysides(6, 6);
91
    const outlinedShape = shape.offset(0.5).cut(shape.offset(-0.5));
92
    const copies = polarCopies(outlinedShape, n, 9);
93

94
    const fused = fuseAll(copies);
95

96
    expect(fused.toSVG()).toMatchSVGSnapshot();
97
  }
98
);
99

100
const triangles: [Point2D, Point2D, Point2D][] = [
101
  [
102
    [0, 0],
103
    [14.0625, 0],
104
    [14.999999999999998, -5.087131436281159],
105
  ],
106
  [
107
    [0, 0],
108
    [14.999999999999998, -5.087131436281159],
109
    [-15.000000000000004, -5.087131436281141],
110
  ],
111
  [
112
    [0, 0],
113
    [-15.000000000000004, -5.087131436281141],
114
    [-9.037735159573977, 6.763116311474526],
115
  ],
116
  [
117
    [0, 0],
118
    [-9.037735159573977, 6.763116311474526],
119
    [1.865174681370263e-14, 15.261394308843476],
120
  ],
121
  [
122
    [-9.037735159573977, 6.763116311474526],
123
    [-15.000000000000004, -5.087131436281141],
124
    [-9.675180053141624, 7.189474166860152],
125
  ],
126
  [
127
    [-9.675180053141624, 7.189474166860152],
128
    [-15.000000000000004, -5.087131436281141],
129
    [-8.000000000000007, 25.435657181405805],
130
  ],
131
  [
132
    [-8.000000000000007, 25.435657181405805],
133
    [-15.000000000000004, -5.087131436281141],
134
    [-7.499999999999897, 35.60992005396811],
135
  ],
136
  [
137
    [-8.000000000000007, 25.435657181405805],
138
    [-7.499999999999897, 35.60992005396811],
139
    [-7.814835389770436, 27.176719368153215],
140
  ],
141
  [
142
    [-7.814835389770436, 27.176719368153215],
143
    [-7.499999999999897, 35.60992005396811],
144
    [-7.287644378911123, 28.79320082185884],
145
  ],
146
  [
147
    [-7.287644378911123, 28.79320082185884],
148
    [-7.499999999999897, 35.60992005396811],
149
    [-6.281519359620161, 30.47602793525325],
150
  ],
151
  [
152
    [-6.281519359620161, 30.47602793525325],
153
    [-7.499999999999897, 35.60992005396811],
154
    [-5.159435917248953, 31.656137011351642],
155
  ],
156
  [
157
    [-5.159435917248953, 31.656137011351642],
158
    [-7.499999999999897, 35.60992005396811],
159
    [-4.0166211429761844, 32.47480273276338],
160
  ],
161
  [
162
    [-4.0166211429761844, 32.47480273276338],
163
    [-7.499999999999897, 35.60992005396811],
164
    [-2.878254499509339, 33.03002377846391],
165
  ],
166
  [
167
    [-2.878254499509339, 33.03002377846391],
168
    [-7.499999999999897, 35.60992005396811],
169
    [-1.7485555329428917, 33.378267927827935],
170
  ],
171
  [
172
    [-1.7485555329428917, 33.378267927827935],
173
    [-7.499999999999897, 35.60992005396811],
174
    [-0.6254051035361321, 33.55015764894129],
175
  ],
176
  [
177
    [-0.6254051035361321, 33.55015764894129],
178
    [-7.499999999999897, 35.60992005396811],
179
    [0.49519544040220814, 33.559459272681295],
180
  ],
181
  [
182
    [0.49519544040220814, 33.559459272681295],
183
    [-7.499999999999897, 35.60992005396811],
184
    [7.500000000000104, 35.60992005396825],
185
  ],
186
  [
187
    [0.49519544040220814, 33.559459272681295],
188
    [7.500000000000104, 35.60992005396825],
189
    [1.6178253438012995, 33.40689452102694],
190
  ],
191
  [
192
    [1.6178253438012995, 33.40689452102694],
193
    [7.500000000000104, 35.60992005396825],
194
    [2.746624486362765, 33.08031785939673],
195
  ],
196
  [
197
    [2.746624486362765, 33.08031785939673],
198
    [7.500000000000104, 35.60992005396825],
199
    [3.8840547206139435, 32.55139719795343],
200
  ],
201
  [
202
    [3.8840547206139435, 32.55139719795343],
203
    [7.500000000000104, 35.60992005396825],
204
    [5.027051998596925, 31.767347767310195],
205
  ],
206
  [
207
    [5.027051998596925, 31.767347767310195],
208
    [7.500000000000104, 35.60992005396825],
209
    [6.031511836253476, 30.782797624973057],
210
  ],
211
  [
212
    [6.031511836253476, 30.782797624973057],
213
    [7.500000000000104, 35.60992005396825],
214
    [6.748780453713429, 29.806324687291763],
215
  ],
216
  [
217
    [6.748780453713429, 29.806324687291763],
218
    [7.500000000000104, 35.60992005396825],
219
    [7.3787323507642855, 28.580526519754564],
220
  ],
221
  [
222
    [7.3787323507642855, 28.580526519754564],
223
    [7.500000000000104, 35.60992005396825],
224
    [7.8259843512896605, 27.124084897826446],
225
  ],
226
  [
227
    [7.8259843512896605, 27.124084897826446],
228
    [7.500000000000104, 35.60992005396825],
229
    [11.250000000000288, 15.261394308843652],
230
  ],
231
  [
232
    [11.250000000000288, 15.261394308843652],
233
    [1.865174681370263e-14, 15.261394308843476],
234
    [2.9681946363630565, 17.877212423185448],
235
  ],
236
  [
237
    [11.250000000000288, 15.261394308843652],
238
    [2.9681946363630565, 17.877212423185448],
239
    [4.137024309826323, 18.469070410223146],
240
  ],
241
  [
242
    [11.250000000000288, 15.261394308843652],
243
    [4.137024309826323, 18.469070410223146],
244
    [5.230691228137659, 19.27708676467615],
245
  ],
246
  [
247
    [11.250000000000288, 15.261394308843652],
248
    [5.230691228137659, 19.27708676467615],
249
    [6.218103424245632, 20.31453620788313],
250
  ],
251
  [
252
    [11.250000000000288, 15.261394308843652],
253
    [6.218103424245632, 20.31453620788313],
254
    [7.0573935209813605, 21.60261968676894],
255
  ],
256
  [
257
    [11.250000000000288, 15.261394308843652],
258
    [7.0573935209813605, 21.60261968676894],
259
    [7.562614640098201, 22.78119613152436],
260
  ],
261
  [
262
    [11.250000000000288, 15.261394308843652],
263
    [7.562614640098201, 22.78119613152436],
264
    [7.891565269530931, 24.100075380674866],
265
  ],
266
  [
267
    [2.9681946363630565, 17.877212423185448],
268
    [1.865174681370263e-14, 15.261394308843476],
269
    [1.7491031281525513, 17.493171273505435],
270
  ],
271
  [
272
    [11.250000000000288, 15.261394308843652],
273
    [7.891565269530931, 24.100075380674866],
274
    [7.998836758981678, 25.574454740438988],
275
  ],
276
  [
277
    [1.7491031281525513, 17.493171273505435],
278
    [1.865174681370263e-14, 15.261394308843476],
279
    [0.5016277322923197, 17.31226361259904],
280
  ],
281
  [
282
    [0.5016277322923197, 17.31226361259904],
283
    [1.865174681370263e-14, 15.261394308843476],
284
    [-0.7537137010686332, 17.332451401390855],
285
  ],
286
  [
287
    [-0.7537137010686332, 17.332451401390855],
288
    [1.865174681370263e-14, 15.261394308843476],
289
    [-1.9968522144188805, 17.553880836526915],
290
  ],
291
  [
292
    [-1.9968522144188805, 17.553880836526915],
293
    [1.865174681370263e-14, 15.261394308843476],
294
    [-3.2074886001878475, 17.979094300174644],
295
  ],
296
  [
297
    [-9.675180053141624, 7.189474166860152],
298
    [-8.000000000000007, 25.435657181405805],
299
    [-7.775336189276026, 23.52026007738302],
300
  ],
301
  [
302
    [-9.675180053141624, 7.189474166860152],
303
    [-7.775336189276026, 23.52026007738302],
304
    [-7.202956818990907, 21.89398864152197],
305
  ],
306
  [
307
    [-9.675180053141624, 7.189474166860152],
308
    [-7.202956818990907, 21.89398864152197],
309
    [-6.400061873262468, 20.55209494165617],
310
  ],
311
  [
312
    [-9.675180053141624, 7.189474166860152],
313
    [-6.400061873262468, 20.55209494165617],
314
    [-5.438236844191913, 19.466079771934012],
315
  ],
316
  [
317
    [-9.675180053141624, 7.189474166860152],
318
    [-5.438236844191913, 19.466079771934012],
319
    [-4.363146304020197, 18.6133640552573],
320
  ],
321
  [
322
    [14.999999999999998, -5.087131436281159],
323
    [14.0625, 0],
324
    [17.858120437956206, 1.4481615037588669],
325
  ],
326
  [
327
    [14.999999999999998, -5.087131436281159],
328
    [17.858120437956206, 1.4481615037588669],
329
    [43.02919708029198, 5.606984283784323],
330
  ],
331
  [
332
    [11.250000000000288, 15.261394308843652],
333
    [7.500000000000104, 35.60992005396825],
334
    [12.41788321167908, 15.706982463846387],
335
  ],
336
  [
337
    [17.858120437956206, 1.4481615037588669],
338
    [12.41788321167908, 15.706982463846387],
339
    [26.06903892944051, 10.025733487561286],
340
  ],
341
  [
342
    [12.41788321167908, 15.706982463846387],
343
    [7.500000000000104, 35.60992005396825],
344
    [18.62074209245758, 28.96323007517763],
345
  ],
346
  [
347
    [18.62074209245758, 28.96323007517763],
348
    [7.500000000000104, 35.60992005396825],
349
    [21.514598540146046, 40.956977914001115],
350
  ],
351
  [
352
    [26.06903892944051, 10.025733487561286],
353
    [12.41788321167908, 15.706982463846387],
354
    [29.58409367396621, 16.811669764790274],
355
  ],
356
  [
357
    [21.514598540146046, 40.956977914001115],
358
    [43.02919708029198, 5.606984283784323],
359
    [26.066377737227047, 29.081589428850528],
360
  ],
361
  [
362
    [-7.499999999999897, 35.60992005396811],
363
    [-15.000000000000004, -5.087131436281141],
364
    [-16.15510948905104, 17.13286455985496],
365
  ],
366
  [
367
    [-16.15510948905104, 17.13286455985496],
368
    [-15.000000000000004, -5.087131436281141],
369
    [-28.547445255474443, 0.08169116175055202],
370
  ],
371
  [
372
    [-16.15510948905104, 17.13286455985496],
373
    [-28.547445255474443, 0.08169116175055202],
374
    [-14.040145985401361, 38.10521372198341],
375
  ],
376
  [
377
    [1.865174681370263e-14, 15.261394308843476],
378
    [11.250000000000288, 15.261394308843652],
379
    [3.0730973321624303e-13, 14.011394308843466],
380
  ],
381
  [
382
    [0, 0],
383
    [1.865174681370263e-14, 15.261394308843476],
384
    [3.9929182594206813, 0.7486721736413746],
385
  ],
386
  [
387
    [43.02919708029198, 5.606984283784323],
388
    [21.514598540146046, 40.956977914001115],
389
    [26.944588276892826, 34.37501582471773],
390
  ],
391
  [
392
    [26.944588276892826, 34.37501582471773],
393
    [21.514598540146046, 40.956977914001115],
394
    [26.15196489046622, 36.21535391298498],
395
  ],
396
  [
397
    [26.15196489046622, 36.21535391298498],
398
    [21.514598540146046, 40.956977914001115],
399
    [25.84476047405407, 37.916465383064285],
400
  ],
401
  [
402
    [25.84476047405407, 37.916465383064285],
403
    [21.514598540146046, 40.956977914001115],
404
    [25.87128579081724, 39.380030657095766],
405
  ],
406
  [
407
    [25.87128579081724, 39.380030657095766],
408
    [21.514598540146046, 40.956977914001115],
409
    [26.11100308622886, 40.6355406301655],
410
  ],
411
  [
412
    [26.11100308622886, 40.6355406301655],
413
    [21.514598540146046, 40.956977914001115],
414
    [26.497639445753883, 41.724380698725795],
415
  ],
416
  [
417
    [26.497639445753883, 41.724380698725795],
418
    [21.514598540146046, 40.956977914001115],
419
    [27.183984543103612, 42.969261082525975],
420
  ],
421
  [
422
    [27.183984543103612, 42.969261082525975],
423
    [21.514598540146046, 40.956977914001115],
424
    [28.14843005156051, 44.13722039702907],
425
  ],
426
  [
427
    [43.02919708029198, 5.606984283784323],
428
    [26.944588276892826, 34.37501582471773],
429
    [28.19681524206102, 32.73904123800764],
430
  ],
431
  [
432
    [28.14843005156051, 44.13722039702907],
433
    [21.514598540146046, 40.956977914001115],
434
    [32.70246150567573, 50.94856048457167],
435
  ],
436
  [
437
    [28.14843005156051, 44.13722039702907],
438
    [32.70246150567573, 50.94856048457167],
439
    [29.302767287917, 45.08787343227521],
440
  ],
441
  [
442
    [29.302767287917, 45.08787343227521],
443
    [32.70246150567573, 50.94856048457167],
444
    [30.660487593670485, 45.821930600766585],
445
  ],
446
  [
447
    [30.660487593670485, 45.821930600766585],
448
    [32.70246150567573, 50.94856048457167],
449
    [32.26313326336891, 46.30353078355222],
450
  ],
451
  [
452
    [32.26313326336891, 46.30353078355222],
453
    [32.70246150567573, 50.94856048457167],
454
    [34.18909251852194, 46.42993921740859],
455
  ],
456
  [
457
    [34.18909251852194, 46.42993921740859],
458
    [32.70246150567573, 50.94856048457167],
459
    [36.05878789231104, 46.104567924314324],
460
  ],
461
  [
462
    [36.05878789231104, 46.104567924314324],
463
    [32.70246150567573, 50.94856048457167],
464
    [37.80932856673241, 45.35236428845875],
465
  ],
466
  [
467
    [37.80932856673241, 45.35236428845875],
468
    [32.70246150567573, 50.94856048457167],
469
    [38.896755890916, 44.60503880732156],
470
  ],
471
  [
472
    [38.896755890916, 44.60503880732156],
473
    [32.70246150567573, 50.94856048457167],
474
    [65.4049230113465, 25.590149424922807],
475
  ],
476
  [
477
    [38.896755890916, 44.60503880732156],
478
    [65.4049230113465, 25.590149424922807],
479
    [39.85252277691971, 43.69306265069026],
480
  ],
481
  [
482
    [39.85252277691971, 43.69306265069026],
483
    [65.4049230113465, 25.590149424922807],
484
    [53.255864532494236, 31.199931492767178],
485
  ],
486
  [
487
    [39.85252277691971, 43.69306265069026],
488
    [53.255864532494236, 31.199931492767178],
489
    [40.96082719430757, 42.11477162067656],
490
  ],
491
  [
492
    [40.96082719430757, 42.11477162067656],
493
    [53.255864532494236, 31.199931492767178],
494
    [41.617184924906304, 40.52050665883264],
495
  ],
496
  [
497
    [41.617184924906304, 40.52050665883264],
498
    [53.255864532494236, 31.199931492767178],
499
    [41.9121628340546, 38.984911567240694],
500
  ],
501
  [
502
    [41.9121628340546, 38.984911567240694],
503
    [53.255864532494236, 31.199931492767178],
504
    [41.91819260760609, 37.53434128643309],
505
  ],
506
  [
507
    [41.91819260760609, 37.53434128643309],
508
    [53.255864532494236, 31.199931492767178],
509
    [41.68434986554822, 36.18220818870151],
510
  ],
511
  [
512
    [41.68434986554822, 36.18220818870151],
513
    [53.255864532494236, 31.199931492767178],
514
    [41.2448003312233, 34.93910134437748],
515
  ],
516
  [
517
    [53.255864532494236, 31.199931492767178],
518
    [65.4049230113465, 25.590149424922807],
519
    [53.06443267520815, 30.45732160849354],
520
  ],
521
  [
522
    [53.06443267520815, 30.45732160849354],
523
    [65.4049230113465, 25.590149424922807],
524
    [52.76874058903504, 29.767968450275603],
525
  ],
526
  [
527
    [52.76874058903504, 29.767968450275603],
528
    [65.4049230113465, 25.590149424922807],
529
    [52.380391239898955, 29.13607708911145],
530
  ],
531
  [
532
    [52.380391239898955, 29.13607708911145],
533
    [65.4049230113465, 25.590149424922807],
534
    [51.90795647733907, 28.56573184059028],
535
  ],
536
  [
537
    [53.255864532494236, 31.199931492767178],
538
    [53.06443267520815, 30.45732160849354],
539
    [51.35824503528044, 28.061326639676654],
540
  ],
541
  [
542
    [41.2448003312233, 34.93910134437748],
543
    [51.35824503528044, 28.061326639676654],
544
    [40.624963356048475, 33.81540764943102],
545
  ],
546
  [
547
    [40.624963356048475, 33.81540764943102],
548
    [51.35824503528044, 28.061326639676654],
549
    [39.84503080833293, 32.82201797715716],
550
  ],
551
  [
552
    [39.84503080833293, 32.82201797715716],
553
    [51.35824503528044, 28.061326639676654],
554
    [38.92211004035242, 31.9708369198837],
555
  ],
556
  [
557
    [51.35824503528044, 28.061326639676654],
558
    [43.02919708029198, 5.606984283784323],
559
    [41.70981649381012, 19.444571970323707],
560
  ],
561
  [
562
    [38.92211004035242, 31.9708369198837],
563
    [41.70981649381012, 19.444571970323707],
564
    [37.87158172333802, 31.275150413580757],
565
  ],
566
  [
567
    [37.87158172333802, 31.275150413580757],
568
    [41.70981649381012, 19.444571970323707],
569
    [36.70686855789293, 30.749684298184345],
570
  ],
571
  [
572
    [41.70981649381012, 19.444571970323707],
573
    [43.02919708029198, 5.606984283784323],
574
    [41.10110298369262, 19.022202323429074],
575
  ],
576
  [
577
    [41.10110298369262, 19.022202323429074],
578
    [43.02919708029198, 5.606984283784323],
579
    [40.43965903526714, 18.688838444701922],
580
  ],
581
  [
582
    [40.43965903526714, 18.688838444701922],
583
    [43.02919708029198, 5.606984283784323],
584
    [39.73056621887958, 18.45214972475783],
585
  ],
586
  [
587
    [39.73056621887958, 18.45214972475783],
588
    [43.02919708029198, 5.606984283784323],
589
    [38.979096273465785, 18.32244213836834],
590
  ],
591
  [
592
    [36.70686855789293, 30.749684298184345],
593
    [38.979096273465785, 18.32244213836834],
594
    [35.44127054214691, 30.412578797256806],
595
  ],
596
  [
597
    [35.44127054214691, 30.412578797256806],
598
    [38.979096273465785, 18.32244213836834],
599
    [34.08776520308343, 30.286619645703045],
600
  ],
601
  [
602
    [34.08776520308343, 30.286619645703045],
603
    [38.979096273465785, 18.32244213836834],
604
    [32.660067783034044, 30.402504680495312],
605
  ],
606
  [
607
    [32.660067783034044, 30.402504680495312],
608
    [38.979096273465785, 18.32244213836834],
609
    [31.175949749223747, 30.804016529929132],
610
  ],
611
  [
612
    [31.175949749223747, 30.804016529929132],
613
    [38.979096273465785, 18.32244213836834],
614
    [29.665104064660564, 31.555294226568517],
615
  ],
616
  [
617
    [65.4049230113465, 25.590149424922807],
618
    [32.70246150567573, 50.94856048457167],
619
    [51.465608475382794, 42.9325255674089],
620
  ],
621
  [
622
    [65.4049230113465, 25.590149424922807],
623
    [51.465608475382794, 42.9325255674089],
624
    [72.06640589603971, 38.46938254560742],
625
  ],
626
  [
627
    [72.06640589603971, 38.46938254560742],
628
    [51.465608475382794, 42.9325255674089],
629
    [35.91834979483797, 57.166121301453884],
630
  ],
631
  [
632
    [72.06640589603971, 38.46938254560742],
633
    [35.91834979483797, 57.166121301453884],
634
    [43.70408043027748, 54.51325500675499],
635
  ],
636
  [
637
    [43.70408043027748, 54.51325500675499],
638
    [35.91834979483797, 57.166121301453884],
639
    [42.25506248921485, 55.5666183093269],
640
  ],
641
  [
642
    [42.25506248921485, 55.5666183093269],
643
    [35.91834979483797, 57.166121301453884],
644
    [41.07676983910428, 56.916008420237006],
645
  ],
646
  [
647
    [41.07676983910428, 56.916008420237006],
648
    [35.91834979483797, 57.166121301453884],
649
    [40.22828699354392, 58.493761284761845],
650
  ],
651
  [
652
    [40.22828699354392, 58.493761284761845],
653
    [35.91834979483797, 57.166121301453884],
654
    [39.75216042536598, 60.22076178615197],
655
  ],
656
  [
657
    [39.75216042536598, 60.22076178615197],
658
    [35.91834979483797, 57.166121301453884],
659
    [39.67226510883031, 62.010410907941555],
660
  ],
661
  [
662
    [39.67226510883031, 62.010410907941555],
663
    [35.91834979483797, 57.166121301453884],
664
    [38.07725906038438, 64.3486773077192],
665
  ],
666
  [
667
    [39.67226510883031, 62.010410907941555],
668
    [38.07725906038438, 64.3486773077192],
669
    [39.99260732872179, 63.772968170240155],
670
  ],
671
  [
672
    [72.06640589603971, 38.46938254560742],
673
    [43.70408043027748, 54.51325500675499],
674
    [45.35116385215525, 53.80873854697423],
675
  ],
676
  [
677
    [72.06640589603971, 38.46938254560742],
678
    [45.35116385215525, 53.80873854697423],
679
    [47.11372111445385, 53.48839632708271],
680
  ],
681
  [
682
    [72.06640589603971, 38.46938254560742],
683
    [47.11372111445385, 53.48839632708271],
684
    [48.90337023624344, 53.568291643618366],
685
  ],
686
  [
687
    [72.06640589603971, 38.46938254560742],
688
    [48.90337023624344, 53.568291643618366],
689
    [50.63037073763354, 54.04441821179629],
690
  ],
691
  [
692
    [72.06640589603971, 38.46938254560742],
693
    [50.63037073763354, 54.04441821179629],
694
    [52.2081236021584, 54.89290105735665],
695
  ],
696
  [
697
    [72.06640589603971, 38.46938254560742],
698
    [52.2081236021584, 54.89290105735665],
699
    [53.55751371306851, 56.07119370746722],
700
  ],
701
  [
702
    [72.06640589603971, 38.46938254560742],
703
    [53.55751371306851, 56.07119370746722],
704
    [76.38422442713265, 52.834494558138005],
705
  ],
706
  [
707
    [76.38422442713265, 52.834494558138005],
708
    [53.55751371306851, 56.07119370746722],
709
    [54.61087701564045, 57.52021164852984],
710
  ],
711
  [
712
    [76.38422442713265, 52.834494558138005],
713
    [54.61087701564045, 57.52021164852984],
714
    [55.315393475421125, 59.16729507040763],
715
  ],
716
];
717

718
test("build from triangles", () => {
719
  const drawings = triangles
720
    .sort(() => Math.random() - 0.4)
721
    .map(([a, b, c]) => draw(a).lineTo(b).lineTo(c).close());
722

723
  const fused = fuseAll(drawings);
724
  expect(fused.toSVG()).toMatchSVGSnapshot();
725
});
726

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.