spade 2.15.0

Delaunay triangulations for the rust ecosystem
Documentation
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
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
use crate::{DelaunayTriangulation, Point2, Triangulation, TriangulationExt};

use alloc::{vec, vec::Vec};

fn fuzz_test(vertices: Vec<Point2<f64>>) {
    let mut clone = vertices.clone();
    clone.sort_by(|l, r| l.partial_cmp(r).unwrap());
    clone.dedup();
    let expected_size = clone.len();

    let triangulation = DelaunayTriangulation::<_>::bulk_load_stable(vertices.clone()).unwrap();
    triangulation.sanity_check();
    assert_eq!(triangulation.num_vertices(), expected_size);

    let triangulation = DelaunayTriangulation::<_>::bulk_load(vertices).unwrap();
    triangulation.sanity_check();
    assert_eq!(triangulation.num_vertices(), expected_size);
}

#[test]
fn test_bulk_load_fuzz_1() {
    fuzz_test(vec![
        Point2::new(10.0, 0.0),
        Point2::new(0.0, 2.0),
        Point2::new(0.0, 16.0),
        Point2::new(0.0, 0.0),
        Point2::new(0.0, 16.0),
        Point2::new(4.0, 4.0),
    ]);
}

#[test]
fn test_bulk_load_fuzz_2() {
    fuzz_test(vec![
        Point2::new(10.0, 1.0),
        Point2::new(1.0, 1.0),
        Point2::new(3.0, 2.0),
        Point2::new(0.0, 0.0),
        Point2::new(-19.0, 0.0),
        Point2::new(0.0, -1.0),
        Point2::new(-1.0, -1.0),
        Point2::new(-1.0, 0.0),
    ]);
}

#[test]
fn test_bulk_load_fuzz_3() {
    fuzz_test(vec![
        Point2::new(10.0, 3.0),
        Point2::new(0.0, -19.0),
        Point2::new(16.0, 0.0),
        Point2::new(0.0, 10.0),
        Point2::new(0.0, 8.0),
        Point2::new(0.0, 0.0),
        Point2::new(0.0, 1.0),
        Point2::new(-4.0, 0.0),
        Point2::new(-20.0, 0.0),
        Point2::new(8.0, 0.0),
        Point2::new(0.0, 0.0),
        Point2::new(-7.0, -1.0),
        Point2::new(0.0, 4.0),
    ]);
}

#[test]
fn test_bulk_load_fuzz_4() {
    fuzz_test(vec![
        Point2::new(10.0, 1.0),
        Point2::new(1.0, 3.0),
        Point2::new(0.0, 0.0),
        Point2::new(3.0, 0.0),
        Point2::new(-4.0, 0.0),
        Point2::new(0.0, 0.0),
        Point2::new(16.0, -19.0),
        Point2::new(-1.0, 10.0),
        Point2::new(8.0, 0.0),
        Point2::new(0.0, 0.0),
        Point2::new(0.0, -4.0),
    ]);
}

#[test]
fn test_bulk_load_fuzz_5() {
    fuzz_test(vec![
        Point2::new(10.0, 16.0),
        Point2::new(0.0, -4.0),
        Point2::new(7.0, -19.0),
        Point2::new(4.0, 0.0),
        Point2::new(16.0, 0.0),
        Point2::new(-20.0, 10.0),
        Point2::new(0.0, 0.0),
        Point2::new(0.0, -1.0),
        Point2::new(-1.0, 0.0),
    ]);
}

#[test]
fn test_bulk_load_fuzz_6() {
    fuzz_test(vec![
        Point2::new(10.0, 0.0),
        Point2::new(16.0, 16.0),
        Point2::new(0.0, 0.0),
        Point2::new(16.0, 0.0),
        Point2::new(0.0, 10.0),
        Point2::new(-4.0, 0.0),
        Point2::new(0.0, 0.0),
        Point2::new(-19.0, 0.0),
        Point2::new(0.0, -20.0),
        Point2::new(10.0, 0.0),
        Point2::new(8.0, 0.0),
        Point2::new(0.0, 1.0),
    ]);
}

#[test]
fn test_bulk_load_fuzz_7() {
    fuzz_test(vec![
        Point2::new(10.0, -1.0),
        Point2::new(-1.0, -1.0),
        Point2::new(-1.0, -1.0),
        Point2::new(-1.0, -1.0),
        Point2::new(-1.0, -1.0),
        Point2::new(-1.0, -1.0),
        Point2::new(-1.0, -1.0),
        Point2::new(-1.0, -1.0),
        Point2::new(-1.0, -1.0),
        Point2::new(-1.0, -1.0),
        Point2::new(-1.0, -1.0),
        Point2::new(-1.0, -2.0),
        Point2::new(-1.0, -1.0),
        Point2::new(-1.0, -1.0),
        Point2::new(0.0, -7.0),
        Point2::new(0.0, 2.0),
        Point2::new(0.0, 16.0),
        Point2::new(0.0, 0.0),
        Point2::new(3.0, 0.0),
        Point2::new(16.0, 0.0),
    ]);
}

