From: Michael Orlitzky Date: Sat, 7 May 2011 21:17:24 +0000 (-0400) Subject: Add tests/code for tetrahedron 12 through 15. X-Git-Tag: 0.0.1~319 X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=a73ad12eaff8510ae18ffafdefc0ae928603d5a5;p=spline3.git Add tests/code for tetrahedron 12 through 15. --- diff --git a/src/Cube.hs b/src/Cube.hs index 8287177..4c70a41 100644 --- a/src/Cube.hs +++ b/src/Cube.hs @@ -139,9 +139,9 @@ down_face :: Cube -> Face.Face down_face c = Face.Face v0' v1' v2' v3' where delta = (1/2)*(h c) - v0' = (center c) + (delta, delta, -delta) + v0' = (center c) + (-delta, -delta, -delta) v1' = (center c) + (-delta, delta, -delta) - v2' = (center c) + (-delta, -delta, -delta) + v2' = (center c) + (delta, delta, -delta) v3' = (center c) + (delta, -delta, -delta) @@ -299,6 +299,50 @@ tetrahedron11 c = fv' = rotate (Tetrahedron.fv (tetrahedron8 c)) cwx +tetrahedron12 :: Cube -> Tetrahedron +tetrahedron12 c = + Tetrahedron fv' v0' v1' v2' v3' + where + v0' = center c + v1' = center (down_face c) + v2' = Face.v0 (down_face c) + v3' = Face.v1 (down_face c) + fv' = rotate (Tetrahedron.fv (tetrahedron8 c)) cwy + + +tetrahedron13 :: Cube -> Tetrahedron +tetrahedron13 c = + Tetrahedron fv' v0' v1' v2' v3' + where + v0' = center c + v1' = center (down_face c) + v2' = Face.v1 (down_face c) + v3' = Face.v2 (down_face c) + fv' = rotate (Tetrahedron.fv (tetrahedron12 c)) ccwz + + +tetrahedron14 :: Cube -> Tetrahedron +tetrahedron14 c = + Tetrahedron fv' v0' v1' v2' v3' + where + v0' = center c + v1' = center (down_face c) + v2' = Face.v2 (down_face c) + v3' = Face.v3 (down_face c) + fv' = rotate (Tetrahedron.fv (tetrahedron13 c)) (ccwz . ccwz) + + +tetrahedron15 :: Cube -> Tetrahedron +tetrahedron15 c = + Tetrahedron fv' v0' v1' v2' v3' + where + v0' = center c + v1' = center (down_face c) + v2' = Face.v3 (down_face c) + v3' = Face.v0 (down_face c) + fv' = rotate (Tetrahedron.fv (tetrahedron12 c)) cwz + + tetrahedrons :: Cube -> [Tetrahedron] tetrahedrons c = [tetrahedron0 c, @@ -312,11 +356,11 @@ tetrahedrons c = tetrahedron8 c, tetrahedron9 c, tetrahedron10 c, - tetrahedron11 c - --tetrahedron12 c, - -- tetrahedron13 c, - -- tetrahedron14 c, - -- tetrahedron15 c, + tetrahedron11 c, + tetrahedron12 c, + tetrahedron13 c, + tetrahedron14 c, + tetrahedron15 c -- tetrahedron16 c, -- tetrahedron17 c, -- tetrahedron18 c, diff --git a/src/Tests/Cube.hs b/src/Tests/Cube.hs index 4a119c2..1df642f 100644 --- a/src/Tests/Cube.hs +++ b/src/Tests/Cube.hs @@ -186,3 +186,27 @@ prop_tetrahedron10_volumes_positive c = prop_tetrahedron11_volumes_positive :: Cube -> Bool prop_tetrahedron11_volumes_positive c = volume (tetrahedron11 c) > 0 + +-- | This pretty much repeats the prop_all_volumes_positive property, +-- but will let me know which tetrahedrons's vertices are disoriented. +prop_tetrahedron12_volumes_positive :: Cube -> Bool +prop_tetrahedron12_volumes_positive c = + volume (tetrahedron12 c) > 0 + +-- | This pretty much repeats the prop_all_volumes_positive property, +-- but will let me know which tetrahedrons's vertices are disoriented. +prop_tetrahedron13_volumes_positive :: Cube -> Bool +prop_tetrahedron13_volumes_positive c = + volume (tetrahedron13 c) > 0 + +-- | This pretty much repeats the prop_all_volumes_positive property, +-- but will let me know which tetrahedrons's vertices are disoriented. +prop_tetrahedron14_volumes_positive :: Cube -> Bool +prop_tetrahedron14_volumes_positive c = + volume (tetrahedron14 c) > 0 + +-- | This pretty much repeats the prop_all_volumes_positive property, +-- but will let me know which tetrahedrons's vertices are disoriented. +prop_tetrahedron15_volumes_positive :: Cube -> Bool +prop_tetrahedron15_volumes_positive c = + volume (tetrahedron15 c) > 0 diff --git a/test/TestSuite.hs b/test/TestSuite.hs index a73480d..057468b 100644 --- a/test/TestSuite.hs +++ b/test/TestSuite.hs @@ -92,6 +92,18 @@ main = do putStr "prop_tetrahedron11_volumes_positive... " quickCheckWith qc_args prop_tetrahedron11_volumes_positive + putStr "prop_tetrahedron12_volumes_positive... " + quickCheckWith qc_args prop_tetrahedron12_volumes_positive + + putStr "prop_tetrahedron13_volumes_positive... " + quickCheckWith qc_args prop_tetrahedron13_volumes_positive + + putStr "prop_tetrahedron14_volumes_positive... " + quickCheckWith qc_args prop_tetrahedron14_volumes_positive + + putStr "prop_tetrahedron15_volumes_positive... " + quickCheckWith qc_args prop_tetrahedron15_volumes_positive + putStr "prop_v0_all_equal... " quickCheckWith qc_args prop_v0_all_equal