]> gitweb.michael.orlitzky.com - spline3.git/blob - src/Tests/Cube.hs
Replace individual tetrahedron volume tests with combined ones.
[spline3.git] / src / Tests / Cube.hs
1 module Tests.Cube
2 where
3
4 import Prelude hiding (LT)
5
6 import Cardinal
7 import Comparisons
8 import Cube hiding (i, j, k)
9 import FunctionValues
10 import Misc (all_equal)
11 import Tests.FunctionValues ()
12 import Tetrahedron (b0, b1, b2, b3, c, fv,
13 v0, v1, v2, v3, volume)
14
15
16
17 -- Quickcheck tests.
18
19 -- | Since the grid size is necessarily positive, all tetrahedra
20 -- (which comprise cubes of positive volume) must have positive volume
21 -- as well.
22 prop_all_volumes_positive :: Cube -> Bool
23 prop_all_volumes_positive cube =
24 null nonpositive_volumes
25 where
26 ts = tetrahedra cube
27 volumes = map volume ts
28 nonpositive_volumes = filter (<= 0) volumes
29
30 -- | In fact, since all of the tetrahedra are identical, we should
31 -- already know their volumes. There's 24 tetrahedra to a cube, so
32 -- we'd expect the volume of each one to be (1/24)*h^3.
33 prop_all_volumes_exact :: Cube -> Bool
34 prop_all_volumes_exact cube =
35 and [volume t ~~= (1/24)*(delta^(3::Int)) | t <- tetrahedra cube]
36 where
37 delta = h cube
38
39 -- | All tetrahedron should have their v0 located at the center of the cube.
40 prop_v0_all_equal :: Cube -> Bool
41 prop_v0_all_equal cube = (v0 t0) == (v0 t1)
42 where
43 t0 = head (tetrahedra cube) -- Doesn't matter which two we choose.
44 t1 = head $ tail (tetrahedra cube)
45
46
47 -- | This pretty much repeats the prop_all_volumes_positive property,
48 -- but will let me know which tetrahedrons's vertices are disoriented.
49 prop_tetrahedron0_volumes_positive :: Cube -> Bool
50 prop_tetrahedron0_volumes_positive cube =
51 volume (tetrahedron0 cube) > 0
52
53 -- | This pretty much repeats the prop_all_volumes_positive property,
54 -- but will let me know which tetrahedrons's vertices are disoriented.
55 prop_tetrahedron1_volumes_positive :: Cube -> Bool
56 prop_tetrahedron1_volumes_positive cube =
57 volume (tetrahedron1 cube) > 0
58
59 -- | This pretty much repeats the prop_all_volumes_positive property,
60 -- but will let me know which tetrahedrons's vertices are disoriented.
61 prop_tetrahedron2_volumes_positive :: Cube -> Bool
62 prop_tetrahedron2_volumes_positive cube =
63 volume (tetrahedron2 cube) > 0
64
65 -- | This pretty much repeats the prop_all_volumes_positive property,
66 -- but will let me know which tetrahedrons's vertices are disoriented.
67 prop_tetrahedron3_volumes_positive :: Cube -> Bool
68 prop_tetrahedron3_volumes_positive cube =
69 volume (tetrahedron3 cube) > 0
70
71 -- | This pretty much repeats the prop_all_volumes_positive property,
72 -- but will let me know which tetrahedrons's vertices are disoriented.
73 prop_tetrahedron4_volumes_positive :: Cube -> Bool
74 prop_tetrahedron4_volumes_positive cube =
75 volume (tetrahedron4 cube) > 0
76
77 -- | This pretty much repeats the prop_all_volumes_positive property,
78 -- but will let me know which tetrahedrons's vertices are disoriented.
79 prop_tetrahedron5_volumes_positive :: Cube -> Bool
80 prop_tetrahedron5_volumes_positive cube =
81 volume (tetrahedron5 cube) > 0
82
83 -- | This pretty much repeats the prop_all_volumes_positive property,
84 -- but will let me know which tetrahedrons's vertices are disoriented.
85 prop_tetrahedron6_volumes_positive :: Cube -> Bool
86 prop_tetrahedron6_volumes_positive cube =
87 volume (tetrahedron6 cube) > 0
88
89 -- | This pretty much repeats the prop_all_volumes_positive property,
90 -- but will let me know which tetrahedrons's vertices are disoriented.
91 prop_tetrahedron7_volumes_positive :: Cube -> Bool
92 prop_tetrahedron7_volumes_positive cube =
93 volume (tetrahedron7 cube) > 0
94
95 -- | This pretty much repeats the prop_all_volumes_positive property,
96 -- but will let me know which tetrahedrons's vertices are disoriented.
97 prop_tetrahedron8_volumes_positive :: Cube -> Bool
98 prop_tetrahedron8_volumes_positive cube =
99 volume (tetrahedron8 cube) > 0
100
101 -- | This pretty much repeats the prop_all_volumes_positive property,
102 -- but will let me know which tetrahedrons's vertices are disoriented.
103 prop_tetrahedron9_volumes_positive :: Cube -> Bool
104 prop_tetrahedron9_volumes_positive cube =
105 volume (tetrahedron9 cube) > 0
106
107 -- | This pretty much repeats the prop_all_volumes_positive property,
108 -- but will let me know which tetrahedrons's vertices are disoriented.
109 prop_tetrahedron10_volumes_positive :: Cube -> Bool
110 prop_tetrahedron10_volumes_positive cube =
111 volume (tetrahedron10 cube) > 0
112
113 -- | This pretty much repeats the prop_all_volumes_positive property,
114 -- but will let me know which tetrahedrons's vertices are disoriented.
115 prop_tetrahedron11_volumes_positive :: Cube -> Bool
116 prop_tetrahedron11_volumes_positive cube =
117 volume (tetrahedron11 cube) > 0
118
119 -- | This pretty much repeats the prop_all_volumes_positive property,
120 -- but will let me know which tetrahedrons's vertices are disoriented.
121 prop_tetrahedron12_volumes_positive :: Cube -> Bool
122 prop_tetrahedron12_volumes_positive cube =
123 volume (tetrahedron12 cube) > 0
124
125 -- | This pretty much repeats the prop_all_volumes_positive property,
126 -- but will let me know which tetrahedrons's vertices are disoriented.
127 prop_tetrahedron13_volumes_positive :: Cube -> Bool
128 prop_tetrahedron13_volumes_positive cube =
129 volume (tetrahedron13 cube) > 0
130
131 -- | This pretty much repeats the prop_all_volumes_positive property,
132 -- but will let me know which tetrahedrons's vertices are disoriented.
133 prop_tetrahedron14_volumes_positive :: Cube -> Bool
134 prop_tetrahedron14_volumes_positive cube =
135 volume (tetrahedron14 cube) > 0
136
137 -- | This pretty much repeats the prop_all_volumes_positive property,
138 -- but will let me know which tetrahedrons's vertices are disoriented.
139 prop_tetrahedron15_volumes_positive :: Cube -> Bool
140 prop_tetrahedron15_volumes_positive cube =
141 volume (tetrahedron15 cube) > 0
142
143 -- | This pretty much repeats the prop_all_volumes_positive property,
144 -- but will let me know which tetrahedrons's vertices are disoriented.
145 prop_tetrahedron16_volumes_positive :: Cube -> Bool
146 prop_tetrahedron16_volumes_positive cube =
147 volume (tetrahedron16 cube) > 0
148
149 -- | This pretty much repeats the prop_all_volumes_positive property,
150 -- but will let me know which tetrahedrons's vertices are disoriented.
151 prop_tetrahedron17_volumes_positive :: Cube -> Bool
152 prop_tetrahedron17_volumes_positive cube =
153 volume (tetrahedron17 cube) > 0
154
155 -- | This pretty much repeats the prop_all_volumes_positive property,
156 -- but will let me know which tetrahedrons's vertices are disoriented.
157 prop_tetrahedron18_volumes_positive :: Cube -> Bool
158 prop_tetrahedron18_volumes_positive cube =
159 volume (tetrahedron18 cube) > 0
160
161 -- | This pretty much repeats the prop_all_volumes_positive property,
162 -- but will let me know which tetrahedrons's vertices are disoriented.
163 prop_tetrahedron19_volumes_positive :: Cube -> Bool
164 prop_tetrahedron19_volumes_positive cube =
165 volume (tetrahedron19 cube) > 0
166
167 -- | This pretty much repeats the prop_all_volumes_positive property,
168 -- but will let me know which tetrahedrons's vertices are disoriented.
169 prop_tetrahedron20_volumes_positive :: Cube -> Bool
170 prop_tetrahedron20_volumes_positive cube =
171 volume (tetrahedron20 cube) > 0
172
173 -- | This pretty much repeats the prop_all_volumes_positive property,
174 -- but will let me know which tetrahedrons's vertices are disoriented.
175 prop_tetrahedron21_volumes_positive :: Cube -> Bool
176 prop_tetrahedron21_volumes_positive cube =
177 volume (tetrahedron21 cube) > 0
178
179 -- | This pretty much repeats the prop_all_volumes_positive property,
180 -- but will let me know which tetrahedrons's vertices are disoriented.
181 prop_tetrahedron22_volumes_positive :: Cube -> Bool
182 prop_tetrahedron22_volumes_positive cube =
183 volume (tetrahedron22 cube) > 0
184
185 -- | This pretty much repeats the prop_all_volumes_positive property,
186 -- but will let me know which tetrahedrons's vertices are disoriented.
187 prop_tetrahedron23_volumes_positive :: Cube -> Bool
188 prop_tetrahedron23_volumes_positive cube =
189 volume (tetrahedron23 cube) > 0
190
191
192 -- | Given in Sorokina and Zeilfelder, p. 79, (2.6). Note that the
193 -- third and fourth indices of c-t1 have been switched. This is
194 -- because we store the triangles oriented such that their volume is
195 -- positive. If T and T-tilde share \<v0,v1,v2\> and v3,v3-tilde point
196 -- in opposite directions, one of them has to have negative volume!
197 prop_c0120_identity1 :: Cube -> Bool
198 prop_c0120_identity1 cube =
199 c t0 0 1 2 0 ~= (c t0 0 0 2 1 + c t3 0 0 1 2) / 2
200 where
201 t0 = tetrahedron0 cube
202 t3 = tetrahedron3 cube
203
204
205 -- | Given in Sorokina and Zeilfelder, p. 79, (2.6). Repeats
206 -- 'prop_c0120_identity1' with tetrahedrons 1 and 2.
207 prop_c0120_identity2 :: Cube -> Bool
208 prop_c0120_identity2 cube =
209 c t1 0 1 2 0 ~= (c t1 0 0 2 1 + c t0 0 0 1 2) / 2
210 where
211 t0 = tetrahedron0 cube
212 t1 = tetrahedron1 cube
213
214 -- | Given in Sorokina and Zeilfelder, p. 79, (2.6). Repeats
215 -- 'prop_c0120_identity1' with tetrahedrons 1 and 2.
216 prop_c0120_identity3 :: Cube -> Bool
217 prop_c0120_identity3 cube =
218 c t2 0 1 2 0 ~= (c t2 0 0 2 1 + c t1 0 0 1 2) / 2
219 where
220 t1 = tetrahedron1 cube
221 t2 = tetrahedron2 cube
222
223 -- | Given in Sorokina and Zeilfelder, p. 79, (2.6). Repeats
224 -- 'prop_c0120_identity1' with tetrahedrons 2 and 3.
225 prop_c0120_identity4 :: Cube -> Bool
226 prop_c0120_identity4 cube =
227 c t3 0 1 2 0 ~= (c t3 0 0 2 1 + c t2 0 0 1 2) / 2
228 where
229 t2 = tetrahedron2 cube
230 t3 = tetrahedron3 cube
231
232
233 -- | Given in Sorokina and Zeilfelder, p. 79, (2.6). Repeats
234 -- 'prop_c0120_identity1' with tetrahedrons 4 and 5.
235 prop_c0120_identity5 :: Cube -> Bool
236 prop_c0120_identity5 cube =
237 c t5 0 1 2 0 ~= (c t5 0 0 2 1 + c t4 0 0 1 2) / 2
238 where
239 t4 = tetrahedron4 cube
240 t5 = tetrahedron5 cube
241
242 -- -- | Given in Sorokina and Zeilfelder, p. 79, (2.6). Repeats
243 -- -- 'prop_c0120_identity1' with tetrahedrons 5 and 6.
244 prop_c0120_identity6 :: Cube -> Bool
245 prop_c0120_identity6 cube =
246 c t6 0 1 2 0 ~= (c t6 0 0 2 1 + c t5 0 0 1 2) / 2
247 where
248 t5 = tetrahedron5 cube
249 t6 = tetrahedron6 cube
250
251
252 -- -- | Given in Sorokina and Zeilfelder, p. 79, (2.6). Repeats
253 -- -- 'prop_c0120_identity1' with tetrahedrons 6 and 7.
254 prop_c0120_identity7 :: Cube -> Bool
255 prop_c0120_identity7 cube =
256 c t7 0 1 2 0 ~= (c t7 0 0 2 1 + c t6 0 0 1 2) / 2
257 where
258 t6 = tetrahedron6 cube
259 t7 = tetrahedron7 cube
260
261
262 -- | Given in Sorokina and Zeilfelder, p. 79, (2.6). See
263 -- 'prop_c0120_identity1'.
264 prop_c0210_identity1 :: Cube -> Bool
265 prop_c0210_identity1 cube =
266 c t0 0 2 1 0 ~= (c t0 0 1 1 1 + c t3 0 1 1 1) / 2
267 where
268 t0 = tetrahedron0 cube
269 t3 = tetrahedron3 cube
270
271
272 -- | Given in Sorokina and Zeilfelder, p. 79, (2.6). See
273 -- 'prop_c0120_identity1'.
274 prop_c0300_identity1 :: Cube -> Bool
275 prop_c0300_identity1 cube =
276 c t0 0 3 0 0 ~= (c t0 0 2 0 1 + c t3 0 2 1 0) / 2
277 where
278 t0 = tetrahedron0 cube
279 t3 = tetrahedron3 cube
280
281
282 -- | Given in Sorokina and Zeilfelder, p. 79, (2.6). See
283 -- 'prop_c0120_identity1'.
284 prop_c1110_identity :: Cube -> Bool
285 prop_c1110_identity cube =
286 c t0 1 1 1 0 ~= (c t0 1 0 1 1 + c t3 1 0 1 1) / 2
287 where
288 t0 = tetrahedron0 cube
289 t3 = tetrahedron3 cube
290
291
292 -- | Given in Sorokina and Zeilfelder, p. 79, (2.6). See
293 -- 'prop_c0120_identity1'.
294 prop_c1200_identity1 :: Cube -> Bool
295 prop_c1200_identity1 cube =
296 c t0 1 2 0 0 ~= (c t0 1 1 0 1 + c t3 1 1 1 0) / 2
297 where
298 t0 = tetrahedron0 cube
299 t3 = tetrahedron3 cube
300
301
302 -- | Given in Sorokina and Zeilfelder, p. 79, (2.6). See
303 -- 'prop_c0120_identity1'.
304 prop_c2100_identity1 :: Cube -> Bool
305 prop_c2100_identity1 cube =
306 c t0 2 1 0 0 ~= (c t0 2 0 0 1 + c t3 2 0 1 0) / 2
307 where
308 t0 = tetrahedron0 cube
309 t3 = tetrahedron3 cube
310
311
312
313 -- | Given in Sorokina and Zeilfelder, p. 79, (2.7). Note that the
314 -- third and fourth indices of c-t3 have been switched. This is
315 -- because we store the triangles oriented such that their volume is
316 -- positive. If T and T-tilde share \<v0,v1,v2\> and v3,v3-tilde
317 -- point in opposite directions, one of them has to have negative
318 -- volume!
319 prop_c0102_identity1 :: Cube -> Bool
320 prop_c0102_identity1 cube =
321 c t0 0 1 0 2 ~= (c t0 0 0 1 2 + c t1 0 0 2 1) / 2
322 where
323 t0 = tetrahedron0 cube
324 t1 = tetrahedron1 cube
325
326
327 -- | Given in Sorokina and Zeilfelder, p. 79, (2.7). See
328 -- 'prop_c0102_identity1'.
329 prop_c0201_identity1 :: Cube -> Bool
330 prop_c0201_identity1 cube =
331 c t0 0 2 0 1 ~= (c t0 0 1 1 1 + c t1 0 1 1 1) / 2
332 where
333 t0 = tetrahedron0 cube
334 t1 = tetrahedron1 cube
335
336
337 -- | Given in Sorokina and Zeilfelder, p. 79, (2.7). See
338 -- 'prop_c0102_identity1'.
339 prop_c0300_identity2 :: Cube -> Bool
340 prop_c0300_identity2 cube =
341 c t0 0 3 0 0 ~= (c t0 0 2 1 0 + c t1 0 2 0 1) / 2
342 where
343 t0 = tetrahedron0 cube
344 t1 = tetrahedron1 cube
345
346
347 -- | Given in Sorokina and Zeilfelder, p. 79, (2.7). See
348 -- 'prop_c0102_identity1'.
349 prop_c1101_identity :: Cube -> Bool
350 prop_c1101_identity cube =
351 c t0 1 1 0 1 ~= (c t0 1 0 1 1 + c t1 1 0 1 1) / 2
352 where
353 t0 = tetrahedron0 cube
354 t1 = tetrahedron1 cube
355
356
357 -- | Given in Sorokina and Zeilfelder, p. 79, (2.7). See
358 -- 'prop_c0102_identity1'.
359 prop_c1200_identity2 :: Cube -> Bool
360 prop_c1200_identity2 cube =
361 c t0 1 2 0 0 ~= (c t0 1 1 1 0 + c t1 1 1 0 1) / 2
362 where
363 t0 = tetrahedron0 cube
364 t1 = tetrahedron1 cube
365
366
367 -- | Given in Sorokina and Zeilfelder, p. 79, (2.7). See
368 -- 'prop_c0102_identity1'.
369 prop_c2100_identity2 :: Cube -> Bool
370 prop_c2100_identity2 cube =
371 c t0 2 1 0 0 ~= (c t0 2 0 1 0 + c t1 2 0 0 1) / 2
372 where
373 t0 = tetrahedron0 cube
374 t1 = tetrahedron1 cube
375
376
377 -- | Given in Sorokina and Zeilfelder, p. 79, (2.8). The third and
378 -- fourth indices of c-t6 have been switched. This is because we
379 -- store the triangles oriented such that their volume is
380 -- positive. If T and T-tilde share \<v0,v1,v2\> and v3,v3-tilde
381 -- point in opposite directions, one of them has to have negative
382 -- volume!
383 prop_c3000_identity :: Cube -> Bool
384 prop_c3000_identity cube =
385 c t0 3 0 0 0 ~= c t0 2 1 0 0 + c t6 2 1 0 0
386 - ((c t0 2 0 1 0 + c t0 2 0 0 1)/ 2)
387 where
388 t0 = tetrahedron0 cube
389 t6 = tetrahedron6 cube
390
391
392 -- | Given in Sorokina and Zeilfelder, p. 79, (2.8). See
393 -- 'prop_c3000_identity'.
394 prop_c2010_identity :: Cube -> Bool
395 prop_c2010_identity cube =
396 c t0 2 0 1 0 ~= c t0 1 1 1 0 + c t6 1 1 0 1
397 - ((c t0 1 0 2 0 + c t0 1 0 1 1)/ 2)
398 where
399 t0 = tetrahedron0 cube
400 t6 = tetrahedron6 cube
401
402
403 -- | Given in Sorokina and Zeilfelder, p. 79, (2.8). See
404 -- 'prop_c3000_identity'.
405 prop_c2001_identity :: Cube -> Bool
406 prop_c2001_identity cube =
407 c t0 2 0 0 1 ~= c t0 1 1 0 1 + c t6 1 1 1 0
408 - ((c t0 1 0 0 2 + c t0 1 0 1 1)/ 2)
409 where
410 t0 = tetrahedron0 cube
411 t6 = tetrahedron6 cube
412
413
414 -- | Given in Sorokina and Zeilfelder, p. 79, (2.8). See
415 -- 'prop_c3000_identity'.
416 prop_c1020_identity :: Cube -> Bool
417 prop_c1020_identity cube =
418 c t0 1 0 2 0 ~= c t0 0 1 2 0 + c t6 0 1 0 2
419 - ((c t0 0 0 3 0 + c t0 0 0 2 1)/ 2)
420 where
421 t0 = tetrahedron0 cube
422 t6 = tetrahedron6 cube
423
424
425 -- | Given in Sorokina and Zeilfelder, p. 79, (2.8). See
426 -- 'prop_c3000_identity'.
427 prop_c1002_identity :: Cube -> Bool
428 prop_c1002_identity cube =
429 c t0 1 0 0 2 ~= c t0 0 1 0 2 + c t6 0 1 2 0
430 - ((c t0 0 0 0 3 + c t0 0 0 1 2)/ 2)
431 where
432 t0 = tetrahedron0 cube
433 t6 = tetrahedron6 cube
434
435
436 -- | Given in Sorokina and Zeilfelder, p. 79, (2.8). See
437 -- 'prop_c3000_identity'.
438 prop_c1011_identity :: Cube -> Bool
439 prop_c1011_identity cube =
440 c t0 1 0 1 1 ~= c t0 0 1 1 1 + c t6 0 1 1 1 -
441 ((c t0 0 0 1 2 + c t0 0 0 2 1)/ 2)
442 where
443 t0 = tetrahedron0 cube
444 t6 = tetrahedron6 cube
445
446
447
448 -- | Given in Sorokina and Zeilfelder, p. 78.
449 prop_cijk1_identity :: Cube -> Bool
450 prop_cijk1_identity cube =
451 and [ c t0 i j k 1 ~=
452 (c t1 (i+1) j k 0) * ((b0 t0) (v3 t1)) +
453 (c t1 i (j+1) k 0) * ((b1 t0) (v3 t1)) +
454 (c t1 i j (k+1) 0) * ((b2 t0) (v3 t1)) +
455 (c t1 i j k 1) * ((b3 t0) (v3 t1)) | i <- [0..2],
456 j <- [0..2],
457 k <- [0..2],
458 i + j + k == 2]
459 where
460 t0 = tetrahedron0 cube
461 t1 = tetrahedron1 cube
462
463
464 -- | The function values at the interior should be the same for all tetrahedra.
465 prop_interior_values_all_identical :: Cube -> Bool
466 prop_interior_values_all_identical cube =
467 all_equal [i0, i1, i2, i3, i4, i5, i6, i7, i8,
468 i9, i10, i11, i12, i13, i14, i15, i16,
469 i17, i18, i19, i20, i21, i22, i23]
470 where
471 i0 = eval (Tetrahedron.fv (tetrahedron0 cube)) I
472 i1 = eval (Tetrahedron.fv (tetrahedron1 cube)) I
473 i2 = eval (Tetrahedron.fv (tetrahedron2 cube)) I
474 i3 = eval (Tetrahedron.fv (tetrahedron3 cube)) I
475 i4 = eval (Tetrahedron.fv (tetrahedron4 cube)) I
476 i5 = eval (Tetrahedron.fv (tetrahedron5 cube)) I
477 i6 = eval (Tetrahedron.fv (tetrahedron6 cube)) I
478 i7 = eval (Tetrahedron.fv (tetrahedron7 cube)) I
479 i8 = eval (Tetrahedron.fv (tetrahedron8 cube)) I
480 i9 = eval (Tetrahedron.fv (tetrahedron9 cube)) I
481 i10 = eval (Tetrahedron.fv (tetrahedron10 cube)) I
482 i11 = eval (Tetrahedron.fv (tetrahedron11 cube)) I
483 i12 = eval (Tetrahedron.fv (tetrahedron12 cube)) I
484 i13 = eval (Tetrahedron.fv (tetrahedron13 cube)) I
485 i14 = eval (Tetrahedron.fv (tetrahedron14 cube)) I
486 i15 = eval (Tetrahedron.fv (tetrahedron15 cube)) I
487 i16 = eval (Tetrahedron.fv (tetrahedron16 cube)) I
488 i17 = eval (Tetrahedron.fv (tetrahedron17 cube)) I
489 i18 = eval (Tetrahedron.fv (tetrahedron18 cube)) I
490 i19 = eval (Tetrahedron.fv (tetrahedron19 cube)) I
491 i20 = eval (Tetrahedron.fv (tetrahedron20 cube)) I
492 i21 = eval (Tetrahedron.fv (tetrahedron21 cube)) I
493 i22 = eval (Tetrahedron.fv (tetrahedron22 cube)) I
494 i23 = eval (Tetrahedron.fv (tetrahedron23 cube)) I
495
496
497 -- | We know what (c t6 2 1 0 0) should be from Sorokina and Zeilfelder, p. 87.
498 -- This test checks the rotation works as expected.
499 prop_c_tilde_2100_rotation_correct :: Cube -> Bool
500 prop_c_tilde_2100_rotation_correct cube =
501 expr1 == expr2
502 where
503 t0 = tetrahedron0 cube
504 t6 = tetrahedron6 cube
505
506 -- What gets computed for c2100 of t6.
507 expr1 = eval (Tetrahedron.fv t6) $
508 (3/8)*I +
509 (1/12)*(T + R + L + D) +
510 (1/64)*(FT + FR + FL + FD) +
511 (7/48)*F +
512 (1/48)*B +
513 (1/96)*(RT + LD + LT + RD) +
514 (1/192)*(BT + BR + BL + BD)
515
516 -- What should be computed for c2100 of t6.
517 expr2 = eval (Tetrahedron.fv t0) $
518 (3/8)*I +
519 (1/12)*(F + R + L + B) +
520 (1/64)*(FT + RT + LT + BT) +
521 (7/48)*T +
522 (1/48)*D +
523 (1/96)*(FR + FL + BR + BL) +
524 (1/192)*(FD + RD + LD + BD)
525
526
527 -- | We know what (c t6 2 1 0 0) should be from Sorokina and Zeilfelder, p. 87.
528 -- This test checks the actual value based on the FunctionValues of the cube.
529 prop_c_tilde_2100_correct :: Cube -> Bool
530 prop_c_tilde_2100_correct cube =
531 c t6 2 1 0 0 == (3/8)*int
532 + (1/12)*(f + r + l + b)
533 + (1/64)*(ft + rt + lt + bt)
534 + (7/48)*t + (1/48)*d + (1/96)*(fr + fl + br + bl)
535 + (1/192)*(fd + rd + ld + bd)
536 where
537 t0 = tetrahedron0 cube
538 t6 = tetrahedron6 cube
539 fvs = Tetrahedron.fv t0
540 int = interior fvs
541 f = front fvs
542 r = right fvs
543 l = left fvs
544 b = back fvs
545 ft = front_top fvs
546 rt = right_top fvs
547 lt = left_top fvs
548 bt = back_top fvs
549 t = top fvs
550 d = down fvs
551 fr = front_right fvs
552 fl = front_left fvs
553 br = back_right fvs
554 bl = back_left fvs
555 fd = front_down fvs
556 rd = right_down fvs
557 ld = left_down fvs
558 bd = back_down fvs
559
560 -- Tests to check that the correct edges are incidental.
561 prop_t0_shares_edge_with_t1 :: Cube -> Bool
562 prop_t0_shares_edge_with_t1 cube =
563 (v1 t0) == (v1 t1) && (v3 t0) == (v2 t1)
564 where
565 t0 = tetrahedron0 cube
566 t1 = tetrahedron1 cube
567
568 prop_t0_shares_edge_with_t3 :: Cube -> Bool
569 prop_t0_shares_edge_with_t3 cube =
570 (v1 t0) == (v1 t3) && (v2 t0) == (v3 t3)
571 where
572 t0 = tetrahedron0 cube
573 t3 = tetrahedron3 cube
574
575 prop_t0_shares_edge_with_t6 :: Cube -> Bool
576 prop_t0_shares_edge_with_t6 cube =
577 (v2 t0) == (v3 t6) && (v3 t0) == (v2 t6)
578 where
579 t0 = tetrahedron0 cube
580 t6 = tetrahedron6 cube
581
582 prop_t1_shares_edge_with_t2 :: Cube -> Bool
583 prop_t1_shares_edge_with_t2 cube =
584 (v1 t1) == (v1 t2) && (v3 t1) == (v2 t2)
585 where
586 t1 = tetrahedron1 cube
587 t2 = tetrahedron2 cube
588
589 prop_t1_shares_edge_with_t19 :: Cube -> Bool
590 prop_t1_shares_edge_with_t19 cube =
591 (v2 t1) == (v3 t19) && (v3 t1) == (v2 t19)
592 where
593 t1 = tetrahedron1 cube
594 t19 = tetrahedron19 cube
595
596 prop_t2_shares_edge_with_t3 :: Cube -> Bool
597 prop_t2_shares_edge_with_t3 cube =
598 (v1 t1) == (v1 t2) && (v3 t1) == (v2 t2)
599 where
600 t1 = tetrahedron1 cube
601 t2 = tetrahedron2 cube
602
603 prop_t2_shares_edge_with_t12 :: Cube -> Bool
604 prop_t2_shares_edge_with_t12 cube =
605 (v2 t2) == (v3 t12) && (v3 t2) == (v2 t12)
606 where
607 t2 = tetrahedron2 cube
608 t12 = tetrahedron12 cube
609
610 prop_t3_shares_edge_with_t21 :: Cube -> Bool
611 prop_t3_shares_edge_with_t21 cube =
612 (v2 t3) == (v3 t21) && (v3 t3) == (v2 t21)
613 where
614 t3 = tetrahedron3 cube
615 t21 = tetrahedron21 cube
616
617 prop_t4_shares_edge_with_t5 :: Cube -> Bool
618 prop_t4_shares_edge_with_t5 cube =
619 (v1 t4) == (v1 t5) && (v3 t4) == (v2 t5)
620 where
621 t4 = tetrahedron4 cube
622 t5 = tetrahedron5 cube
623
624 prop_t4_shares_edge_with_t7 :: Cube -> Bool
625 prop_t4_shares_edge_with_t7 cube =
626 (v1 t4) == (v1 t7) && (v2 t4) == (v3 t7)
627 where
628 t4 = tetrahedron4 cube
629 t7 = tetrahedron7 cube
630
631 prop_t4_shares_edge_with_t10 :: Cube -> Bool
632 prop_t4_shares_edge_with_t10 cube =
633 (v2 t4) == (v3 t10) && (v3 t4) == (v2 t10)
634 where
635 t4 = tetrahedron4 cube
636 t10 = tetrahedron10 cube
637
638 prop_t5_shares_edge_with_t6 :: Cube -> Bool
639 prop_t5_shares_edge_with_t6 cube =
640 (v1 t5) == (v1 t6) && (v3 t5) == (v2 t6)
641 where
642 t5 = tetrahedron5 cube
643 t6 = tetrahedron6 cube
644
645 prop_t5_shares_edge_with_t16 :: Cube -> Bool
646 prop_t5_shares_edge_with_t16 cube =
647 (v2 t5) == (v3 t16) && (v3 t5) == (v2 t16)
648 where
649 t5 = tetrahedron5 cube
650 t16 = tetrahedron16 cube
651
652 prop_t6_shares_edge_with_t7 :: Cube -> Bool
653 prop_t6_shares_edge_with_t7 cube =
654 (v1 t6) == (v1 t7) && (v3 t6) == (v2 t7)
655 where
656 t6 = tetrahedron6 cube
657 t7 = tetrahedron7 cube
658
659 prop_t7_shares_edge_with_t20 :: Cube -> Bool
660 prop_t7_shares_edge_with_t20 cube =
661 (v2 t7) == (v3 t20) && (v2 t7) == (v3 t20)
662 where
663 t7 = tetrahedron7 cube
664 t20 = tetrahedron20 cube