]> gitweb.michael.orlitzky.com - spline3.git/blob - src/Cube.hs
552b141e2a2f597ce7669baa9e181259e2979a96
[spline3.git] / src / Cube.hs
1 -- The "tetrahedron" function pattern matches on the integers zero
2 -- through twenty-three, but doesn't handle the "otherwise" case, for
3 -- performance reasons.
4 {-# OPTIONS_GHC -Wno-incomplete-patterns #-}
5
6 module Cube (
7 Cube(..),
8 cube_properties,
9 find_containing_tetrahedron,
10 tetrahedra,
11 tetrahedron )
12 where
13
14 import Data.Maybe ( fromJust )
15 import qualified Data.Vector as V (
16 Vector,
17 findIndex,
18 map,
19 minimum,
20 singleton,
21 snoc,
22 unsafeIndex)
23 import Prelude hiding ( LT )
24 import Test.Tasty ( TestTree, testGroup )
25 import Test.Tasty.QuickCheck (
26 Arbitrary( arbitrary ),
27 Gen,
28 Positive( Positive ),
29 choose,
30 testProperty )
31 import Cardinal (
32 Cardinal(F, B, L, R, D, T, FL, FR, FD, FT,
33 BL, BR, BD, BT, LD, LT, RD, RT, I),
34 ccwx,
35 ccwy,
36 ccwz,
37 cwx,
38 cwy,
39 cwz )
40 import Comparisons ( (~=), (~~=) )
41 import qualified Face ( Face(..), center )
42 import FunctionValues ( FunctionValues, eval, rotate )
43 import Misc ( all_equal, disjoint )
44 import Point ( Point( Point ), dot )
45 import Tetrahedron (
46 Tetrahedron(Tetrahedron, function_values, v0, v1, v2, v3),
47 barycenter,
48 c,
49 volume )
50
51 data Cube = Cube { i :: !Int,
52 j :: !Int,
53 k :: !Int,
54 fv :: !FunctionValues,
55 tetrahedra_volume :: !Double }
56 deriving (Eq)
57
58
59 instance Arbitrary Cube where
60 arbitrary = do
61 i' <- choose (coordmin, coordmax)
62 j' <- choose (coordmin, coordmax)
63 k' <- choose (coordmin, coordmax)
64 fv' <- arbitrary :: Gen FunctionValues
65 (Positive tet_vol) <- arbitrary :: Gen (Positive Double)
66 return (Cube i' j' k' fv' tet_vol)
67 where
68 -- The idea here is that, when cubed in the volume formula,
69 -- these numbers don't overflow 64 bits. This number is not
70 -- magic in any other sense than that it does not cause test
71 -- failures, while 2^23 does.
72 coordmax = 4194304 :: Int -- 2^22
73 coordmin = -coordmax
74
75
76 instance Show Cube where
77 show cube =
78 "Cube_" ++ subscript ++ "\n" ++
79 " Center: " ++ (show (center cube)) ++ "\n" ++
80 " xmin: " ++ (show (xmin cube)) ++ "\n" ++
81 " xmax: " ++ (show (xmax cube)) ++ "\n" ++
82 " ymin: " ++ (show (ymin cube)) ++ "\n" ++
83 " ymax: " ++ (show (ymax cube)) ++ "\n" ++
84 " zmin: " ++ (show (zmin cube)) ++ "\n" ++
85 " zmax: " ++ (show (zmax cube)) ++ "\n"
86 where
87 subscript =
88 (show (i cube)) ++ "," ++ (show (j cube)) ++ "," ++ (show (k cube))
89
90
91 -- | The left-side boundary of the cube. See Sorokina and Zeilfelder,
92 -- p. 76.
93 xmin :: Cube -> Double
94 xmin cube = (i' - 1/2)
95 where
96 i' = fromIntegral (i cube) :: Double
97
98 -- | The right-side boundary of the cube. See Sorokina and Zeilfelder,
99 -- p. 76.
100 xmax :: Cube -> Double
101 xmax cube = (i' + 1/2)
102 where
103 i' = fromIntegral (i cube) :: Double
104
105 -- | The front boundary of the cube. See Sorokina and Zeilfelder,
106 -- p. 76.
107 ymin :: Cube -> Double
108 ymin cube = (j' - 1/2)
109 where
110 j' = fromIntegral (j cube) :: Double
111
112 -- | The back boundary of the cube. See Sorokina and Zeilfelder,
113 -- p. 76.
114 ymax :: Cube -> Double
115 ymax cube = (j' + 1/2)
116 where
117 j' = fromIntegral (j cube) :: Double
118
119 -- | The bottom boundary of the cube. See Sorokina and Zeilfelder,
120 -- p. 76.
121 zmin :: Cube -> Double
122 zmin cube = (k' - 1/2)
123 where
124 k' = fromIntegral (k cube) :: Double
125
126 -- | The top boundary of the cube. See Sorokina and Zeilfelder,
127 -- p. 76.
128 zmax :: Cube -> Double
129 zmax cube = (k' + 1/2)
130 where
131 k' = fromIntegral (k cube) :: Double
132
133
134 -- | The center of Cube_ijk coincides with v_ijk at
135 -- (i, j, k). See Sorokina and Zeilfelder, p. 76.
136 center :: Cube -> Point
137 center cube =
138 Point x y z
139 where
140 x = fromIntegral (i cube) :: Double
141 y = fromIntegral (j cube) :: Double
142 z = fromIntegral (k cube) :: Double
143
144
145 -- Face stuff.
146
147 -- | The top (in the direction of z) face of the cube.
148 top_face :: Cube -> Face.Face
149 top_face cube = Face.Face v0' v1' v2' v3'
150 where
151 delta = (1/2) :: Double
152 cc = center cube
153 v0' = cc + ( Point delta (-delta) delta )
154 v1' = cc + ( Point delta delta delta )
155 v2' = cc + ( Point (-delta) delta delta )
156 v3' = cc + ( Point (-delta) (-delta) delta )
157
158
159
160 -- | The back (in the direction of x) face of the cube.
161 back_face :: Cube -> Face.Face
162 back_face cube = Face.Face v0' v1' v2' v3'
163 where
164 delta = (1/2) :: Double
165 cc = center cube
166 v0' = cc + ( Point delta (-delta) (-delta) )
167 v1' = cc + ( Point delta delta (-delta) )
168 v2' = cc + ( Point delta delta delta )
169 v3' = cc + ( Point delta (-delta) delta )
170
171
172 -- The bottom face (in the direction of -z) of the cube.
173 down_face :: Cube -> Face.Face
174 down_face cube = Face.Face v0' v1' v2' v3'
175 where
176 delta = (1/2) :: Double
177 cc = center cube
178 v0' = cc + ( Point (-delta) (-delta) (-delta) )
179 v1' = cc + ( Point (-delta) delta (-delta) )
180 v2' = cc + ( Point delta delta (-delta) )
181 v3' = cc + ( Point delta (-delta) (-delta) )
182
183
184
185 -- | The front (in the direction of -x) face of the cube.
186 front_face :: Cube -> Face.Face
187 front_face cube = Face.Face v0' v1' v2' v3'
188 where
189 delta = (1/2) :: Double
190 cc = center cube
191 v0' = cc + ( Point (-delta) (-delta) delta )
192 v1' = cc + ( Point (-delta) delta delta )
193 v2' = cc + ( Point (-delta) delta (-delta) )
194 v3' = cc + ( Point (-delta) (-delta) (-delta) )
195
196 -- | The left (in the direction of -y) face of the cube.
197 left_face :: Cube -> Face.Face
198 left_face cube = Face.Face v0' v1' v2' v3'
199 where
200 delta = (1/2) :: Double
201 cc = center cube
202 v0' = cc + ( Point delta (-delta) delta )
203 v1' = cc + ( Point (-delta) (-delta) delta )
204 v2' = cc + ( Point (-delta) (-delta) (-delta) )
205 v3' = cc + ( Point delta (-delta) (-delta) )
206
207
208 -- | The right (in the direction of y) face of the cube.
209 right_face :: Cube -> Face.Face
210 right_face cube = Face.Face v0' v1' v2' v3'
211 where
212 delta = (1/2) :: Double
213 cc = center cube
214 v0' = cc + ( Point (-delta) delta delta)
215 v1' = cc + ( Point delta delta delta )
216 v2' = cc + ( Point delta delta (-delta) )
217 v3' = cc + ( Point (-delta) delta (-delta) )
218
219
220 tetrahedron :: Cube -> Int -> Tetrahedron
221
222 tetrahedron cube 0 =
223 Tetrahedron (fv cube) v0' v1' v2' v3' vol
224 where
225 v0' = center cube
226 ff = front_face cube
227 v1' = Face.center ff
228 v2' = Face.v0 ff
229 v3' = Face.v1 ff
230 vol = tetrahedra_volume cube
231
232 tetrahedron cube 1 =
233 Tetrahedron fv' v0' v1' v2' v3' vol
234 where
235 v0' = center cube
236 ff = front_face cube
237 v1' = Face.center ff
238 v2' = Face.v1 ff
239 v3' = Face.v2 ff
240 fv' = rotate ccwx (fv cube)
241 vol = tetrahedra_volume cube
242
243 tetrahedron cube 2 =
244 Tetrahedron fv' v0' v1' v2' v3' vol
245 where
246 v0' = center cube
247 ff = front_face cube
248 v1' = Face.center ff
249 v2' = Face.v2 ff
250 v3' = Face.v3 ff
251 fv' = rotate ccwx $ rotate ccwx $ fv cube
252 vol = tetrahedra_volume cube
253
254 tetrahedron cube 3 =
255 Tetrahedron fv' v0' v1' v2' v3' vol
256 where
257 v0' = center cube
258 ff = front_face cube
259 v1' = Face.center ff
260 v2' = Face.v3 ff
261 v3' = Face.v0 ff
262 fv' = rotate cwx (fv cube)
263 vol = tetrahedra_volume cube
264
265 tetrahedron cube 4 =
266 Tetrahedron fv' v0' v1' v2' v3' vol
267 where
268 v0' = center cube
269 tf = top_face cube
270 v1' = Face.center tf
271 v2' = Face.v0 tf
272 v3' = Face.v1 tf
273 fv' = rotate cwy (fv cube)
274 vol = tetrahedra_volume cube
275
276 tetrahedron cube 5 =
277 Tetrahedron fv' v0' v1' v2' v3' vol
278 where
279 v0' = center cube
280 tf = top_face cube
281 v1' = Face.center tf
282 v2' = Face.v1 tf
283 v3' = Face.v2 tf
284 fv' = rotate cwy $ rotate cwz $ fv cube
285 vol = tetrahedra_volume cube
286
287 tetrahedron cube 6 =
288 Tetrahedron fv' v0' v1' v2' v3' vol
289 where
290 v0' = center cube
291 tf = top_face cube
292 v1' = Face.center tf
293 v2' = Face.v2 tf
294 v3' = Face.v3 tf
295 fv' = rotate cwy $ rotate cwz
296 $ rotate cwz
297 $ fv cube
298 vol = tetrahedra_volume cube
299
300 tetrahedron cube 7 =
301 Tetrahedron fv' v0' v1' v2' v3' vol
302 where
303 v0' = center cube
304 tf = top_face cube
305 v1' = Face.center tf
306 v2' = Face.v3 tf
307 v3' = Face.v0 tf
308 fv' = rotate cwy $ rotate ccwz $ fv cube
309 vol = tetrahedra_volume cube
310
311 tetrahedron cube 8 =
312 Tetrahedron fv' v0' v1' v2' v3' vol
313 where
314 v0' = center cube
315 bf = back_face cube
316 v1' = Face.center bf
317 v2' = Face.v0 bf
318 v3' = Face.v1 bf
319 fv' = rotate cwy $ rotate cwy $ fv cube
320 vol = tetrahedra_volume cube
321
322 tetrahedron cube 9 =
323 Tetrahedron fv' v0' v1' v2' v3' vol
324 where
325 v0' = center cube
326 bf = back_face cube
327 v1' = Face.center bf
328 v2' = Face.v1 bf
329 v3' = Face.v2 bf
330 fv' = rotate cwy $ rotate cwy
331 $ rotate cwx
332 $ fv cube
333 vol = tetrahedra_volume cube
334
335 tetrahedron cube 10 =
336 Tetrahedron fv' v0' v1' v2' v3' vol
337 where
338 v0' = center cube
339 bf = back_face cube
340 v1' = Face.center bf
341 v2' = Face.v2 bf
342 v3' = Face.v3 bf
343 fv' = rotate cwy $ rotate cwy
344 $ rotate cwx
345 $ rotate cwx
346 $ fv cube
347
348 vol = tetrahedra_volume cube
349
350 tetrahedron cube 11 =
351 Tetrahedron fv' v0' v1' v2' v3' vol
352 where
353 v0' = center cube
354 bf = back_face cube
355 v1' = Face.center bf
356 v2' = Face.v3 bf
357 v3' = Face.v0 bf
358 fv' = rotate cwy $ rotate cwy
359 $ rotate ccwx
360 $ fv cube
361 vol = tetrahedra_volume cube
362
363 tetrahedron cube 12 =
364 Tetrahedron fv' v0' v1' v2' v3' vol
365 where
366 v0' = center cube
367 df = down_face cube
368 v1' = Face.center df
369 v2' = Face.v0 df
370 v3' = Face.v1 df
371 fv' = rotate ccwy $ fv cube
372 vol = tetrahedra_volume cube
373
374 tetrahedron cube 13 =
375 Tetrahedron fv' v0' v1' v2' v3' vol
376 where
377 v0' = center cube
378 df = down_face cube
379 v1' = Face.center df
380 v2' = Face.v1 df
381 v3' = Face.v2 df
382 fv' = rotate ccwy $ rotate ccwz $ fv cube
383 vol = tetrahedra_volume cube
384
385 tetrahedron cube 14 =
386 Tetrahedron fv' v0' v1' v2' v3' vol
387 where
388 v0' = center cube
389 df = down_face cube
390 v1' = Face.center df
391 v2' = Face.v2 df
392 v3' = Face.v3 df
393 fv' = rotate ccwy $ rotate ccwz
394 $ rotate ccwz
395 $ fv cube
396 vol = tetrahedra_volume cube
397
398 tetrahedron cube 15 =
399 Tetrahedron fv' v0' v1' v2' v3' vol
400 where
401 v0' = center cube
402 df = down_face cube
403 v1' = Face.center df
404 v2' = Face.v3 df
405 v3' = Face.v0 df
406 fv' = rotate ccwy $ rotate cwz $ fv cube
407 vol = tetrahedra_volume cube
408
409 tetrahedron cube 16 =
410 Tetrahedron fv' v0' v1' v2' v3' vol
411 where
412 v0' = center cube
413 rf = right_face cube
414 v1' = Face.center rf
415 v2' = Face.v0 rf
416 v3' = Face.v1 rf
417 fv' = rotate ccwz $ fv cube
418 vol = tetrahedra_volume cube
419
420 tetrahedron cube 17 =
421 Tetrahedron fv' v0' v1' v2' v3' vol
422 where
423 v0' = center cube
424 rf = right_face cube
425 v1' = Face.center rf
426 v2' = Face.v1 rf
427 v3' = Face.v2 rf
428 fv' = rotate ccwz $ rotate cwy $ fv cube
429 vol = tetrahedra_volume cube
430
431 tetrahedron cube 18 =
432 Tetrahedron fv' v0' v1' v2' v3' vol
433 where
434 v0' = center cube
435 rf = right_face cube
436 v1' = Face.center rf
437 v2' = Face.v2 rf
438 v3' = Face.v3 rf
439 fv' = rotate ccwz $ rotate cwy
440 $ rotate cwy
441 $ fv cube
442 vol = tetrahedra_volume cube
443
444 tetrahedron cube 19 =
445 Tetrahedron fv' v0' v1' v2' v3' vol
446 where
447 v0' = center cube
448 rf = right_face cube
449 v1' = Face.center rf
450 v2' = Face.v3 rf
451 v3' = Face.v0 rf
452 fv' = rotate ccwz $ rotate ccwy
453 $ fv cube
454 vol = tetrahedra_volume cube
455
456 tetrahedron cube 20 =
457 Tetrahedron fv' v0' v1' v2' v3' vol
458 where
459 v0' = center cube
460 lf = left_face cube
461 v1' = Face.center lf
462 v2' = Face.v0 lf
463 v3' = Face.v1 lf
464 fv' = rotate cwz $ fv cube
465 vol = tetrahedra_volume cube
466
467 tetrahedron cube 21 =
468 Tetrahedron fv' v0' v1' v2' v3' vol
469 where
470 v0' = center cube
471 lf = left_face cube
472 v1' = Face.center lf
473 v2' = Face.v1 lf
474 v3' = Face.v2 lf
475 fv' = rotate cwz $ rotate ccwy $ fv cube
476 vol = tetrahedra_volume cube
477
478 tetrahedron cube 22 =
479 Tetrahedron fv' v0' v1' v2' v3' vol
480 where
481 v0' = center cube
482 lf = left_face cube
483 v1' = Face.center lf
484 v2' = Face.v2 lf
485 v3' = Face.v3 lf
486 fv' = rotate cwz $ rotate ccwy
487 $ rotate ccwy
488 $ fv cube
489 vol = tetrahedra_volume cube
490
491 tetrahedron cube 23 =
492 Tetrahedron fv' v0' v1' v2' v3' vol
493 where
494 v0' = center cube
495 lf = left_face cube
496 v1' = Face.center lf
497 v2' = Face.v3 lf
498 v3' = Face.v0 lf
499 fv' = rotate cwz $ rotate cwy
500 $ fv cube
501 vol = tetrahedra_volume cube
502
503
504 -- Only used in tests, so we don't need the added speed
505 -- of Data.Vector.
506 tetrahedra :: Cube -> [Tetrahedron]
507 tetrahedra cube = [ tetrahedron cube n | n <- [0..23] ]
508
509 front_left_top_tetrahedra :: Cube -> V.Vector Tetrahedron
510 front_left_top_tetrahedra cube =
511 V.singleton (tetrahedron cube 0) `V.snoc`
512 (tetrahedron cube 3) `V.snoc`
513 (tetrahedron cube 6) `V.snoc`
514 (tetrahedron cube 7) `V.snoc`
515 (tetrahedron cube 20) `V.snoc`
516 (tetrahedron cube 21)
517
518 front_left_down_tetrahedra :: Cube -> V.Vector Tetrahedron
519 front_left_down_tetrahedra cube =
520 V.singleton (tetrahedron cube 0) `V.snoc`
521 (tetrahedron cube 2) `V.snoc`
522 (tetrahedron cube 3) `V.snoc`
523 (tetrahedron cube 12) `V.snoc`
524 (tetrahedron cube 15) `V.snoc`
525 (tetrahedron cube 21)
526
527 front_right_top_tetrahedra :: Cube -> V.Vector Tetrahedron
528 front_right_top_tetrahedra cube =
529 V.singleton (tetrahedron cube 0) `V.snoc`
530 (tetrahedron cube 1) `V.snoc`
531 (tetrahedron cube 5) `V.snoc`
532 (tetrahedron cube 6) `V.snoc`
533 (tetrahedron cube 16) `V.snoc`
534 (tetrahedron cube 19)
535
536 front_right_down_tetrahedra :: Cube -> V.Vector Tetrahedron
537 front_right_down_tetrahedra cube =
538 V.singleton (tetrahedron cube 1) `V.snoc`
539 (tetrahedron cube 2) `V.snoc`
540 (tetrahedron cube 12) `V.snoc`
541 (tetrahedron cube 13) `V.snoc`
542 (tetrahedron cube 18) `V.snoc`
543 (tetrahedron cube 19)
544
545 back_left_top_tetrahedra :: Cube -> V.Vector Tetrahedron
546 back_left_top_tetrahedra cube =
547 V.singleton (tetrahedron cube 0) `V.snoc`
548 (tetrahedron cube 3) `V.snoc`
549 (tetrahedron cube 6) `V.snoc`
550 (tetrahedron cube 7) `V.snoc`
551 (tetrahedron cube 20) `V.snoc`
552 (tetrahedron cube 21)
553
554 back_left_down_tetrahedra :: Cube -> V.Vector Tetrahedron
555 back_left_down_tetrahedra cube =
556 V.singleton (tetrahedron cube 8) `V.snoc`
557 (tetrahedron cube 11) `V.snoc`
558 (tetrahedron cube 14) `V.snoc`
559 (tetrahedron cube 15) `V.snoc`
560 (tetrahedron cube 22) `V.snoc`
561 (tetrahedron cube 23)
562
563 back_right_top_tetrahedra :: Cube -> V.Vector Tetrahedron
564 back_right_top_tetrahedra cube =
565 V.singleton (tetrahedron cube 4) `V.snoc`
566 (tetrahedron cube 5) `V.snoc`
567 (tetrahedron cube 9) `V.snoc`
568 (tetrahedron cube 10) `V.snoc`
569 (tetrahedron cube 16) `V.snoc`
570 (tetrahedron cube 17)
571
572 back_right_down_tetrahedra :: Cube -> V.Vector Tetrahedron
573 back_right_down_tetrahedra cube =
574 V.singleton (tetrahedron cube 8) `V.snoc`
575 (tetrahedron cube 9) `V.snoc`
576 (tetrahedron cube 13) `V.snoc`
577 (tetrahedron cube 14) `V.snoc`
578 (tetrahedron cube 17) `V.snoc`
579 (tetrahedron cube 18)
580
581 in_top_half :: Cube -> Point -> Bool
582 in_top_half cube (Point _ _ z) =
583 distance_from_top <= distance_from_bottom
584 where
585 distance_from_top = abs $ (zmax cube) - z
586 distance_from_bottom = abs $ (zmin cube) - z
587
588 in_front_half :: Cube -> Point -> Bool
589 in_front_half cube (Point x _ _) =
590 distance_from_front <= distance_from_back
591 where
592 distance_from_front = abs $ (xmin cube) - x
593 distance_from_back = abs $ (xmax cube) - x
594
595
596 in_left_half :: Cube -> Point -> Bool
597 in_left_half cube (Point _ y _) =
598 distance_from_left <= distance_from_right
599 where
600 distance_from_left = abs $ (ymin cube) - y
601 distance_from_right = abs $ (ymax cube) - y
602
603
604 -- | Takes a 'Cube', and returns the Tetrahedra belonging to it that
605 -- contain the given 'Point'. This should be faster than checking
606 -- every tetrahedron individually, since we determine which half
607 -- (hemisphere?) of the cube the point lies in three times: once in
608 -- each dimension. This allows us to eliminate non-candidates
609 -- quickly.
610 --
611 -- This can throw an exception, but the use of 'head' might
612 -- save us some unnecessary computations.
613 --
614 {-# INLINE find_containing_tetrahedron #-}
615 find_containing_tetrahedron :: Cube -> Point -> Tetrahedron
616 find_containing_tetrahedron cube p =
617 candidates `V.unsafeIndex` (fromJust lucky_idx)
618 where
619 front_half = in_front_half cube p
620 top_half = in_top_half cube p
621 left_half = in_left_half cube p
622
623 candidates :: V.Vector Tetrahedron
624 candidates
625 | front_half =
626 if left_half then
627 if top_half then
628 front_left_top_tetrahedra cube
629 else
630 front_left_down_tetrahedra cube
631 else
632 if top_half then
633 front_right_top_tetrahedra cube
634 else
635 front_right_down_tetrahedra cube
636
637 | otherwise = -- back half
638 if left_half then
639 if top_half then
640 back_left_top_tetrahedra cube
641 else
642 back_left_down_tetrahedra cube
643 else
644 if top_half then
645 back_right_top_tetrahedra cube
646 else
647 back_right_down_tetrahedra cube
648
649 -- Use the dot product instead of Euclidean distance here to save
650 -- a sqrt(). So, "distances" below really means "distances
651 -- squared."
652 distances :: V.Vector Double
653 distances = V.map ((dot p) . barycenter) candidates
654
655 shortest_distance :: Double
656 shortest_distance = V.minimum distances
657
658 -- Compute the index of the tetrahedron with the center closest to
659 -- p. This is a bad algorithm, but don't change it! If you make it
660 -- smarter by finding the index of shortest_distance in distances
661 -- (this should give the same answer and avoids recomputing the
662 -- dot product), the program gets slower. Seriously!
663 lucky_idx :: Maybe Int
664 lucky_idx = V.findIndex
665 (\t -> (barycenter t) `dot` p == shortest_distance)
666 candidates
667
668
669
670
671
672
673 -- * Tests
674
675 prop_opposite_octant_tetrahedra_disjoint1 :: Cube -> Bool
676 prop_opposite_octant_tetrahedra_disjoint1 cube =
677 disjoint (front_left_top_tetrahedra cube) (front_right_down_tetrahedra cube)
678
679 prop_opposite_octant_tetrahedra_disjoint2 :: Cube -> Bool
680 prop_opposite_octant_tetrahedra_disjoint2 cube =
681 disjoint (back_left_top_tetrahedra cube) (back_right_down_tetrahedra cube)
682
683 prop_opposite_octant_tetrahedra_disjoint3 :: Cube -> Bool
684 prop_opposite_octant_tetrahedra_disjoint3 cube =
685 disjoint (front_left_top_tetrahedra cube) (back_right_top_tetrahedra cube)
686
687 prop_opposite_octant_tetrahedra_disjoint4 :: Cube -> Bool
688 prop_opposite_octant_tetrahedra_disjoint4 cube =
689 disjoint (front_left_down_tetrahedra cube) (back_right_down_tetrahedra cube)
690
691 prop_opposite_octant_tetrahedra_disjoint5 :: Cube -> Bool
692 prop_opposite_octant_tetrahedra_disjoint5 cube =
693 disjoint (front_left_top_tetrahedra cube) (back_left_down_tetrahedra cube)
694
695 prop_opposite_octant_tetrahedra_disjoint6 :: Cube -> Bool
696 prop_opposite_octant_tetrahedra_disjoint6 cube =
697 disjoint (front_right_top_tetrahedra cube) (back_right_down_tetrahedra cube)
698
699
700 -- | Since the grid size is necessarily positive, all tetrahedra
701 -- (which comprise cubes of positive volume) must have positive
702 -- volume as well.
703 prop_all_volumes_positive :: Cube -> Bool
704 prop_all_volumes_positive cube =
705 all (>= 0) volumes
706 where
707 ts = tetrahedra cube
708 volumes = map volume ts
709
710
711 -- | In fact, since all of the tetrahedra are identical, we should
712 -- already know their volumes. There's 24 tetrahedra to a cube, so
713 -- we'd expect the volume of each one to be 1/24.
714 prop_all_volumes_exact :: Cube -> Bool
715 prop_all_volumes_exact cube =
716 and [volume t ~~= 1/24 | t <- tetrahedra cube]
717
718 -- | All tetrahedron should have their v0 located at the center of the
719 -- cube.
720 prop_v0_all_equal :: Cube -> Bool
721 prop_v0_all_equal cube = (v0 t0) == (v0 t1)
722 where
723 t0 = head (tetrahedra cube) -- Doesn't matter which two we choose.
724 t1 = head $ tail (tetrahedra cube)
725
726
727 -- | Given in Sorokina and Zeilfelder, p. 79, (2.6). Note that the
728 -- third and fourth indices of c-t3 have been switched. This is
729 -- because we store the triangles oriented such that their volume is
730 -- positive. If T and T-tilde share \<v0,v1,v2\> and v3,v3-tilde point
731 -- in opposite directions, one of them has to have negative volume!
732 prop_c0120_identity1 :: Cube -> Bool
733 prop_c0120_identity1 cube =
734 c t0 0 1 2 0 ~= (c t0 0 0 2 1 + c t3 0 0 1 2) / 2
735 where
736 t0 = tetrahedron cube 0
737 t3 = tetrahedron cube 3
738
739
740 -- | Given in Sorokina and Zeilfelder, p. 79, (2.6). Repeats
741 -- 'prop_c0120_identity1' with tetrahedrons 1 and 2.
742 prop_c0120_identity2 :: Cube -> Bool
743 prop_c0120_identity2 cube =
744 c t1 0 1 2 0 ~= (c t1 0 0 2 1 + c t0 0 0 1 2) / 2
745 where
746 t0 = tetrahedron cube 0
747 t1 = tetrahedron cube 1
748
749 -- | Given in Sorokina and Zeilfelder, p. 79, (2.6). Repeats
750 -- 'prop_c0120_identity1' with tetrahedrons 1 and 2.
751 prop_c0120_identity3 :: Cube -> Bool
752 prop_c0120_identity3 cube =
753 c t2 0 1 2 0 ~= (c t2 0 0 2 1 + c t1 0 0 1 2) / 2
754 where
755 t1 = tetrahedron cube 1
756 t2 = tetrahedron cube 2
757
758 -- | Given in Sorokina and Zeilfelder, p. 79, (2.6). Repeats
759 -- 'prop_c0120_identity1' with tetrahedrons 2 and 3.
760 prop_c0120_identity4 :: Cube -> Bool
761 prop_c0120_identity4 cube =
762 c t3 0 1 2 0 ~= (c t3 0 0 2 1 + c t2 0 0 1 2) / 2
763 where
764 t2 = tetrahedron cube 2
765 t3 = tetrahedron cube 3
766
767
768 -- | Given in Sorokina and Zeilfelder, p. 79, (2.6). Repeats
769 -- 'prop_c0120_identity1' with tetrahedrons 4 and 5.
770 prop_c0120_identity5 :: Cube -> Bool
771 prop_c0120_identity5 cube =
772 c t5 0 1 2 0 ~= (c t5 0 0 2 1 + c t4 0 0 1 2) / 2
773 where
774 t4 = tetrahedron cube 4
775 t5 = tetrahedron cube 5
776
777 -- | Given in Sorokina and Zeilfelder, p. 79, (2.6). Repeats
778 -- 'prop_c0120_identity1' with tetrahedrons 5 and 6.
779 prop_c0120_identity6 :: Cube -> Bool
780 prop_c0120_identity6 cube =
781 c t6 0 1 2 0 ~= (c t6 0 0 2 1 + c t5 0 0 1 2) / 2
782 where
783 t5 = tetrahedron cube 5
784 t6 = tetrahedron cube 6
785
786
787 -- | Given in Sorokina and Zeilfelder, p. 79, (2.6). Repeats
788 -- 'prop_c0120_identity1' with tetrahedrons 6 and 7.
789 prop_c0120_identity7 :: Cube -> Bool
790 prop_c0120_identity7 cube =
791 c t7 0 1 2 0 ~= (c t7 0 0 2 1 + c t6 0 0 1 2) / 2
792 where
793 t6 = tetrahedron cube 6
794 t7 = tetrahedron cube 7
795
796
797 -- | Given in Sorokina and Zeilfelder, p. 79, (2.6). See
798 -- 'prop_c0120_identity1'.
799 prop_c0210_identity1 :: Cube -> Bool
800 prop_c0210_identity1 cube =
801 c t0 0 2 1 0 ~= (c t0 0 1 1 1 + c t3 0 1 1 1) / 2
802 where
803 t0 = tetrahedron cube 0
804 t3 = tetrahedron cube 3
805
806
807 -- | Given in Sorokina and Zeilfelder, p. 79, (2.6). See
808 -- 'prop_c0120_identity1'.
809 prop_c0300_identity1 :: Cube -> Bool
810 prop_c0300_identity1 cube =
811 c t0 0 3 0 0 ~= (c t0 0 2 0 1 + c t3 0 2 1 0) / 2
812 where
813 t0 = tetrahedron cube 0
814 t3 = tetrahedron cube 3
815
816
817 -- | Given in Sorokina and Zeilfelder, p. 79, (2.6). See
818 -- 'prop_c0120_identity1'.
819 prop_c1110_identity :: Cube -> Bool
820 prop_c1110_identity cube =
821 c t0 1 1 1 0 ~= (c t0 1 0 1 1 + c t3 1 0 1 1) / 2
822 where
823 t0 = tetrahedron cube 0
824 t3 = tetrahedron cube 3
825
826
827 -- | Given in Sorokina and Zeilfelder, p. 79, (2.6). See
828 -- 'prop_c0120_identity1'.
829 prop_c1200_identity1 :: Cube -> Bool
830 prop_c1200_identity1 cube =
831 c t0 1 2 0 0 ~= (c t0 1 1 0 1 + c t3 1 1 1 0) / 2
832 where
833 t0 = tetrahedron cube 0
834 t3 = tetrahedron cube 3
835
836
837 -- | Given in Sorokina and Zeilfelder, p. 79, (2.6). See
838 -- 'prop_c0120_identity1'.
839 prop_c2100_identity1 :: Cube -> Bool
840 prop_c2100_identity1 cube =
841 c t0 2 1 0 0 ~= (c t0 2 0 0 1 + c t3 2 0 1 0) / 2
842 where
843 t0 = tetrahedron cube 0
844 t3 = tetrahedron cube 3
845
846
847
848 -- | Given in Sorokina and Zeilfelder, p. 79, (2.7). Note that the
849 -- third and fourth indices of c-t3 have been switched. This is
850 -- because we store the triangles oriented such that their volume is
851 -- positive. If T and T-tilde share \<v0,v1,v2\> and v3,v3-tilde
852 -- point in opposite directions, one of them has to have negative
853 -- volume!
854 prop_c0102_identity1 :: Cube -> Bool
855 prop_c0102_identity1 cube =
856 c t0 0 1 0 2 ~= (c t0 0 0 1 2 + c t1 0 0 2 1) / 2
857 where
858 t0 = tetrahedron cube 0
859 t1 = tetrahedron cube 1
860
861
862 -- | Given in Sorokina and Zeilfelder, p. 79, (2.7). See
863 -- 'prop_c0102_identity1'.
864 prop_c0201_identity1 :: Cube -> Bool
865 prop_c0201_identity1 cube =
866 c t0 0 2 0 1 ~= (c t0 0 1 1 1 + c t1 0 1 1 1) / 2
867 where
868 t0 = tetrahedron cube 0
869 t1 = tetrahedron cube 1
870
871
872 -- | Given in Sorokina and Zeilfelder, p. 79, (2.7). See
873 -- 'prop_c0102_identity1'.
874 prop_c0300_identity2 :: Cube -> Bool
875 prop_c0300_identity2 cube =
876 c t0 0 3 0 0 ~= (c t0 0 2 1 0 + c t1 0 2 0 1) / 2
877 where
878 t0 = tetrahedron cube 0
879 t1 = tetrahedron cube 1
880
881
882 -- | Given in Sorokina and Zeilfelder, p. 79, (2.7). See
883 -- 'prop_c0102_identity1'.
884 prop_c1101_identity :: Cube -> Bool
885 prop_c1101_identity cube =
886 c t0 1 1 0 1 ~= (c t0 1 0 1 1 + c t1 1 0 1 1) / 2
887 where
888 t0 = tetrahedron cube 0
889 t1 = tetrahedron cube 1
890
891
892 -- | Given in Sorokina and Zeilfelder, p. 79, (2.7). See
893 -- 'prop_c0102_identity1'.
894 prop_c1200_identity2 :: Cube -> Bool
895 prop_c1200_identity2 cube =
896 c t0 1 2 0 0 ~= (c t0 1 1 1 0 + c t1 1 1 0 1) / 2
897 where
898 t0 = tetrahedron cube 0
899 t1 = tetrahedron cube 1
900
901
902 -- | Given in Sorokina and Zeilfelder, p. 79, (2.7). See
903 -- 'prop_c0102_identity1'.
904 prop_c2100_identity2 :: Cube -> Bool
905 prop_c2100_identity2 cube =
906 c t0 2 1 0 0 ~= (c t0 2 0 1 0 + c t1 2 0 0 1) / 2
907 where
908 t0 = tetrahedron cube 0
909 t1 = tetrahedron cube 1
910
911
912 -- | Given in Sorokina and Zeilfelder, p. 79, (2.8). The third and
913 -- fourth indices of c-t6 have been switched. This is because we
914 -- store the triangles oriented such that their volume is
915 -- positive. If T and T-tilde share \<v0,v1,v2\> and v3,v3-tilde
916 -- point in opposite directions, one of them has to have negative
917 -- volume!
918 prop_c3000_identity :: Cube -> Bool
919 prop_c3000_identity cube =
920 c t0 3 0 0 0 ~= c t0 2 1 0 0 + c t6 2 1 0 0
921 - ((c t0 2 0 1 0 + c t0 2 0 0 1)/ 2)
922 where
923 t0 = tetrahedron cube 0
924 t6 = tetrahedron cube 6
925
926
927 -- | Given in Sorokina and Zeilfelder, p. 79, (2.8). See
928 -- 'prop_c3000_identity'.
929 prop_c2010_identity :: Cube -> Bool
930 prop_c2010_identity cube =
931 c t0 2 0 1 0 ~= c t0 1 1 1 0 + c t6 1 1 0 1
932 - ((c t0 1 0 2 0 + c t0 1 0 1 1)/ 2)
933 where
934 t0 = tetrahedron cube 0
935 t6 = tetrahedron cube 6
936
937
938 -- | Given in Sorokina and Zeilfelder, p. 79, (2.8). See
939 -- 'prop_c3000_identity'.
940 prop_c2001_identity :: Cube -> Bool
941 prop_c2001_identity cube =
942 c t0 2 0 0 1 ~= c t0 1 1 0 1 + c t6 1 1 1 0
943 - ((c t0 1 0 0 2 + c t0 1 0 1 1)/ 2)
944 where
945 t0 = tetrahedron cube 0
946 t6 = tetrahedron cube 6
947
948
949 -- | Given in Sorokina and Zeilfelder, p. 79, (2.8). See
950 -- 'prop_c3000_identity'.
951 prop_c1020_identity :: Cube -> Bool
952 prop_c1020_identity cube =
953 c t0 1 0 2 0 ~= c t0 0 1 2 0 + c t6 0 1 0 2
954 - ((c t0 0 0 3 0 + c t0 0 0 2 1)/ 2)
955 where
956 t0 = tetrahedron cube 0
957 t6 = tetrahedron cube 6
958
959
960 -- | Given in Sorokina and Zeilfelder, p. 79, (2.8). See
961 -- 'prop_c3000_identity'.
962 prop_c1002_identity :: Cube -> Bool
963 prop_c1002_identity cube =
964 c t0 1 0 0 2 ~= c t0 0 1 0 2 + c t6 0 1 2 0
965 - ((c t0 0 0 0 3 + c t0 0 0 1 2)/ 2)
966 where
967 t0 = tetrahedron cube 0
968 t6 = tetrahedron cube 6
969
970
971 -- | Given in Sorokina and Zeilfelder, p. 79, (2.8). See
972 -- 'prop_c3000_identity'.
973 prop_c1011_identity :: Cube -> Bool
974 prop_c1011_identity cube =
975 c t0 1 0 1 1 ~= c t0 0 1 1 1 + c t6 0 1 1 1 -
976 ((c t0 0 0 1 2 + c t0 0 0 2 1)/ 2)
977 where
978 t0 = tetrahedron cube 0
979 t6 = tetrahedron cube 6
980
981
982 -- | The function values at the interior should be the same for all
983 -- tetrahedra.
984 prop_interior_values_all_identical :: Cube -> Bool
985 prop_interior_values_all_identical cube =
986 all_equal [ eval (function_values tet) I | tet <- tetrahedra cube ]
987
988
989 -- | We know what (c t6 2 1 0 0) should be from Sorokina and Zeilfelder, p. 87.
990 -- This test checks the rotation works as expected.
991 prop_c_tilde_2100_rotation_correct :: Cube -> Bool
992 prop_c_tilde_2100_rotation_correct cube =
993 expr1 ~= expr2
994 where
995 t0 = tetrahedron cube 0
996 t6 = tetrahedron cube 6
997
998 -- What gets computed for c2100 of t6.
999 expr1 = eval (function_values t6) $
1000 (3/8)*I +
1001 (1/12)*(T + R + L + D) +
1002 (1/64)*(FT + FR + FL + FD) +
1003 (7/48)*F +
1004 (1/48)*B +
1005 (1/96)*(RT + LD + LT + RD) +
1006 (1/192)*(BT + BR + BL + BD)
1007
1008 -- What should be computed for c2100 of t6.
1009 expr2 = eval (function_values t0) $
1010 (3/8)*I +
1011 (1/12)*(F + R + L + B) +
1012 (1/64)*(FT + RT + LT + BT) +
1013 (7/48)*T +
1014 (1/48)*D +
1015 (1/96)*(FR + FL + BR + BL) +
1016 (1/192)*(FD + RD + LD + BD)
1017
1018
1019 -- | We know what (c t6 2 1 0 0) should be from Sorokina and
1020 -- Zeilfelder, p. 87. This test checks the actual value based on
1021 -- the FunctionValues of the cube.
1022 --
1023 -- If 'prop_c_tilde_2100_rotation_correct' passes, then this test is
1024 -- even meaningful!
1025 prop_c_tilde_2100_correct :: Cube -> Bool
1026 prop_c_tilde_2100_correct cube =
1027 c t6 2 1 0 0 ~= expected
1028 where
1029 t0 = tetrahedron cube 0
1030 t6 = tetrahedron cube 6
1031 fvs = function_values t0
1032 expected = eval fvs $
1033 (3/8)*I +
1034 (1/12)*(F + R + L + B) +
1035 (1/64)*(FT + RT + LT + BT) +
1036 (7/48)*T +
1037 (1/48)*D +
1038 (1/96)*(FR + FL + BR + BL) +
1039 (1/192)*(FD + RD + LD + BD)
1040
1041
1042 -- Tests to check that the correct edges are incidental.
1043 prop_t0_shares_edge_with_t1 :: Cube -> Bool
1044 prop_t0_shares_edge_with_t1 cube =
1045 (v1 t0) == (v1 t1) && (v3 t0) == (v2 t1)
1046 where
1047 t0 = tetrahedron cube 0
1048 t1 = tetrahedron cube 1
1049
1050 prop_t0_shares_edge_with_t3 :: Cube -> Bool
1051 prop_t0_shares_edge_with_t3 cube =
1052 (v1 t0) == (v1 t3) && (v2 t0) == (v3 t3)
1053 where
1054 t0 = tetrahedron cube 0
1055 t3 = tetrahedron cube 3
1056
1057 prop_t0_shares_edge_with_t6 :: Cube -> Bool
1058 prop_t0_shares_edge_with_t6 cube =
1059 (v2 t0) == (v3 t6) && (v3 t0) == (v2 t6)
1060 where
1061 t0 = tetrahedron cube 0
1062 t6 = tetrahedron cube 6
1063
1064 prop_t1_shares_edge_with_t2 :: Cube -> Bool
1065 prop_t1_shares_edge_with_t2 cube =
1066 (v1 t1) == (v1 t2) && (v3 t1) == (v2 t2)
1067 where
1068 t1 = tetrahedron cube 1
1069 t2 = tetrahedron cube 2
1070
1071 prop_t1_shares_edge_with_t19 :: Cube -> Bool
1072 prop_t1_shares_edge_with_t19 cube =
1073 (v2 t1) == (v3 t19) && (v3 t1) == (v2 t19)
1074 where
1075 t1 = tetrahedron cube 1
1076 t19 = tetrahedron cube 19
1077
1078 prop_t2_shares_edge_with_t3 :: Cube -> Bool
1079 prop_t2_shares_edge_with_t3 cube =
1080 (v1 t1) == (v1 t2) && (v3 t1) == (v2 t2)
1081 where
1082 t1 = tetrahedron cube 1
1083 t2 = tetrahedron cube 2
1084
1085 prop_t2_shares_edge_with_t12 :: Cube -> Bool
1086 prop_t2_shares_edge_with_t12 cube =
1087 (v2 t2) == (v3 t12) && (v3 t2) == (v2 t12)
1088 where
1089 t2 = tetrahedron cube 2
1090 t12 = tetrahedron cube 12
1091
1092 prop_t3_shares_edge_with_t21 :: Cube -> Bool
1093 prop_t3_shares_edge_with_t21 cube =
1094 (v2 t3) == (v3 t21) && (v3 t3) == (v2 t21)
1095 where
1096 t3 = tetrahedron cube 3
1097 t21 = tetrahedron cube 21
1098
1099 prop_t4_shares_edge_with_t5 :: Cube -> Bool
1100 prop_t4_shares_edge_with_t5 cube =
1101 (v1 t4) == (v1 t5) && (v3 t4) == (v2 t5)
1102 where
1103 t4 = tetrahedron cube 4
1104 t5 = tetrahedron cube 5
1105
1106 prop_t4_shares_edge_with_t7 :: Cube -> Bool
1107 prop_t4_shares_edge_with_t7 cube =
1108 (v1 t4) == (v1 t7) && (v2 t4) == (v3 t7)
1109 where
1110 t4 = tetrahedron cube 4
1111 t7 = tetrahedron cube 7
1112
1113 prop_t4_shares_edge_with_t10 :: Cube -> Bool
1114 prop_t4_shares_edge_with_t10 cube =
1115 (v2 t4) == (v3 t10) && (v3 t4) == (v2 t10)
1116 where
1117 t4 = tetrahedron cube 4
1118 t10 = tetrahedron cube 10
1119
1120 prop_t5_shares_edge_with_t6 :: Cube -> Bool
1121 prop_t5_shares_edge_with_t6 cube =
1122 (v1 t5) == (v1 t6) && (v3 t5) == (v2 t6)
1123 where
1124 t5 = tetrahedron cube 5
1125 t6 = tetrahedron cube 6
1126
1127 prop_t5_shares_edge_with_t16 :: Cube -> Bool
1128 prop_t5_shares_edge_with_t16 cube =
1129 (v2 t5) == (v3 t16) && (v3 t5) == (v2 t16)
1130 where
1131 t5 = tetrahedron cube 5
1132 t16 = tetrahedron cube 16
1133
1134 prop_t6_shares_edge_with_t7 :: Cube -> Bool
1135 prop_t6_shares_edge_with_t7 cube =
1136 (v1 t6) == (v1 t7) && (v3 t6) == (v2 t7)
1137 where
1138 t6 = tetrahedron cube 6
1139 t7 = tetrahedron cube 7
1140
1141 prop_t7_shares_edge_with_t20 :: Cube -> Bool
1142 prop_t7_shares_edge_with_t20 cube =
1143 (v2 t7) == (v3 t20) && (v2 t7) == (v3 t20)
1144 where
1145 t7 = tetrahedron cube 7
1146 t20 = tetrahedron cube 20
1147
1148
1149 p79_26_properties :: TestTree
1150 p79_26_properties =
1151 testGroup "p. 79, Section (2.6) properties" [
1152 testProperty "c0120 identity1" prop_c0120_identity1,
1153 testProperty "c0120 identity2" prop_c0120_identity2,
1154 testProperty "c0120 identity3" prop_c0120_identity3,
1155 testProperty "c0120 identity4" prop_c0120_identity4,
1156 testProperty "c0120 identity5" prop_c0120_identity5,
1157 testProperty "c0120 identity6" prop_c0120_identity6,
1158 testProperty "c0120 identity7" prop_c0120_identity7,
1159 testProperty "c0210 identity1" prop_c0210_identity1,
1160 testProperty "c0300 identity1" prop_c0300_identity1,
1161 testProperty "c1110 identity" prop_c1110_identity,
1162 testProperty "c1200 identity1" prop_c1200_identity1,
1163 testProperty "c2100 identity1" prop_c2100_identity1]
1164
1165 p79_27_properties :: TestTree
1166 p79_27_properties =
1167 testGroup "p. 79, Section (2.7) properties" [
1168 testProperty "c0102 identity1" prop_c0102_identity1,
1169 testProperty "c0201 identity1" prop_c0201_identity1,
1170 testProperty "c0300 identity2" prop_c0300_identity2,
1171 testProperty "c1101 identity" prop_c1101_identity,
1172 testProperty "c1200 identity2" prop_c1200_identity2,
1173 testProperty "c2100 identity2" prop_c2100_identity2 ]
1174
1175
1176 p79_28_properties :: TestTree
1177 p79_28_properties =
1178 testGroup "p. 79, Section (2.8) properties" [
1179 testProperty "c3000 identity" prop_c3000_identity,
1180 testProperty "c2010 identity" prop_c2010_identity,
1181 testProperty "c2001 identity" prop_c2001_identity,
1182 testProperty "c1020 identity" prop_c1020_identity,
1183 testProperty "c1002 identity" prop_c1002_identity,
1184 testProperty "c1011 identity" prop_c1011_identity ]
1185
1186
1187 edge_incidence_tests :: TestTree
1188 edge_incidence_tests =
1189 testGroup "Edge incidence tests" [
1190 testProperty "t0 shares edge with t6" prop_t0_shares_edge_with_t6,
1191 testProperty "t0 shares edge with t1" prop_t0_shares_edge_with_t1,
1192 testProperty "t0 shares edge with t3" prop_t0_shares_edge_with_t3,
1193 testProperty "t1 shares edge with t2" prop_t1_shares_edge_with_t2,
1194 testProperty "t1 shares edge with t19" prop_t1_shares_edge_with_t19,
1195 testProperty "t2 shares edge with t3" prop_t2_shares_edge_with_t3,
1196 testProperty "t2 shares edge with t12" prop_t2_shares_edge_with_t12,
1197 testProperty "t3 shares edge with t21" prop_t3_shares_edge_with_t21,
1198 testProperty "t4 shares edge with t5" prop_t4_shares_edge_with_t5,
1199 testProperty "t4 shares edge with t7" prop_t4_shares_edge_with_t7,
1200 testProperty "t4 shares edge with t10" prop_t4_shares_edge_with_t10,
1201 testProperty "t5 shares edge with t6" prop_t5_shares_edge_with_t6,
1202 testProperty "t5 shares edge with t16" prop_t5_shares_edge_with_t16,
1203 testProperty "t6 shares edge with t7" prop_t6_shares_edge_with_t7,
1204 testProperty "t7 shares edge with t20" prop_t7_shares_edge_with_t20 ]
1205
1206 cube_properties :: TestTree
1207 cube_properties =
1208 testGroup "Cube properties" [
1209 p79_26_properties,
1210 p79_27_properties,
1211 p79_28_properties,
1212 edge_incidence_tests,
1213 testProperty "opposite octant tetrahedra are disjoint (1)"
1214 prop_opposite_octant_tetrahedra_disjoint1,
1215 testProperty "opposite octant tetrahedra are disjoint (2)"
1216 prop_opposite_octant_tetrahedra_disjoint2,
1217 testProperty "opposite octant tetrahedra are disjoint (3)"
1218 prop_opposite_octant_tetrahedra_disjoint3,
1219 testProperty "opposite octant tetrahedra are disjoint (4)"
1220 prop_opposite_octant_tetrahedra_disjoint4,
1221 testProperty "opposite octant tetrahedra are disjoint (5)"
1222 prop_opposite_octant_tetrahedra_disjoint5,
1223 testProperty "opposite octant tetrahedra are disjoint (6)"
1224 prop_opposite_octant_tetrahedra_disjoint6,
1225 testProperty "all volumes positive" prop_all_volumes_positive,
1226 testProperty "all volumes exact" prop_all_volumes_exact,
1227 testProperty "v0 all equal" prop_v0_all_equal,
1228 testProperty "interior values all identical"
1229 prop_interior_values_all_identical,
1230 testProperty "c-tilde_2100 rotation correct"
1231 prop_c_tilde_2100_rotation_correct,
1232 testProperty "c-tilde_2100 correct"
1233 prop_c_tilde_2100_correct ]