]> gitweb.michael.orlitzky.com - spline3.git/commitdiff
Add the rest of the tetrahedron and tests.
authorMichael Orlitzky <michael@orlitzky.com>
Sat, 7 May 2011 22:14:46 +0000 (18:14 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Sat, 7 May 2011 22:14:46 +0000 (18:14 -0400)
src/Cube.hs
src/Tests/Cube.hs
test/TestSuite.hs

index 4c70a4126c7778e711806d200f3811d64c84c261..b44f0070f5c8be1982584897efdf605884846788 100644 (file)
@@ -161,10 +161,10 @@ left_face :: Cube -> Face.Face
 left_face c = Face.Face v0' v1' v2' v3'
     where
       delta = (1/2)*(h c)
-      v0' = (center c) + (-delta, -delta, delta)
-      v1' = (center c) + (delta, -delta, delta)
-      v2' = (center c) + (delta, -delta, -delta)
-      v3' = (center c) + (-delta, -delta, -delta)
+      v0' = (center c) + (delta, -delta, delta)
+      v1' = (center c) + (-delta, -delta, delta)
+      v2' = (center c) + (-delta, -delta, -delta)
+      v3' = (center c) + (delta, -delta, -delta)
 
 
 -- | The right (in the direction of y) face of the cube.
@@ -172,10 +172,10 @@ right_face :: Cube -> Face.Face
 right_face c = Face.Face v0' v1' v2' v3'
     where
       delta = (1/2)*(h c)
-      v0' = (center c) + (-delta, delta, -delta)
-      v1' = (center c) + (delta, delta, -delta)
-      v2' = (center c) + (delta, delta, delta)
-      v3' = (center c) + (-delta, delta, delta)
+      v0' = (center c) + (-delta, delta, delta)
+      v1' = (center c) + (delta, delta, delta)
+      v2' = (center c) + (delta, delta, -delta)
+      v3' = (center c) + (-delta, delta, -delta)
 
 
 tetrahedron0 :: Cube -> Tetrahedron
@@ -343,6 +343,94 @@ tetrahedron15 c =
       fv' = rotate (Tetrahedron.fv (tetrahedron12 c)) cwz
 
 
+tetrahedron16 :: Cube -> Tetrahedron
+tetrahedron16 c =
+    Tetrahedron fv' v0' v1' v2' v3'
+    where
+      v0' = center c
+      v1' = center (right_face c)
+      v2' = Face.v0 (right_face c)
+      v3' = Face.v1 (right_face c)
+      fv' = rotate (Tetrahedron.fv (tetrahedron0 c)) ccwz
+
+
+tetrahedron17 :: Cube -> Tetrahedron
+tetrahedron17 c =
+    Tetrahedron fv' v0' v1' v2' v3'
+    where
+      v0' = center c
+      v1' = center (right_face c)
+      v2' = Face.v1 (right_face c)
+      v3' = Face.v2 (right_face c)
+      fv' = rotate (Tetrahedron.fv (tetrahedron16 c)) cwy
+
+
+tetrahedron18 :: Cube -> Tetrahedron
+tetrahedron18 c =
+    Tetrahedron fv' v0' v1' v2' v3'
+    where
+      v0' = center c
+      v1' = center (right_face c)
+      v2' = Face.v2 (right_face c)
+      v3' = Face.v3 (right_face c)
+      fv' = rotate (Tetrahedron.fv (tetrahedron16 c)) (cwy . cwy)
+
+
+tetrahedron19 :: Cube -> Tetrahedron
+tetrahedron19 c =
+    Tetrahedron fv' v0' v1' v2' v3'
+    where
+      v0' = center c
+      v1' = center (right_face c)
+      v2' = Face.v3 (right_face c)
+      v3' = Face.v0 (right_face c)
+      fv' = rotate (Tetrahedron.fv (tetrahedron16 c)) ccwy
+
+
+tetrahedron20 :: Cube -> Tetrahedron
+tetrahedron20 c =
+    Tetrahedron fv' v0' v1' v2' v3'
+    where
+      v0' = center c
+      v1' = center (left_face c)
+      v2' = Face.v0 (left_face c)
+      v3' = Face.v1 (left_face c)
+      fv' = rotate (Tetrahedron.fv (tetrahedron0 c)) cwz
+
+
+tetrahedron21 :: Cube -> Tetrahedron
+tetrahedron21 c =
+    Tetrahedron fv' v0' v1' v2' v3'
+    where
+      v0' = center c
+      v1' = center (left_face c)
+      v2' = Face.v1 (left_face c)
+      v3' = Face.v2 (left_face c)
+      fv' = rotate (Tetrahedron.fv (tetrahedron20 c)) ccwy
+
+
+tetrahedron22 :: Cube -> Tetrahedron
+tetrahedron22 c =
+    Tetrahedron fv' v0' v1' v2' v3'
+    where
+      v0' = center c
+      v1' = center (left_face c)
+      v2' = Face.v2 (left_face c)
+      v3' = Face.v3 (left_face c)
+      fv' = rotate (Tetrahedron.fv (tetrahedron20 c)) ccwy
+
+
+tetrahedron23 :: Cube -> Tetrahedron
+tetrahedron23 c =
+    Tetrahedron fv' v0' v1' v2' v3'
+    where
+      v0' = center c
+      v1' = center (left_face c)
+      v2' = Face.v3 (left_face c)
+      v3' = Face.v0 (left_face c)
+      fv' = rotate (Tetrahedron.fv (tetrahedron20 c)) ccwy
+
+
 tetrahedrons :: Cube -> [Tetrahedron]
 tetrahedrons c =
     [tetrahedron0 c,
@@ -360,15 +448,12 @@ tetrahedrons c =
      tetrahedron12 c,
      tetrahedron13 c,
      tetrahedron14 c,
-     tetrahedron15 c
-                --  tetrahedron16 c,
-                --  tetrahedron17 c,
-                --  tetrahedron18 c,
-                --  tetrahedron19 c,
-                --  tetrahedron20 c,
-                --  tetrahedron21 c,
-                --  tetrahedron21 c,
-                --  tetrahedron22 c,
-                --  tetrahedron23 c,
-                --  tetrahedron24 c
-    ]
+     tetrahedron15 c,
+     tetrahedron16 c,
+     tetrahedron17 c,
+     tetrahedron18 c,
+     tetrahedron19 c,
+     tetrahedron20 c,
+     tetrahedron21 c,
+     tetrahedron22 c,
+     tetrahedron23 c]
index 9c21311c43cbf64ecd52b3df73a07518bcba5444..5485046ec46b934cc423bb9dedb0054eab9d289b 100644 (file)
@@ -210,3 +210,51 @@ prop_tetrahedron14_volumes_positive c =
 prop_tetrahedron15_volumes_positive :: Cube -> Bool
 prop_tetrahedron15_volumes_positive c =
     volume (tetrahedron15 c) > 0
