+{-# LANGUAGE BangPatterns #-}
module Tetrahedron (
Tetrahedron(..),
b0, -- Cube test
data Tetrahedron =
Tetrahedron { function_values :: FunctionValues,
- v0 :: Point,
- v1 :: Point,
- v2 :: Point,
- v3 :: Point,
- precomputed_volume :: Double
+ v0 :: !Point,
+ v1 :: !Point,
+ v2 :: !Point,
+ v3 :: !Point,
+ precomputed_volume :: !Double
}
deriving (Eq)
center (Tetrahedron _ v0' v1' v2' v3' _) =
(v0' + v1' + v2' + v3') `scale` (1/4)
+ -- contains_point is only used in tests.
contains_point t p0 =
b0_unscaled `nearly_ge` 0 &&
b1_unscaled `nearly_ge` 0 &&
-- Zeilfelder, pp. 84-86. If incorrect indices are supplied, the
-- function will simply error.
c :: Tetrahedron -> Int -> Int -> Int -> Int -> Double
-c t i j k l =
+c !t !i !j !k !l =
coefficient i j k l
where
fvs = function_values t