X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=src%2FGrid.hs;h=d5553b426fc6c18c38438afec5d3039ee1c2a4cc;hb=610d0f0af8a802c26d51231d6e2426a72e40fd2d;hp=ca66437a6bb13b73d591b68d1b16d3ead8d60c89;hpb=3f7331f579118687cd73b977ce6aa7d401f88a09;p=spline3.git diff --git a/src/Grid.hs b/src/Grid.hs index ca66437..d5553b4 100644 --- a/src/Grid.hs +++ b/src/Grid.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE BangPatterns #-} -- | The Grid module just contains the Grid type and two constructors -- for it. We hide the main Grid constructor because we don't want -- to allow instantiation of a grid with h <= 0. @@ -21,7 +22,7 @@ import Test.QuickCheck ((==>), Positive(..), Property, choose) -import Assertions (assertAlmostEqual, assertClose, assertTrue) +import Assertions (assertAlmostEqual, assertTrue) import Comparisons ((~=)) import Cube (Cube(Cube), find_containing_tetrahedron, @@ -65,7 +66,7 @@ make_grid grid_size values -- centered on that position. If there is no cube there (i.e. the -- position is outside of the grid), it will throw an error. cube_at :: Grid -> Int -> Int -> Int -> Cube -cube_at g i j k +cube_at !g !i !j !k | i < 0 = error "i < 0 in cube_at" | i >= xsize = error "i >= xsize in cube_at" | j < 0 = error "j < 0 in cube_at" @@ -281,7 +282,7 @@ trilinear_c0_t0_tests = test_trilinear_f0_t0_v3 :: Assertion test_trilinear_f0_t0_v3 = - assertClose "v3 is correct" (v3 t) (0.5, 1.5, 1.5) + assertEqual "v3 is correct" (v3 t) (0.5, 1.5, 1.5) test_trilinear_reproduced :: Assertion