+
+-- | This pretty much repeats the prop_all_volumes_positive property,
+--   but will let me know which tetrahedrons's vertices are disoriented.
+prop_tetrahedron16_volumes_positive :: Cube -> Bool
+prop_tetrahedron16_volumes_positive c =
+    volume (tetrahedron16 c) > 0
+
+-- | This pretty much repeats the prop_all_volumes_positive property,
+--   but will let me know which tetrahedrons's vertices are disoriented.
+prop_tetrahedron17_volumes_positive :: Cube -> Bool
+prop_tetrahedron17_volumes_positive c =
+    volume (tetrahedron17 c) > 0
+
+-- | This pretty much repeats the prop_all_volumes_positive property,
+--   but will let me know which tetrahedrons's vertices are disoriented.
+prop_tetrahedron18_volumes_positive :: Cube -> Bool
+prop_tetrahedron18_volumes_positive c =
+    volume (tetrahedron18 c) > 0
+
+-- | This pretty much repeats the prop_all_volumes_positive property,
+--   but will let me know which tetrahedrons's vertices are disoriented.
+prop_tetrahedron19_volumes_positive :: Cube -> Bool
+prop_tetrahedron19_volumes_positive c =
+    volume (tetrahedron19 c) > 0
+
+-- | This pretty much repeats the prop_all_volumes_positive property,
+--   but will let me know which tetrahedrons's vertices are disoriented.
+prop_tetrahedron20_volumes_positive :: Cube -> Bool
+prop_tetrahedron20_volumes_positive c =
+    volume (tetrahedron20 c) > 0
+
+-- | This pretty much repeats the prop_all_volumes_positive property,
+--   but will let me know which tetrahedrons's vertices are disoriented.
+prop_tetrahedron21_volumes_positive :: Cube -> Bool
+prop_tetrahedron21_volumes_positive c =
+    volume (tetrahedron21 c) > 0
+
+-- | This pretty much repeats the prop_all_volumes_positive property,
+--   but will let me know which tetrahedrons's vertices are disoriented.
+prop_tetrahedron22_volumes_positive :: Cube -> Bool
+prop_tetrahedron22_volumes_positive c =
+    volume (tetrahedron22 c) > 0
+
+-- | This pretty much repeats the prop_all_volumes_positive property,
+--   but will let me know which tetrahedrons's vertices are disoriented.
+prop_tetrahedron23_volumes_positive :: Cube -> Bool
+prop_tetrahedron23_volumes_positive c =
+    volume (tetrahedron23 c) > 0
index 057468bea163da80683cb5abf45ac6fe2b8b658e..20a2476d9b06745e14e80b34f2261bc1fd3f7be4 100644 (file)
@@ -104,6 +104,30 @@ main = do
   putStr "prop_tetrahedron15_volumes_positive... "
   quickCheckWith qc_args prop_tetrahedron15_volumes_positive
 
+  putStr "prop_tetrahedron16_volumes_positive... "
+  quickCheckWith qc_args prop_tetrahedron16_volumes_positive
+
+  putStr "prop_tetrahedron17_volumes_positive... "
+  quickCheckWith qc_args prop_tetrahedron17_volumes_positive
+
+  putStr "prop_tetrahedron18_volumes_positive... "
+  quickCheckWith qc_args prop_tetrahedron18_volumes_positive
+
+  putStr "prop_tetrahedron19_volumes_positive... "
+  quickCheckWith qc_args prop_tetrahedron19_volumes_positive
+
+  putStr "prop_tetrahedron20_volumes_positive... "
+  quickCheckWith qc_args prop_tetrahedron20_volumes_positive
+
+  putStr "prop_tetrahedron21_volumes_positive... "
+  quickCheckWith qc_args prop_tetrahedron21_volumes_positive
+
+  putStr "prop_tetrahedron22_volumes_positive... "
+  quickCheckWith qc_args prop_tetrahedron22_volumes_positive
+
+  putStr "prop_tetrahedron23_volumes_positive... "
+  quickCheckWith qc_args prop_tetrahedron23_volumes_positive
+
   putStr "prop_v0_all_equal... "
   quickCheckWith qc_args prop_v0_all_equal