#[test]
fn test_bulk_load_fuzz_8() {
    fuzz_test(vec![
        Point2::new(10.0, 3.0),
        Point2::new(2.0, 0.0),
        Point2::new(0.0, 4.0),
        Point2::new(0.0, 0.0),
        Point2::new(10.0, 2.0),
        Point2::new(8.0, 0.0),
        Point2::new(0.0, -19.0),
        Point2::new(0.0, 0.0),
        Point2::new(-20.0, 10.0),
        Point2::new(0.0, -1.0),
        Point2::new(-1.0, 0.0),
        Point2::new(1.0, 0.0),
    ]);
}

#[test]
fn test_bulk_load_fuzz_9() {
    fuzz_test(vec![
        Point2::new(10.0, 3.0),
        Point2::new(2.0, 0.0),
        Point2::new(16.0, 9.0),
        Point2::new(0.0, 2.0),
        Point2::new(0.0, -19.0),
        Point2::new(0.0, 0.0),
        Point2::new(-20.0, 10.0),
        Point2::new(0.0, 3.0),
        Point2::new(1.0, 0.0),
        Point2::new(0.0, -1.0),
        Point2::new(-1.0, -1.0),
    ]);
}

#[test]
fn test_bulk_load_fuzz_10() {
    fuzz_test(vec![
        Point2::new(0.0, 1.469368e-39),
        Point2::new(1.83671e-40, 0.0),
        Point2::new(0.03515625, 0.0),
        Point2::new(0.0, 0.0),
        Point2::new(0.0, 9.1835e-41),
        Point2::new(1.85823e-40, 0.0),
    ]);
}

#[test]
fn test_bulk_load_fuzz_11() {
    fuzz_test(vec![
        Point2::new(0.0, -4.391866e-18),
        Point2::new(0.0, 9.403955e-38),
        Point2::new(0.0, 0.0),
        Point2::new(9.408547e-38, 0.0),
    ]);
}

#[test]
fn test_bulk_load_fuzz_12() {
    fuzz_test(vec![
        Point2::new(12.078431, 12.078431),
        Point2::new(12.078431, 12.078431),
        Point2::new(12.078431, 12.111878),
        Point2::new(3.0196078, 3.0196078),
        Point2::new(12.078431, 12.078919),
        Point2::new(12.078431, 12.078431),
        Point2::new(12.124999, 12.078431),
        Point2::new(12.078431, 12.078431),
        Point2::new(12.098451, 12.078431),
        Point2::new(12.07843, 12.07843),
        Point2::new(12.078431, 12.078431),
        Point2::new(12.078431, 12.015931),
        Point2::new(12.015931, 12.078431),
    ]);
}

#[test]
fn test_bulk_load_fuzz_13() {
    fuzz_test(vec![
        Point2::new(-1.7936620343357662e-43, 1.7936620343357662e-43),
        Point2::new(-1.793662034335766e-43, 1.7936620343357662e-43),
        Point2::new(1.793662034335766e-43, -1.793662034335766e-43),
        Point2::new(1.793662034335766e-43, 1.7936620343357662e-43),
        Point2::new(1.7936620343357662e-43, -1.793662034335766e-43),
        Point2::new(-1.793662034335766e-43, -1.793662034335766e-43),
        Point2::new(-1.793662034335766e-43, -1.7936620343357662e-43),
        Point2::new(1.793662034335766e-43, -1.7936620343357662e-43),
        Point2::new(1.793662034335766e-43, 1.793662034335766e-43),
        Point2::new(-1.7936620343357662e-43, -1.7936620343357662e-43),
        Point2::new(-1.7936620343357662e-43, -1.793662034335766e-43),
        Point2::new(1.7936620343357662e-43, 1.793662034335766e-43),
    ]);
}

#[test]
fn test_bulk_load_fuzz_14() {
    fuzz_test(vec![
        Point2::new(-1.999_999_739_220_655_4, 4.000_466_406_403_405),
        Point2::new(-1.999_877_928_659_842_3, 4.062_966_407_334_729),
        Point2::new(-1.999_999_998_972_344, -1.999_999_998_981_323_3),
        Point2::new(-1.999_999_739_220_655_2, 4.062_966_406_403_405),
        Point2::new(-1.999_999_872_312_472_1, 4.062_966_407_334_727),
        Point2::new(-1.999_999_739_220_655_4, 4.062_966_406_403_405),
        Point2::new(-1.999_877_928_659_842_3, 4.062_966_407_334_727),
        Point2::new(-1.999_999_998_972_342_3, -1.999_999_996_711_224_5),
    ]);
}

