]> gitweb.michael.orlitzky.com - spline3.git/blob - src/Tests/Face.hs
Move all of the trilinear coefficient tests into the Tests.Grid module.
[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 Assertions
9 import Comparisons
10 import Face
11 import Grid (Grid(h), make_grid)
12 import Point
13 import Tetrahedron
14
15
16 -- HUnit tests.
17
18
19
20
21
22 -- -- test_trilinear_f0_t0_v0 :: Test
23 -- -- test_trilinear_f0_t0_v0 =
24 -- -- TestCase $ assertClose "v0 is correct" (v0 t) (0.5, 1.5, 1.5)
25 -- -- where
26 -- -- g = make_grid 1 trilinear
27 -- -- cube = cube_at g 1 1 1
28 -- -- t = tetrahedron0 (face0 cube) -- Any one will do.
29
30
31 -- -- test_trilinear_f0_t0_v1 :: Test
32 -- -- test_trilinear_f0_t0_v1 =
33 -- -- TestCase $ assertClose "v1 is correct" (v1 t) (1.5, 1.5, 1.5)
34 -- -- where
35 -- -- g = make_grid 1 trilinear
36 -- -- cube = cube_at g 1 1 1
37 -- -- t = tetrahedron0 (face0 cube) -- Any one will do.
38
39
40 -- -- test_trilinear_f0_t0_v2 :: Test
41 -- -- test_trilinear_f0_t0_v2 =
42 -- -- TestCase $ assertClose "v2 is correct" (v2 t) (1, 1, 1.5)
43 -- -- where
44 -- -- g = make_grid 1 trilinear
45 -- -- cube = cube_at g 1 1 1
46 -- -- t = tetrahedron0 (face0 cube) -- Any one will do.
47
48
49
50 -- -- test_trilinear_f0_t0_v3 :: Test
51 -- -- test_trilinear_f0_t0_v3 =
52 -- -- TestCase $ assertClose "v3 is correct" (v3 t) (1, 1, 1)
53 -- -- where
54 -- -- g = make_grid 1 trilinear
55 -- -- cube = cube_at g 1 1 1
56 -- -- t = tetrahedron0 (face0 cube) -- Any one will do.
57
58
59
60 -- face_tests :: [Test]
61 face_tests = []
62 -- face_tests = [test_trilinear_c0030,
63 -- test_trilinear_c0003,
64 -- test_trilinear_c0021,
65 -- test_trilinear_c0012,
66 -- test_trilinear_c0120,
67 -- test_trilinear_c0102,
68 -- test_trilinear_c0111,
69 -- test_trilinear_c0210,
70 -- test_trilinear_c0201,
71 -- test_trilinear_c0300,
72 -- test_trilinear_c1020,
73 -- test_trilinear_c1002,
74 -- test_trilinear_c1011,
75 -- test_trilinear_c1110,
76 -- test_trilinear_c1101,
77 -- test_trilinear_c1200,
78 -- test_trilinear_c2010,
79 -- test_trilinear_c2001,
80 -- test_trilinear_c2100,
81 -- test_trilinear_c3000,
82 -- test_trilinear_f0_t0_v0,
83 -- test_trilinear_f0_t0_v1,
84 -- test_trilinear_f0_t0_v2,
85 -- test_trilinear_f0_t0_v3]
86
87
88 -- -- QuickCheck Tests.
89
90
91 -- -- | Given in Sorokina and Zeilfelder, p. 78.
92 -- prop_cijk1_identity :: Cube -> Bool
93 -- prop_cijk1_identity cube =
94 -- and [ c t0' i j k 1 ~= (c t1' (i+1) j k 0) * ((b0 t0') (v3 t1')) +
95 -- (c t1' i (j+1) k 0) * ((b1 t0') (v3 t1')) +
96 -- (c t1' i j (k+1) 0) * ((b2 t0') (v3 t1')) +
97 -- (c t1' i j k 1) * ((b3 t0') (v3 t1')) | i <- [0..2],
98 -- j <- [0..2],
99 -- k <- [0..2],
100 -- i + j + k == 2]
101 -- where
102 -- t0 = tetrahedron0 (face0 cube)
103 -- t1 = tetrahedron1 (face0 cube)
104 -- t0' = Tetrahedron cube (v3 t0) (v2 t0) (v1 t0) (v0 t0)
105 -- t1' = Tetrahedron cube (v3 t1) (v2 t1) (v0 t1) (v1 t1)
106
107 -- -- | Given in Sorokina and Zeilfelder, p. 79.
108 -- prop_c0120_identity1 :: Cube -> Bool
109 -- prop_c0120_identity1 cube =
110 -- c t0' 0 1 2 0 ~= (c t0' 0 0 2 1 + c t1' 0 0 2 1) / 2
111 -- where
112 -- t0 = tetrahedron0 (face0 cube)
113 -- t1 = tetrahedron1 (face0 cube)
114 -- t0' = Tetrahedron cube (v3 t0) (v2 t0) (v1 t0) (v0 t0)
115 -- t1' = Tetrahedron cube (v3 t1) (v2 t1) (v0 t1) (v1 t1)
116
117
118 -- -- | Given in Sorokina and Zeilfelder, p. 79.
119 -- prop_c0210_identity1 :: Cube -> Bool
120 -- prop_c0210_identity1 cube =
121 -- c t0' 0 2 1 0 ~= (c t0' 0 1 1 1 + c t1' 0 1 1 1) / 2
122 -- where
123 -- t0 = tetrahedron0 (face0 cube)
124 -- t1 = tetrahedron1 (face0 cube)
125 -- t0' = Tetrahedron cube (v3 t0) (v2 t0) (v1 t0) (v0 t0)
126 -- t1' = Tetrahedron cube (v3 t1) (v2 t1) (v0 t1) (v1 t1)
127
128
129 -- -- | Given in Sorokina and Zeilfelder, p. 79.
130 -- prop_c0300_identity1 :: Cube -> Bool
131 -- prop_c0300_identity1 cube =
132 -- c t0' 0 3 0 0 ~= (c t0' 0 2 0 1 + c t1' 0 2 0 1) / 2
133 -- where
134 -- t0 = tetrahedron0 (face0 cube)
135 -- t1 = tetrahedron1 (face0 cube)
136 -- t0' = Tetrahedron cube (v3 t0) (v2 t0) (v1 t0) (v0 t0)
137 -- t1' = Tetrahedron cube (v3 t1) (v2 t1) (v0 t1) (v1 t1)
138
139 -- -- | Given in Sorokina and Zeilfelder, p. 79.
140 -- prop_c1110_identity :: Cube -> Bool
141 -- prop_c1110_identity cube =
142 -- c t0' 1 1 1 0 ~= (c t0' 1 0 1 1 + c t1' 1 0 1 1) / 2
143 -- where
144 -- t0 = tetrahedron0 (face0 cube)
145 -- t1 = tetrahedron1 (face0 cube)
146 -- t0' = Tetrahedron cube (v3 t0) (v2 t0) (v1 t0) (v0 t0)
147 -- t1' = Tetrahedron cube (v3 t1) (v2 t1) (v0 t1) (v1 t1)
148
149
150 -- -- | Given in Sorokina and Zeilfelder, p. 79.
151 -- prop_c1200_identity1 :: Cube -> Bool
152 -- prop_c1200_identity1 cube =
153 -- c t0' 1 2 0 0 ~= (c t0' 1 1 0 1 + c t1' 1 1 0 1) / 2
154 -- where
155 -- t0 = tetrahedron0 (face0 cube)
156 -- t1 = tetrahedron1 (face0 cube)
157 -- t0' = Tetrahedron cube (v3 t0) (v2 t0) (v1 t0) (v0 t0)
158 -- t1' = Tetrahedron cube (v3 t1) (v2 t1) (v0 t1) (v1 t1)
159
160
161 -- -- | Given in Sorokina and Zeilfelder, p. 79.
162 -- prop_c2100_identity1 :: Cube -> Bool
163 -- prop_c2100_identity1 cube =
164 -- c t0' 2 1 0 0 ~= (c t0' 2 0 0 1 + c t1' 2 0 0 1) / 2
165 -- where
166 -- t0 = tetrahedron0 (face0 cube)
167 -- t1 = tetrahedron1 (face0 cube)
168 -- t0' = Tetrahedron cube (v3 t0) (v2 t0) (v1 t0) (v0 t0)
169 -- t1' = Tetrahedron cube (v3 t1) (v2 t1) (v0 t1) (v1 t1)
170
171
172 -- -- | Given in Sorokina and Zeilfelder, p. 79.
173 -- prop_c0102_identity1 :: Cube -> Bool
174 -- prop_c0102_identity1 cube =
175 -- c t0' 0 1 0 2 ~= (c t0' 0 0 1 2 + c t3' 0 0 1 2) / 2
176 -- where
177 -- t0 = tetrahedron0 (face0 cube)
178 -- t3 = tetrahedron3 (face0 cube)
179 -- t0' = Tetrahedron cube (v3 t0) (v2 t0) (v1 t0) (v0 t0)
180 -- t3' = Tetrahedron cube (v3 t3) (v2 t3) (v1 t3) (v0 t3)
181
182
183 -- -- | Given in Sorokina and Zeilfelder, p. 79.
184 -- prop_c0201_identity1 :: Cube -> Bool
185 -- prop_c0201_identity1 cube =
186 -- c t0' 0 2 0 1 ~= (c t0' 0 1 1 1 + c t3' 0 1 1 1) / 2
187 -- where
188 -- t0 = tetrahedron0 (face0 cube)
189 -- t3 = tetrahedron3 (face0 cube)
190 -- t0' = Tetrahedron cube (v3 t0) (v2 t0) (v1 t0) (v0 t0)
191 -- t3' = Tetrahedron cube (v3 t3) (v2 t3) (v1 t3) (v0 t3)
192
193
194 -- -- | Given in Sorokina and Zeilfelder, p. 79.
195 -- prop_c0300_identity2 :: Cube -> Bool
196 -- prop_c0300_identity2 cube =
197 -- c t0' 3 0 0 0 ~= (c t0' 0 2 1 0 + c t3' 0 2 1 0) / 2
198 -- where
199 -- t0 = tetrahedron0 (face0 cube)
200 -- t3 = tetrahedron3 (face0 cube)
201 -- t0' = Tetrahedron cube (v3 t0) (v2 t0) (v1 t0) (v0 t0)
202 -- t3' = Tetrahedron cube (v3 t3) (v2 t3) (v1 t3) (v0 t3)
203
204 -- -- | Given in Sorokina and Zeilfelder, p. 79.
205 -- prop_c1101_identity :: Cube -> Bool
206 -- prop_c1101_identity cube =
207 -- c t0' 1 1 0 1 ~= (c t0' 1 1 0 1 + c t3' 1 1 0 1) / 2
208 -- where
209 -- t0 = tetrahedron0 (face0 cube)
210 -- t3 = tetrahedron3 (face0 cube)
211 -- t0' = Tetrahedron cube (v3 t0) (v2 t0) (v1 t0) (v0 t0)
212 -- t3' = Tetrahedron cube (v3 t3) (v2 t3) (v1 t3) (v0 t3)
213
214
215 -- -- | Given in Sorokina and Zeilfelder, p. 79.
216 -- prop_c1200_identity2 :: Cube -> Bool
217 -- prop_c1200_identity2 cube =
218 -- c t0' 1 1 1 0 ~= (c t0' 1 1 1 0 + c t3' 1 1 1 0) / 2
219 -- where
220 -- t0 = tetrahedron0 (face0 cube)
221 -- t3 = tetrahedron3 (face0 cube)
222 -- t0' = Tetrahedron cube (v3 t0) (v2 t0) (v1 t0) (v0 t0)
223 -- t3' = Tetrahedron cube (v3 t3) (v2 t3) (v1 t3) (v0 t3)
224
225
226 -- -- | Given in Sorokina and Zeilfelder, p. 79.
227 -- prop_c2100_identity2 :: Cube -> Bool
228 -- prop_c2100_identity2 cube =
229 -- c t0' 2 1 0 0 ~= (c t0' 2 0 1 0 + c t3' 2 0 1 0) / 2
230 -- where
231 -- t0 = tetrahedron0 (face0 cube)
232 -- t3 = tetrahedron3 (face0 cube)
233 -- t0' = Tetrahedron cube (v3 t0) (v2 t0) (v1 t0) (v0 t0)
234 -- t3' = Tetrahedron cube (v3 t3) (v2 t3) (v1 t3) (v0 t3)
235
236
237 -- -- | Given in Sorokina and Zeilfelder, p. 79.
238 -- prop_c3000_identity :: Cube -> Bool
239 -- prop_c3000_identity cube =
240 -- 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)
241 -- where
242 -- t0 = tetrahedron0 (face0 cube)
243 -- t2 = tetrahedron2 (face5 cube)
244 -- t0' = Tetrahedron cube (v3 t0) (v2 t0) (v1 t0) (v0 t0)
245 -- t2' = Tetrahedron cube (v3 t2) (v2 t2) (v1 t2) (v0 t2)
246
247
248 -- -- | Given in Sorokina and Zeilfelder, p. 79.
249 -- prop_c2010_identity :: Cube -> Bool
250 -- prop_c2010_identity cube =
251 -- 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)
252 -- where
253 -- t0 = tetrahedron0 (face0 cube)
254 -- t2 = tetrahedron2 (face5 cube)
255 -- t0' = Tetrahedron cube (v3 t0) (v2 t0) (v1 t0) (v0 t0)
256 -- t2' = Tetrahedron cube (v3 t2) (v2 t2) (v1 t2) (v0 t2)
257
258
259 -- -- | Given in Sorokina and Zeilfelder, p. 79.
260 -- prop_c2001_identity :: Cube -> Bool
261 -- prop_c2001_identity cube =
262 -- 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)
263 -- where
264 -- t0 = tetrahedron0 (face0 cube)
265 -- t2 = tetrahedron2 (face5 cube)
266 -- t0' = Tetrahedron cube (v3 t0) (v2 t0) (v1 t0) (v0 t0)
267 -- t2' = Tetrahedron cube (v3 t2) (v2 t2) (v1 t2) (v0 t2)
268
269 -- -- | Given in Sorokina and Zeilfelder, p. 79.
270 -- prop_c1020_identity :: Cube -> Bool
271 -- prop_c1020_identity cube =
272 -- 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)
273 -- where
274 -- t0 = tetrahedron0 (face0 cube)
275 -- t2 = tetrahedron2 (face5 cube)
276 -- t0' = Tetrahedron cube (v3 t0) (v2 t0) (v1 t0) (v0 t0)
277 -- t2' = Tetrahedron cube (v3 t2) (v2 t2) (v1 t2) (v0 t2)
278
279
280 -- -- | Given in Sorokina and Zeilfelder, p. 79.
281 -- prop_c1002_identity :: Cube -> Bool
282 -- prop_c1002_identity cube =
283 -- 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)
284 -- where
285 -- t0 = tetrahedron0 (face0 cube)
286 -- t2 = tetrahedron2 (face5 cube)
287 -- t0' = Tetrahedron cube (v3 t0) (v2 t0) (v1 t0) (v0 t0)
288 -- t2' = Tetrahedron cube (v3 t2) (v2 t2) (v1 t2) (v0 t2)
289
290
291 -- -- | Given in Sorokina and Zeilfelder, p. 79.
292 -- prop_c1011_identity :: Cube -> Bool
293 -- prop_c1011_identity cube =
294 -- 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)
295 -- where
296 -- t0 = tetrahedron0 (face0 cube)
297 -- t2 = tetrahedron2 (face5 cube)
298 -- t0' = Tetrahedron cube (v3 t0) (v2 t0) (v1 t0) (v0 t0)
299 -- t2' = Tetrahedron cube (v3 t2) (v2 t2) (v1 t2) (v0 t2)
300
301
302 -- -- | Given in Sorokina and Zeilfelder, p. 80.
303 -- prop_c0120_identity2 :: Cube -> Bool
304 -- prop_c0120_identity2 cube =
305 -- c t0' 0 1 2 0 ~= (c t0' 1 0 2 0 + c t1' 1 0 2 0) / 2
306 -- where
307 -- t0 = tetrahedron0 (face0 cube)
308 -- t1 = tetrahedron0 (face2 (top cube))
309 -- t0' = Tetrahedron cube (v3 t0) (v2 t0) (v1 t0) (v0 t0)
310 -- t1' = Tetrahedron cube (v3 t1) (v2 t1) (v0 t1) (v1 t1)
311
312
313 -- -- | Given in Sorokina and Zeilfelder, p. 80.
314 -- prop_c0102_identity2 :: Cube -> Bool
315 -- prop_c0102_identity2 cube =
316 -- c t0' 0 1 0 2 ~= (c t0' 1 0 0 2 + c t1' 1 0 0 2) / 2
317 -- where
318 -- t0 = tetrahedron0 (face0 cube)
319 -- t1 = tetrahedron0 (face2 (top cube))
320 -- t0' = Tetrahedron cube (v3 t0) (v2 t0) (v1 t0) (v0 t0)
321 -- t1' = Tetrahedron cube (v3 t1) (v2 t1) (v0 t1) (v1 t1)
322
323
324 -- -- | Given in Sorokina and Zeilfelder, p. 80.
325 -- prop_c0111_identity :: Cube -> Bool
326 -- prop_c0111_identity cube =
327 -- c t0' 0 1 1 1 ~= (c t0' 1 0 1 1 + c t1' 1 0 1 1) / 2
328 -- where
329 -- t0 = tetrahedron0 (face0 cube)
330 -- t1 = tetrahedron0 (face2 (top cube))
331 -- t0' = Tetrahedron cube (v3 t0) (v2 t0) (v1 t0) (v0 t0)
332 -- t1' = Tetrahedron cube (v3 t1) (v2 t1) (v0 t1) (v1 t1)
333
334
335 -- -- | Given in Sorokina and Zeilfelder, p. 80.
336 -- prop_c0210_identity2 :: Cube -> Bool
337 -- prop_c0210_identity2 cube =
338 -- c t0 0 2 1 0 ~= (c t0 1 1 1 0 + c t1 1 1 1 0) / 2
339 -- where
340 -- t0 = tetrahedron0 (face0 cube)
341 -- t1 = tetrahedron0 (face2 (top cube))
342 -- t0' = Tetrahedron cube (v3 t0) (v2 t0) (v1 t0) (v0 t0)
343 -- t1' = Tetrahedron cube (v3 t1) (v2 t1) (v0 t1) (v1 t1)
344
345
346 -- -- | Given in Sorokina and Zeilfelder, p. 80.
347 -- prop_c0201_identity2 :: Cube -> Bool
348 -- prop_c0201_identity2 cube =
349 -- c t0 0 2 0 1 ~= (c t0 1 1 0 1 + c t1 1 1 0 1) / 2
350 -- where
351 -- t0 = tetrahedron0 (face0 cube)
352 -- t1 = tetrahedron0 (face2 (top cube))
353 -- t0' = Tetrahedron cube (v3 t0) (v2 t0) (v1 t0) (v0 t0)
354 -- t1' = Tetrahedron cube (v3 t1) (v2 t1) (v0 t1) (v1 t1)
355
356
357 -- -- | Given in Sorokina and Zeilfelder, p. 80.
358 -- prop_c0300_identity3 :: Cube -> Bool
359 -- prop_c0300_identity3 cube =
360 -- c t0 0 3 0 0 ~= (c t0 1 2 0 0 + c t1 1 2 0 0) / 2
361 -- where
362 -- t0 = tetrahedron0 (face0 cube)
363 -- t1 = tetrahedron0 (face2 (top cube))
364 -- t0' = Tetrahedron cube (v3 t0) (v2 t0) (v1 t0) (v0 t0)
365 -- t1' = Tetrahedron cube (v3 t1) (v2 t1) (v0 t1) (v1 t1)