]> gitweb.michael.orlitzky.com - spline3.git/blobdiff - src/Cube.hs
src/Cube.hs: use explicit Prelude imports.
[spline3.git] / src / Cube.hs
index c793c1b7159000850b1365b8856f088f5f89e7e0..4992851f3f7b3f7a3358e33852b53730c9269961 100644 (file)
@@ -1,3 +1,8 @@
+-- The "tetrahedron" function pattern matches on the integers zero
+-- through twenty-three, but doesn't handle the "otherwise" case, for
+-- performance reasons.
+{-# OPTIONS_GHC -Wno-incomplete-patterns #-}
+
 module Cube (
   Cube(..),
   cube_properties,
@@ -15,16 +20,39 @@ import qualified Data.Vector as V (
   singleton,
   snoc,
   unsafeIndex)
-import Prelude hiding ( LT )
+import Prelude(
+  Bool,
+  Double,
+  Int,
+  Eq( (==) ),
+  Fractional( (/) ),
+  Maybe,
+  Num( (+), (-), (*) ),
+  Ord( (>=), (<=) ),
+  Show( show ),
+  ($),
+  (.),
+  (&&),
+  (++),
+  abs,
+  all,
+  and,
+  fromIntegral,
+  head,
+  map,
+  otherwise,
+  return,
+  tail )
 import Test.Tasty ( TestTree, testGroup )
 import Test.Tasty.QuickCheck (
-  Arbitrary(..),
+  Arbitrary( arbitrary ),
   Gen,
-  Positive(..),
+  Positive( Positive ),
   choose,
   testProperty )
 import Cardinal (
-  Cardinal(..),
+  Cardinal(F, B, L, R, D, T, FL, FR, FD, FT,
+           BL, BR, BD, BT, LD, LT, RD, RT, I),
   ccwx,
   ccwy,
   ccwz,
@@ -35,8 +63,12 @@ import Comparisons ( (~=), (~~=) )
 import qualified Face ( Face(..), center )
 import FunctionValues ( FunctionValues, eval, rotate )
 import Misc ( all_equal, disjoint )
-import Point ( Point(..), dot )
-import Tetrahedron ( Tetrahedron(..), barycenter, c, volume )
+import Point ( Point( Point ), dot )
+import Tetrahedron (
+  Tetrahedron(Tetrahedron, function_values, v0, v1, v2, v3),
+  barycenter,
+  c,
+  volume )
 
 data Cube = Cube { i  :: !Int,
                    j  :: !Int,
@@ -59,7 +91,7 @@ instance Arbitrary Cube where
         -- these numbers don't overflow 64 bits. This number is not
         -- magic in any other sense than that it does not cause test
         -- failures, while 2^23 does.
-        coordmax = 4194304 -- 2^22
+        coordmax = 4194304 :: Int -- 2^22
         coordmin = -coordmax
 
 
@@ -138,7 +170,7 @@ center cube =
 top_face :: Cube -> Face.Face
 top_face cube = Face.Face v0' v1' v2' v3'
     where
-      delta = 1/2
+      delta = (1/2) :: Double
       cc  = center cube
       v0' = cc + ( Point delta (-delta) delta )
       v1' = cc + ( Point delta delta delta )
@@ -151,7 +183,7 @@ top_face cube = Face.Face v0' v1' v2' v3'
 back_face :: Cube -> Face.Face
 back_face cube = Face.Face v0' v1' v2' v3'
     where
-      delta = 1/2
+      delta = (1/2) :: Double
       cc  = center cube
       v0' = cc + ( Point delta (-delta) (-delta) )
       v1' = cc + ( Point delta delta (-delta) )
@@ -163,7 +195,7 @@ back_face cube = Face.Face v0' v1' v2' v3'
 down_face :: Cube -> Face.Face
 down_face cube = Face.Face v0' v1' v2' v3'
     where
-      delta = 1/2
+      delta = (1/2) :: Double
       cc  = center cube
       v0' = cc + ( Point (-delta) (-delta) (-delta) )
       v1' = cc + ( Point (-delta) delta (-delta) )
@@ -176,7 +208,7 @@ down_face cube = Face.Face v0' v1' v2' v3'
 front_face :: Cube -> Face.Face
 front_face cube = Face.Face v0' v1' v2' v3'
     where
-      delta = 1/2
+      delta = (1/2) :: Double
       cc  = center cube
       v0' = cc + ( Point (-delta) (-delta) delta )
       v1' = cc + ( Point (-delta) delta delta )
@@ -187,7 +219,7 @@ front_face cube = Face.Face v0' v1' v2' v3'
 left_face :: Cube -> Face.Face
 left_face cube = Face.Face v0' v1' v2' v3'
     where
-      delta = 1/2
+      delta = (1/2) :: Double
       cc  = center cube
       v0' = cc + ( Point delta (-delta) delta )
       v1' = cc + ( Point (-delta) (-delta) delta )
@@ -199,7 +231,7 @@ left_face cube = Face.Face v0' v1' v2' v3'
 right_face :: Cube -> Face.Face
 right_face cube = Face.Face v0' v1' v2' v3'
     where
-      delta = 1/2
+      delta = (1/2) :: Double
       cc  = center cube
       v0' = cc + ( Point (-delta) delta delta)
       v1' = cc + ( Point delta  delta delta )