#[test]
fn test_bulk_load_fuzz_15() {
    fuzz_test(vec![
        Point2::new(-1.9999999964929343, 1.9999999999999998),
        Point2::new(1.9999999999999998, 1.9999998807907102),
        Point2::new(1.9999999999999998, -2.0009765624999996),
        Point2::new(1.9999999999955662, 1.9999999973661031),
        Point2::new(1.9999999839783411, -1.9999999973660463),
        Point2::new(1.9999999973660552, 1.9999999999938607),
        Point2::new(1.9999999973661031, 1.9999999999999998),
        Point2::new(-1.750244140624953, 1.9999999999999998),
        Point2::new(1.9999990463547872, 1.9999999999999998),
        Point2::new(1.9999999973660465, 1.9999990463547872),
        Point2::new(1.9999999999999998, 1.999999997366057),
        Point2::new(1.9999999973661031, 1.999999217682898),
        Point2::new(-2.2499999999999996, -1.9399394989086431),
        Point2::new(1.999999999985449, 1.9999999999956228),
        Point2::new(1.9999999999956228, 2.2499999947322062),
        Point2::new(1.9999999850944616, 1.9999999899154657),
        Point2::new(1.9999999999999458, -1.9999999973661031),
        Point2::new(1.9843749999999998, 1.9999990464712025),
        Point2::new(1.9999999999999998, 1.9999999973661031),
        Point2::new(1.999999110747012, 1.9999999999999998),
        Point2::new(-1.999999999999953, 1.9999999999999998),
        Point2::new(1.9531240463547872, 1.9999999999999998),
        Point2::new(1.9999999973661022, 1.9999999973661031),
    ]);
}

#[test]
fn test_bulk_load_fuzz_16() {
    fuzz_test(vec![
        Point2::new(-1.9999999999999458, 1.9999999999999998),
        Point2::new(1.9999999999956228, 1.9843749973660463),
        Point2::new(-1.9999999999999998, 1.9999999999999998),
        Point2::new(1.9999998807907102, 1.9999999969149937),
    ]);
}

#[test]
fn test_bulk_load_fuzz_17() {
    fuzz_test(vec![
        Point2::new(2.0000000074796844, 2.0),
        Point2::new(2.0, 2.0000000298023224),
        Point2::new(2.001953125, 8.0),
        Point2::new(2.0, 2.000000029802323),
        Point2::new(2.0000000000000004, 2.0000000298023224),
    ]);
}

#[test]
fn test_bulk_load_fuzz_18() {
    fuzz_test(vec![
        Point2::new(2.001953125, -2.0),
        Point2::new(2.0000000298023224, 2.0001220703125),
        Point2::new(2.0019569396972656, -1.9999971389770508),
        Point2::new(2.0000000298023224, 2.0),
        Point2::new(2.0000000298023224, -2.001953125),
        Point2::new(2.124999999709075, 3.000000029802323),
        Point2::new(2.0000000000001137, 2.0),
        Point2::new(2.001953125029104, -2.0004883110523224),
        Point2::new(2.001953125, 2.0),
        Point2::new(2.0, -2.0004883110523224),
    ]);
}

#[test]
fn test_bulk_load_fuzz_19() {
    fuzz_test(vec![
        Point2::new(-2.7049442424493675e-11, -2.7049442424493268e-11),
        Point2::new(-2.7049442424493268e-11, -2.704944239760038e-11),
        Point2::new(-2.704944242438945e-11, -2.704943553980988e-11),
        Point2::new(-2.7049442424493675e-11, -2.7049442424388623e-11),
        Point2::new(-2.7049442424493268e-11, -2.704944239760038e-11),
        Point2::new(-2.7049442424493675e-11, 0.0),
    ]);
}

#[test]
fn test_bulk_load_fuzz_20() {
    fuzz_test(vec![
        Point2::new(2.2526911184108794e-23f64, 2.252526342575774e-23),
        Point2::new(2.252526342575774e-23, 2.252526342575774e-23),
        Point2::new(2.252526342575774e-23, 2.252526342575774e-23),
        Point2::new(2.252526342575774e-23, 2.252526342575774e-23),
        Point2::new(2.252526342575774e-23, 2.252526342575774e-23),
        Point2::new(2.252526342575774e-23, 2.252526342575774e-23),
        Point2::new(0.11616869159773284, -2.7049442424493675e-11),
        Point2::new(-2.704944220765324e-11, -2.7049442438046202e-11),
        Point2::new(-2.7035231569778473e-11, -1.1276731182827932e-13),
        Point2::new(-2.704944242449326e-11, -2.7049442424493675e-11),
        Point2::new(-2.7049442424493675e-11, -2.7049442424493675e-11),
        Point2::new(-4.545365786677739e-10, 1.1648885083023547e-11),
        Point2::new(-2.4306747464459356e-11, -2.7049442424493675e-11),
        Point2::new(-2.704944242448623e-11, -2.7049442424493675e-11),
    ]);
}

