]> gitweb.michael.orlitzky.com - spline3.git/blob - src/Tests/Face.hs
fb0253904c8ed7ad28464c5a0411ae85549059d3
[spline3.git] / src / Tests / Face.hs
1 module Tests.Face
2 where
3
4 import Control.Monad (unless)
5 import Test.HUnit
6 import Test.QuickCheck
7
8 import Comparisons
9 import Cube (Cube(grid), cube_at, top)
10 import Face (face0,
11 face2,
12 face5,
13 tetrahedron0,
14 tetrahedron1,
15 tetrahedron2,
16 tetrahedron3,
17 tetrahedrons)
18 import Grid (Grid(h), make_grid)
19 import Tetrahedron
20
21
22 -- HUnit tests.
23
24 -- | An HUnit assertion that wraps the almost_equals function. Stolen
25 -- from the definition of assertEqual in Test/HUnit/Base.hs.
26 assertAlmostEqual :: String -> Double -> Double -> Assertion
27 assertAlmostEqual preface expected actual =
28 unless (actual ~= expected) (assertFailure msg)
29 where msg = (if null preface then "" else preface ++ "\n") ++
30 "expected: " ++ show expected ++ "\n but got: " ++ show actual
31
32
33 -- | Values of the function f(x,y,z) = 1 + x + xy + xyz taken at nine
34 -- points (hi, hj, jk) with h = 1. From example one in the paper.
35 -- Used in the next bunch of tests.
36 trilinear :: [[[Double]]]
37 trilinear = [ [ [ 1, 2, 3 ],
38 [ 1, 3, 5 ],
39 [ 1, 4, 7 ] ],
40 [ [ 1, 2, 3 ],
41 [ 1, 4, 7 ],
42 [ 1, 6, 11 ] ],
43 [ [ 1, 2, 3 ],
44 [ 1, 5, 9 ],
45 [ 1, 8, 15 ]]]
46
47 -- | Check the value of c0030 for any tetrahedron belonging to the
48 -- cube centered on (1,1,1) with a grid constructed from the
49 -- trilinear values. See example one in the paper.
50 test_trilinear_c0030 :: Test
51 test_trilinear_c0030 =
52 TestCase $ assertAlmostEqual "c0030 is correct" (c t 0 0 3 0) (17/8)
53 where
54 g = make_grid 1 trilinear
55 cube = cube_at g 1 1 1
56 t = head (tetrahedrons cube) -- Any one will do.
57
58
59 -- | Check the value of c0003 for any tetrahedron belonging to the
60 -- cube centered on (1,1,1) with a grid constructed from the
61 -- trilinear values. See example one in the paper.
62 test_trilinear_c0003 :: Test
63 test_trilinear_c0003 =
64 TestCase $ assertAlmostEqual "c0003 is correct" (c t 0 0 0 3) (27/8)
65 where
66 g = make_grid 1 trilinear
67 cube = cube_at g 1 1 1
68 t = head (tetrahedrons cube) -- Any one will do.
69
70
71 -- | Check the value of c0021 for any tetrahedron belonging to the
72 -- cube centered on (1,1,1) with a grid constructed from the
73 -- trilinear values. See example one in the paper.
74 test_trilinear_c0021 :: Test
75 test_trilinear_c0021 =
76 TestCase $ assertAlmostEqual "c0021 is correct" (c t 0 0 2 1) (61/24)
77 where
78 g = make_grid 1 trilinear
79 cube = cube_at g 1 1 1
80 t = head (tetrahedrons cube) -- Any one will do.
81
82
83 -- | Check the value of c0012 for any tetrahedron belonging to the
84 -- cube centered on (1,1,1) with a grid constructed from the
85 -- trilinear values. See example one in the paper.
86 test_trilinear_c0012 :: Test
87 test_trilinear_c0012 =
88 TestCase $ assertAlmostEqual "c0012 is correct" (c t 0 0 1 2) (71/24)
89 where
90 g = make_grid 1 trilinear
91 cube = cube_at g 1 1 1
92 t = head (tetrahedrons cube) -- Any one will do.
93
94
95 -- | Check the value of c0120 for any tetrahedron belonging to the
96 -- cube centered on (1,1,1) with a grid constructed from the
97 -- trilinear values. See example one in the paper.
98 test_trilinear_c0120 :: Test
99 test_trilinear_c0120 =
100 TestCase $ assertAlmostEqual "c0120 is correct" (c t 0 1 2 0) (55/24)
101 where
102 g = make_grid 1 trilinear
103 cube = cube_at g 1 1 1
104 t = head (tetrahedrons cube) -- Any one will do.
105
106
107 -- | Check the value of c0102 for any tetrahedron belonging to the
108 -- cube centered on (1,1,1) with a grid constructed from the
109 -- trilinear values. See example one in the paper.
110 test_trilinear_c0102 :: Test
111 test_trilinear_c0102 =
112 TestCase $ assertAlmostEqual "c0102 is correct" (c t 0 1 0 2) (73/24)
113 where
114 g = make_grid 1 trilinear
115 cube = cube_at g 1 1 1
116 t = head (tetrahedrons cube) -- Any one will do.
117
118
119 -- | Check the value of c0111 for any tetrahedron belonging to the
120 -- cube centered on (1,1,1) with a grid constructed from the
121 -- trilinear values. See example one in the paper.
122 test_trilinear_c0111 :: Test
123 test_trilinear_c0111 =
124 TestCase $ assertAlmostEqual "c0111 is correct" (c t 0 1 1 1) (8/3)
125 where
126 g = make_grid 1 trilinear
127 cube = cube_at g 1 1 1
128 t = head (tetrahedrons cube) -- Any one will do.
129
130
131 -- | Check the value of c0210 for any tetrahedron belonging to the
132 -- cube centered on (1,1,1) with a grid constructed from the
133 -- trilinear values. See example one in the paper.
134 test_trilinear_c0210 :: Test
135 test_trilinear_c0210 =
136 TestCase $ assertAlmostEqual "c0210 is correct" (c t 0 2 1 0) (29/12)
137 where
138 g = make_grid 1 trilinear
139 cube = cube_at g 1 1 1
140 t = head (tetrahedrons cube) -- Any one will do.
141
142
143 -- | Check the value of c0201 for any tetrahedron belonging to the
144 -- cube centered on (1,1,1) with a grid constructed from the
145 -- trilinear values. See example one in the paper.
146 test_trilinear_c0201 :: Test
147 test_trilinear_c0201 =
148 TestCase $ assertAlmostEqual "c0201 is correct" (c t 0 2 0 1) (11/4)
149 where
150 g = make_grid 1 trilinear
151 cube = cube_at g 1 1 1
152 t = head (tetrahedrons cube) -- Any one will do.
153
154
155 -- | Check the value of c0300 for any tetrahedron belonging to the
156 -- cube centered on (1,1,1) with a grid constructed from the
157 -- trilinear values. See example one in the paper.
158 test_trilinear_c0300 :: Test
159 test_trilinear_c0300 =
160 TestCase $ assertAlmostEqual "c0300 is correct" (c t 0 3 0 0) (5/2)
161 where
162 g = make_grid 1 trilinear
163 cube = cube_at g 1 1 1
164 t = head (tetrahedrons cube) -- Any one will do.
165
166
167 -- | Check the value of c1020 for any tetrahedron belonging to the
168 -- cube centered on (1,1,1) with a grid constructed from the
169 -- trilinear values. See example one in the paper.
170 test_trilinear_c1020 :: Test
171 test_trilinear_c1020 =
172 TestCase $ assertAlmostEqual "c1020 is correct" (c t 1 0 2 0) (8/3)
173 where
174 g = make_grid 1 trilinear
175 cube = cube_at g 1 1 1
176 t = head (tetrahedrons cube) -- Any one will do.
177
178
179 face_tests :: [Test]
180 face_tests = [test_trilinear_c0030,
181 test_trilinear_c0003,
182 test_trilinear_c0021,
183 test_trilinear_c0012,
184 test_trilinear_c0120,
185 test_trilinear_c0102,
186 test_trilinear_c0111,
187 test_trilinear_c0210,
188 test_trilinear_c0201,
189 test_trilinear_c0300,
190 test_trilinear_c1020]
191
192
193 -- QuickCheck Tests.
194
195 -- | Since the grid size is necessarily positive, all tetrahedrons
196 -- (which comprise cubes of positive volume) must have positive volume
197 -- as well.
198 prop_all_volumes_positive :: Cube -> Property
199 prop_all_volumes_positive c =
200 (delta > 0) ==> (null nonpositive_volumes)
201 where
202 delta = h (grid c)
203 ts = tetrahedrons c
204 volumes = map volume ts
205 nonpositive_volumes = filter (<= 0) volumes
206
207
208 -- | Given in Sorokina and Zeilfelder, p. 78.
209 prop_cijk1_identity :: Cube -> Bool
210 prop_cijk1_identity cube =
211 and [ c t0' i j k 1 ~= (c t1' (i+1) j k 0) * ((b0 t0') (v3 t1')) +
212 (c t1' i (j+1) k 0) * ((b1 t0') (v3 t1')) +
213 (c t1' i j (k+1) 0) * ((b2 t0') (v3 t1')) +
214 (c t1' i j k 1) * ((b3 t0') (v3 t1')) | i <- [0..2],
215 j <- [0..2],
216 k <- [0..2],
217 i + j + k == 2]
218 where
219 t0 = tetrahedron0 (face0 cube)
220 t1 = tetrahedron1 (face0 cube)
221 t0' = Tetrahedron cube (v3 t0) (v2 t0) (v1 t0) (v0 t0)
222 t1' = Tetrahedron cube (v3 t1) (v2 t1) (v0 t1) (v1 t1)
223
224 -- | Given in Sorokina and Zeilfelder, p. 79.
225 prop_c0120_identity1 :: Cube -> Bool
226 prop_c0120_identity1 cube =
227 c t0' 0 1 2 0 ~= (c t0' 0 0 2 1 + c t1' 0 0 2 1) / 2
228 where
229 t0 = tetrahedron0 (face0 cube)
230 t1 = tetrahedron1 (face0 cube)
231 t0' = Tetrahedron cube (v3 t0) (v2 t0) (v1 t0) (v0 t0)
232 t1' = Tetrahedron cube (v3 t1) (v2 t1) (v0 t1) (v1 t1)
233
234
235 -- | Given in Sorokina and Zeilfelder, p. 79.
236 prop_c0210_identity1 :: Cube -> Bool
237 prop_c0210_identity1 cube =
238 c t0' 0 2 1 0 ~= (c t0' 0 1 1 1 + c t1' 0 1 1 1) / 2
239 where
240 t0 = tetrahedron0 (face0 cube)
241 t1 = tetrahedron1 (face0 cube)
242 t0' = Tetrahedron cube (v3 t0) (v2 t0) (v1 t0) (v0 t0)
243 t1' = Tetrahedron cube (v3 t1) (v2 t1) (v0 t1) (v1 t1)
244
245
246 -- | Given in Sorokina and Zeilfelder, p. 79.
247 prop_c0300_identity1 :: Cube -> Bool
248 prop_c0300_identity1 cube =
249 c t0' 0 3 0 0 ~= (c t0' 0 2 0 1 + c t1' 0 2 0 1) / 2
250 where
251 t0 = tetrahedron0 (face0 cube)
252 t1 = tetrahedron1 (face0 cube)
253 t0' = Tetrahedron cube (v3 t0) (v2 t0) (v1 t0) (v0 t0)
254 t1' = Tetrahedron cube (v3 t1) (v2 t1) (v0 t1) (v1 t1)
255
256 -- | Given in Sorokina and Zeilfelder, p. 79.
257 prop_c1110_identity :: Cube -> Bool
258 prop_c1110_identity cube =
259 c t0' 1 1 1 0 ~= (c t0' 1 0 1 1 + c t1' 1 0 1 1) / 2
260 where
261 t0 = tetrahedron0 (face0 cube)
262 t1 = tetrahedron1 (face0 cube)
263 t0' = Tetrahedron cube (v3 t0) (v2 t0) (v1 t0) (v0 t0)
264 t1' = Tetrahedron cube (v3 t1) (v2 t1) (v0 t1) (v1 t1)
265
266
267 -- | Given in Sorokina and Zeilfelder, p. 79.
268 prop_c1200_identity1 :: Cube -> Bool
269 prop_c1200_identity1 cube =
270 c t0' 1 2 0 0 ~= (c t0' 1 1 0 1 + c t1' 1 1 0 1) / 2
271 where
272 t0 = tetrahedron0 (face0 cube)
273 t1 = tetrahedron1 (face0 cube)
274 t0' = Tetrahedron cube (v3 t0) (v2 t0) (v1 t0) (v0 t0)
275 t1' = Tetrahedron cube (v3 t1) (v2 t1) (v0 t1) (v1 t1)
276
277
278 -- | Given in Sorokina and Zeilfelder, p. 79.
279 prop_c2100_identity1 :: Cube -> Bool
280 prop_c2100_identity1 cube =
281 c t0' 2 1 0 0 ~= (c t0' 2 0 0 1 + c t1' 2 0 0 1) / 2
282 where
283 t0 = tetrahedron0 (face0 cube)
284 t1 = tetrahedron1 (face0 cube)
285 t0' = Tetrahedron cube (v3 t0) (v2 t0) (v1 t0) (v0 t0)
286 t1' = Tetrahedron cube (v3 t1) (v2 t1) (v0 t1) (v1 t1)
287
288
289 -- | Given in Sorokina and Zeilfelder, p. 79.
290 prop_c0102_identity1 :: Cube -> Bool
291 prop_c0102_identity1 cube =
292 c t0' 0 1 0 2 ~= (c t0' 0 0 1 2 + c t3' 0 0 1 2) / 2
293 where
294 t0 = tetrahedron0 (face0 cube)
295 t3 = tetrahedron3 (face0 cube)
296 t0' = Tetrahedron cube (v3 t0) (v2 t0) (v1 t0) (v0 t0)
297 t3' = Tetrahedron cube (v3 t3) (v2 t3) (v1 t3) (v0 t3)
298
299
300 -- | Given in Sorokina and Zeilfelder, p. 79.
301 prop_c0201_identity1 :: Cube -> Bool
302 prop_c0201_identity1 cube =
303 c t0' 0 2 0 1 ~= (c t0' 0 1 1 1 + c t3' 0 1 1 1) / 2
304 where
305 t0 = tetrahedron0 (face0 cube)
306 t3 = tetrahedron3 (face0 cube)
307 t0' = Tetrahedron cube (v3 t0) (v2 t0) (v1 t0) (v0 t0)
308 t3' = Tetrahedron cube (v3 t3) (v2 t3) (v1 t3) (v0 t3)
309
310
311 -- | Given in Sorokina and Zeilfelder, p. 79.
312 prop_c0300_identity2 :: Cube -> Bool
313 prop_c0300_identity2 cube =
314 c t0' 3 0 0 0 ~= (c t0' 0 2 1 0 + c t3' 0 2 1 0) / 2
315 where
316 t0 = tetrahedron0 (face0 cube)
317 t3 = tetrahedron3 (face0 cube)
318 t0' = Tetrahedron cube (v3 t0) (v2 t0) (v1 t0) (v0 t0)
319 t3' = Tetrahedron cube (v3 t3) (v2 t3) (v1 t3) (v0 t3)
320
321 -- | Given in Sorokina and Zeilfelder, p. 79.
322 prop_c1101_identity :: Cube -> Bool
323 prop_c1101_identity cube =
324 c t0' 1 1 0 1 ~= (c t0' 1 1 0 1 + c t3' 1 1 0 1) / 2
325 where
326 t0 = tetrahedron0 (face0 cube)
327 t3 = tetrahedron3 (face0 cube)
328 t0' = Tetrahedron cube (v3 t0) (v2 t0) (v1 t0) (v0 t0)
329 t3' = Tetrahedron cube (v3 t3) (v2 t3) (v1 t3) (v0 t3)
330
331
332 -- | Given in Sorokina and Zeilfelder, p. 79.
333 prop_c1200_identity2 :: Cube -> Bool
334 prop_c1200_identity2 cube =
335 c t0' 1 1 1 0 ~= (c t0' 1 1 1 0 + c t3' 1 1 1 0) / 2
336 where
337 t0 = tetrahedron0 (face0 cube)
338 t3 = tetrahedron3 (face0 cube)
339 t0' = Tetrahedron cube (v3 t0) (v2 t0) (v1 t0) (v0 t0)
340 t3' = Tetrahedron cube (v3 t3) (v2 t3) (v1 t3) (v0 t3)
341
342
343 -- | Given in Sorokina and Zeilfelder, p. 79.
344 prop_c2100_identity2 :: Cube -> Bool
345 prop_c2100_identity2 cube =
346 c t0' 2 1 0 0 ~= (c t0' 2 0 1 0 + c t3' 2 0 1 0) / 2
347 where
348 t0 = tetrahedron0 (face0 cube)
349 t3 = tetrahedron3 (face0 cube)
350 t0' = Tetrahedron cube (v3 t0) (v2 t0) (v1 t0) (v0 t0)
351 t3' = Tetrahedron cube (v3 t3) (v2 t3) (v1 t3) (v0 t3)
352
353
354 -- | Given in Sorokina and Zeilfelder, p. 79.
355 prop_c3000_identity :: Cube -> Bool
356 prop_c3000_identity cube =
357 c t0' 3 0 0 0 ~= c t0' 2 1 0 0 + c t2' 2 1 0 0 - ((c t0' 2 0 1 0 + c t0' 2 0 0 1)/ 2)
358 where
359 t0 = tetrahedron0 (face0 cube)
360 t2 = tetrahedron2 (face5 cube)
361 t0' = Tetrahedron cube (v3 t0) (v2 t0) (v1 t0) (v0 t0)
362 t2' = Tetrahedron cube (v3 t2) (v2 t2) (v1 t2) (v0 t2)
363
364
365 -- | Given in Sorokina and Zeilfelder, p. 79.
366 prop_c2010_identity :: Cube -> Bool
367 prop_c2010_identity cube =
368 c t0' 2 0 1 0 ~= c t0' 1 1 1 0 + c t2' 1 1 1 0 - ((c t0' 1 0 2 0 + c t0' 1 0 1 1)/ 2)
369 where
370 t0 = tetrahedron0 (face0 cube)
371 t2 = tetrahedron2 (face5 cube)
372 t0' = Tetrahedron cube (v3 t0) (v2 t0) (v1 t0) (v0 t0)
373 t2' = Tetrahedron cube (v3 t2) (v2 t2) (v1 t2) (v0 t2)
374
375
376 -- | Given in Sorokina and Zeilfelder, p. 79.
377 prop_c2001_identity :: Cube -> Bool
378 prop_c2001_identity cube =
379 c t0' 2 0 0 1 ~= c t0' 1 1 0 1 + c t2' 1 1 0 1 - ((c t0' 1 0 0 2 + c t0' 1 0 1 1)/ 2)
380 where
381 t0 = tetrahedron0 (face0 cube)
382 t2 = tetrahedron2 (face5 cube)
383 t0' = Tetrahedron cube (v3 t0) (v2 t0) (v1 t0) (v0 t0)
384 t2' = Tetrahedron cube (v3 t2) (v2 t2) (v1 t2) (v0 t2)
385
386 -- | Given in Sorokina and Zeilfelder, p. 79.
387 prop_c1020_identity :: Cube -> Bool
388 prop_c1020_identity cube =
389 c t0' 1 0 2 0 ~= c t0' 0 1 2 0 + c t2' 0 1 2 0 - ((c t0' 0 0 3 0 + c t0' 0 0 2 1)/ 2)
390 where
391 t0 = tetrahedron0 (face0 cube)
392 t2 = tetrahedron2 (face5 cube)
393 t0' = Tetrahedron cube (v3 t0) (v2 t0) (v1 t0) (v0 t0)
394 t2' = Tetrahedron cube (v3 t2) (v2 t2) (v1 t2) (v0 t2)
395
396
397 -- | Given in Sorokina and Zeilfelder, p. 79.
398 prop_c1002_identity :: Cube -> Bool
399 prop_c1002_identity cube =
400 c t0' 1 0 0 2 ~= c t0' 0 1 0 2 + c t2' 0 1 0 2 - ((c t0' 0 0 0 3 + c t0' 0 0 1 2)/ 2)
401 where
402 t0 = tetrahedron0 (face0 cube)
403 t2 = tetrahedron2 (face5 cube)
404 t0' = Tetrahedron cube (v3 t0) (v2 t0) (v1 t0) (v0 t0)
405 t2' = Tetrahedron cube (v3 t2) (v2 t2) (v1 t2) (v0 t2)
406
407
408 -- | Given in Sorokina and Zeilfelder, p. 79.
409 prop_c1011_identity :: Cube -> Bool
410 prop_c1011_identity cube =
411 c t0' 1 0 1 1 ~= c t0' 0 1 1 1 + c t2' 0 1 1 1 - ((c t0' 0 0 1 2 + c t0' 0 0 2 1)/ 2)
412 where
413 t0 = tetrahedron0 (face0 cube)
414 t2 = tetrahedron2 (face5 cube)
415 t0' = Tetrahedron cube (v3 t0) (v2 t0) (v1 t0) (v0 t0)
416 t2' = Tetrahedron cube (v3 t2) (v2 t2) (v1 t2) (v0 t2)
417
418
419 -- | Given in Sorokina and Zeilfelder, p. 80.
420 prop_c0120_identity2 :: Cube -> Bool
421 prop_c0120_identity2 cube =
422 c t0' 0 1 2 0 ~= (c t0' 1 0 2 0 + c t1' 1 0 2 0) / 2
423 where
424 t0 = tetrahedron0 (face0 cube)
425 t1 = tetrahedron0 (face2 (top cube))
426 t0' = Tetrahedron cube (v3 t0) (v2 t0) (v1 t0) (v0 t0)
427 t1' = Tetrahedron cube (v3 t1) (v2 t1) (v0 t1) (v1 t1)
428
429
430 -- | Given in Sorokina and Zeilfelder, p. 80.
431 prop_c0102_identity2 :: Cube -> Bool
432 prop_c0102_identity2 cube =
433 c t0' 0 1 0 2 ~= (c t0' 1 0 0 2 + c t1' 1 0 0 2) / 2
434 where
435 t0 = tetrahedron0 (face0 cube)
436 t1 = tetrahedron0 (face2 (top cube))
437 t0' = Tetrahedron cube (v3 t0) (v2 t0) (v1 t0) (v0 t0)
438 t1' = Tetrahedron cube (v3 t1) (v2 t1) (v0 t1) (v1 t1)
439
440
441 -- | Given in Sorokina and Zeilfelder, p. 80.
442 prop_c0111_identity :: Cube -> Bool
443 prop_c0111_identity cube =
444 c t0' 0 1 1 1 ~= (c t0' 1 0 1 1 + c t1' 1 0 1 1) / 2
445 where
446 t0 = tetrahedron0 (face0 cube)
447 t1 = tetrahedron0 (face2 (top cube))
448 t0' = Tetrahedron cube (v3 t0) (v2 t0) (v1 t0) (v0 t0)
449 t1' = Tetrahedron cube (v3 t1) (v2 t1) (v0 t1) (v1 t1)
450
451
452 -- | Given in Sorokina and Zeilfelder, p. 80.
453 prop_c0210_identity2 :: Cube -> Bool
454 prop_c0210_identity2 cube =
455 c t0 0 2 1 0 ~= (c t0 1 1 1 0 + c t1 1 1 1 0) / 2
456 where
457 t0 = tetrahedron0 (face0 cube)
458 t1 = tetrahedron0 (face2 (top cube))
459 t0' = Tetrahedron cube (v3 t0) (v2 t0) (v1 t0) (v0 t0)
460 t1' = Tetrahedron cube (v3 t1) (v2 t1) (v0 t1) (v1 t1)
461
462
463 -- | Given in Sorokina and Zeilfelder, p. 80.
464 prop_c0201_identity2 :: Cube -> Bool
465 prop_c0201_identity2 cube =
466 c t0 0 2 0 1 ~= (c t0 1 1 0 1 + c t1 1 1 0 1) / 2
467 where
468 t0 = tetrahedron0 (face0 cube)
469 t1 = tetrahedron0 (face2 (top cube))
470 t0' = Tetrahedron cube (v3 t0) (v2 t0) (v1 t0) (v0 t0)
471 t1' = Tetrahedron cube (v3 t1) (v2 t1) (v0 t1) (v1 t1)
472
473
474 -- | Given in Sorokina and Zeilfelder, p. 80.
475 prop_c0300_identity3 :: Cube -> Bool
476 prop_c0300_identity3 cube =
477 c t0 0 3 0 0 ~= (c t0 1 2 0 0 + c t1 1 2 0 0) / 2
478 where
479 t0 = tetrahedron0 (face0 cube)
480 t1 = tetrahedron0 (face2 (top cube))
481 t0' = Tetrahedron cube (v3 t0) (v2 t0) (v1 t0) (v0 t0)
482 t1' = Tetrahedron cube (v3 t1) (v2 t1) (v0 t1) (v1 t1)