X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;ds=sidebyside;f=src%2FCube.hs;h=6e33423d2da3a828257b21ab85055db58b681af8;hb=7cee33b2fa4789525a12685923edf1f38924a7f4;hp=6652e8b6331f039cd90cd9c7791dab61f2fd3f58;hpb=d9eed953bd810f6928de536617dc21121a8a645b;p=spline3.git diff --git a/src/Cube.hs b/src/Cube.hs index 6652e8b..6e33423 100644 --- a/src/Cube.hs +++ b/src/Cube.hs @@ -3,11 +3,10 @@ module Cube ( cube_properties, find_containing_tetrahedron, tetrahedra, - tetrahedron - ) + tetrahedron ) where -import Data.Maybe (fromJust) +import Data.Maybe ( fromJust ) import qualified Data.Vector as V ( Vector, findIndex, @@ -15,20 +14,26 @@ import qualified Data.Vector as V ( minimum, singleton, snoc, - unsafeIndex - ) -import Prelude hiding (LT) -import Test.Framework (Test, testGroup) -import Test.Framework.Providers.QuickCheck2 (testProperty) -import Test.QuickCheck (Arbitrary(..), Gen, Positive(..), choose) - -import Cardinal -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) + unsafeIndex) +import Prelude hiding ( LT ) +import Test.Framework ( Test, testGroup ) +import Test.Framework.Providers.QuickCheck2 ( testProperty ) +import Test.QuickCheck ( Arbitrary(..), Gen, Positive(..), choose ) + +import Cardinal ( + Cardinal(..), + ccwx, + ccwy, + ccwz, + cwx, + cwy, + cwz ) +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 ) data Cube = Cube { i :: !Int, j :: !Int, @@ -603,9 +608,8 @@ find_containing_tetrahedron cube p = left_half = in_left_half cube p candidates :: V.Vector Tetrahedron - candidates = - if front_half then - + candidates + | front_half = if left_half then if top_half then front_left_top_tetrahedra cube @@ -617,8 +621,7 @@ find_containing_tetrahedron cube p = else front_right_down_tetrahedra cube - else -- bottom half - + | otherwise = -- back half if left_half then if top_half then back_left_top_tetrahedra cube @@ -976,7 +979,7 @@ prop_interior_values_all_identical cube = -- This test checks the rotation works as expected. prop_c_tilde_2100_rotation_correct :: Cube -> Bool prop_c_tilde_2100_rotation_correct cube = - expr1 == expr2 + expr1 ~= expr2 where t0 = tetrahedron cube 0 t6 = tetrahedron cube 6 @@ -1010,7 +1013,7 @@ prop_c_tilde_2100_rotation_correct cube = -- even meaningful! prop_c_tilde_2100_correct :: Cube -> Bool prop_c_tilde_2100_correct cube = - c t6 2 1 0 0 == expected + c t6 2 1 0 0 ~= expected where t0 = tetrahedron cube 0 t6 = tetrahedron cube 6