]> gitweb.michael.orlitzky.com - spline3.git/commitdiff
Add tests/code for tetrahedron 12 through 15.
authorMichael Orlitzky <michael@orlitzky.com>
Sat, 7 May 2011 21:17:24 +0000 (17:17 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Sat, 7 May 2011 21:17:24 +0000 (17:17 -0400)
src/Cube.hs
src/Tests/Cube.hs
test/TestSuite.hs

index 8287177ed17edf6307a9517d06e11548320fa7da..4c70a4126c7778e711806d200f3811d64c84c261 100644 (file)
@@ -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,
index 4a119c26433e3e0b5f7de303267face1006d6de8..1df642fea96b6fab5163913a96fe735a168fcbfb 100644 (file)
@@ -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
index a73480d87205b8201765e08283dad9adefe48dae..057468bea163da80683cb5abf45ac6fe2b8b658e 100644 (file)
@@ -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