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