]> gitweb.michael.orlitzky.com - spline3.git/blobdiff - src/Tetrahedron.hs
Fix all orphan instances.
[spline3.git] / src / Tetrahedron.hs
index bcf9a0b599b9fe36098663b71966445ac602bbb6..eefbe118274993c166001733e42fc196187d90d7 100644 (file)
@@ -3,6 +3,7 @@ where
 
 import Numeric.LinearAlgebra hiding (i, scale)
 import Prelude hiding (LT)
+import Test.QuickCheck (Arbitrary(..), Gen)
 
 import Cardinal
 import FunctionValues
@@ -18,6 +19,17 @@ data Tetrahedron = Tetrahedron { fv :: FunctionValues,
                                  v3 :: Point }
                    deriving (Eq)
 
+
+instance Arbitrary Tetrahedron where
+    arbitrary = do
+      rnd_v0 <- arbitrary :: Gen Point
+      rnd_v1 <- arbitrary :: Gen Point
+      rnd_v2 <- arbitrary :: Gen Point
+      rnd_v3 <- arbitrary :: Gen Point
+      rnd_fv <- arbitrary :: Gen FunctionValues
+      return (Tetrahedron rnd_fv rnd_v0 rnd_v1 rnd_v2 rnd_v3)
+
+
 instance Show Tetrahedron where
     show t = "Tetrahedron:\n" ++
              "  fv: " ++ (show (fv t)) ++ "\n" ++