module Cube
where
+import Test.QuickCheck (Arbitrary(..), Gen, Positive(..), choose)
+
import Cardinal
import qualified Face (Face(Face, v0, v1, v2, v3))
import FunctionValues
deriving (Eq)
+instance Arbitrary Cube where
+ arbitrary = do
+ (Positive h') <- arbitrary :: Gen (Positive Double)
+ i' <- choose (coordmin, coordmax)
+ j' <- choose (coordmin, coordmax)
+ k' <- choose (coordmin, coordmax)
+ fv' <- arbitrary :: Gen FunctionValues
+ return (Cube h' i' j' k' fv')
+ where
+ coordmin = -268435456 -- -(2^29 / 2)
+ coordmax = 268435456 -- +(2^29 / 2)
+
+
instance Show Cube where
show c =
"Cube_" ++ subscript ++ "\n" ++
$ Tetrahedron.fv (tetrahedron0 c)
-tetrahedrons :: Cube -> [Tetrahedron]
-tetrahedrons c =
+tetrahedra :: Cube -> [Tetrahedron]
+tetrahedra c =
[tetrahedron0 c,
tetrahedron1 c,
tetrahedron2 c,
filter contains_our_point all_tetrahedra
where
contains_our_point = flip contains_point p
- all_tetrahedra = tetrahedrons c
+ all_tetrahedra = tetrahedra c