#[test]
fn test_bulk_load_fuzz_21() {
    fuzz_test(vec![
        Point2::new(0.11617647291654166f64, -2.705000112790462e-11),
        Point2::new(-2.7049442384471368e-11f64, -2.6555608406219246e-11),
        Point2::new(-9.387412660936057e-12, -2.707786413392408e-11),
        Point2::new(-4.6189490530823523e-10, -2.7049442424337338e-11),
        Point2::new(-2.7049434889184558e-11, -2.696027628257575e-11),
        Point2::new(-2.7049379378136938e-11, -2.7049442384471368e-11),
        Point2::new(-2.7049442397865077e-11, -2.70494424244932e-11),
        Point2::new(-2.704944242258785e-11, -2.704944242279961e-11),
        Point2::new(-2.7049442424493675e-11, -2.7049442384314453e-11),
        Point2::new(-2.7049442424493675e-11, -2.7049442424493675e-11),
        Point2::new(-2.7049442424493675e-11, -2.6992599005632867e-11),
        Point2::new(-2.693575558677206e-11, -2.7049442424493675e-11),
        Point2::new(-2.7049442424493675e-11, -2.704943548559977e-11),
        Point2::new(-2.7049442424493662e-11, -2.7049442424493675e-11),
        Point2::new(-2.6811408873290566e-11, -2.7049442424493675e-11),
        Point2::new(-2.7049442424499465e-11, -2.7049442424493675e-11),
        Point2::new(-2.659469507360721e-11, -2.7049442424493675e-11),
        Point2::new(-2.704944242258785e-11, -2.7049442424493675e-11),
        Point2::new(-2.7049442424501947e-11, -2.7049442424493675e-11),
        Point2::new(-2.7049442424493882e-11, -2.7049442424493675e-11),
        Point2::new(-2.7049317524403405e-11, -2.7049442424493675e-11),
        Point2::new(-2.7045889710814875e-11, -2.7049442424493675e-11),
        Point2::new(-2.7049442424493672e-11, -2.7049442424493675e-11),
        Point2::new(-2.7049442424493675e-11, -2.704944241771741e-11),
        Point2::new(-2.7049441936602697e-11, -2.7049442424493675e-11),
        Point2::new(-2.7049442424493675e-11, -2.70494406897702e-11),
        Point2::new(-2.7049442424493675e-11, -2.704943548559977e-11),
        Point2::new(-2.704944242407016e-11, -2.7049442424493675e-11),
        Point2::new(-2.7049442424493675e-11, -2.704944242258785e-11),
        Point2::new(-2.7049435729968776e-11, -2.7049442424493675e-11),
        Point2::new(-2.7049442424493675e-11, -2.7049442424493672e-11),
        Point2::new(-2.7049442424467205e-11, -2.7049441936602697e-11),
        Point2::new(-2.7049442424493675e-11, -2.704944239865917e-11),
        Point2::new(-2.704944242258785e-11, -2.7049442424493675e-11),
        Point2::new(-2.7049442398980546e-11, -2.7049442395376918e-11),
        Point2::new(-1.600710678326356e-10, -2.7049442424493675e-11),
        Point2::new(-2.7049442424909747e-11, -2.7049442424493675e-11),
    ]);
}

#[test]
fn test_bulk_load_fuzz_22() {
    fuzz_test(vec![
        Point2::new(-0.0003849186150368648, 4.8578744028535106e-33),
        Point2::new(4.860884325263086e-33, 4.8578750597249806e-33),
        Point2::new(4.8578750597249806e-33, 4.8578750597249806e-33),
        Point2::new(4.8578750597249806e-33, 4.8579279569707704e-33),
        Point2::new(4.857875059725681e-33, 4.8578750597249806e-33),
        Point2::new(8.961197796880322e-14, 4.8578750597249806e-33),
        Point2::new(8.955648037009912e-14, 4.884958449567926e-33),
    ]);
}

#[test]
fn test_bulk_load_fuzz_23() {
    fuzz_test(vec![
        Point2::new(-2.1571074338520272e-11, -2.1132376894135366e-13),
        Point2::new(-2.7226523566846033e-40, 0.11608455882352732),
        Point2::new(-6.806630891709812e-41, 0.1238970588235294),
        Point2::new(-2.70478881122592e-11, -2.722652356683964e-40),
        Point2::new(-2.722652356831814e-40, 0.11608453241362017),
        Point2::new(-2.6601800500862655e-11, -1.127672851467415e-13),
        Point2::new(0.0, 0.0),
    ]);
}