X-Git-Url: https://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=src%2FCube.hs;h=1e83a3e690d4a6b0f39cdc0b0025526650aa81db;hb=2da1ed2fd5929baa129812632068540a3c38a253;hp=077fbbc50180ffbea5e6e000060ae990545fa429;hpb=3d197ab1a23d654d60617db6559daed195f1e016;p=spline3.git diff --git a/src/Cube.hs b/src/Cube.hs index 077fbbc..1e83a3e 100644 --- a/src/Cube.hs +++ b/src/Cube.hs @@ -15,8 +15,7 @@ data Cube = Cube { h :: Double, i :: Int, j :: Int, k :: Int, - fv :: FunctionValues, - tetrahedra_volume :: Double } + fv :: FunctionValues } deriving (Eq) @@ -27,8 +26,7 @@ instance Arbitrary Cube where j' <- choose (coordmin, coordmax) k' <- choose (coordmin, coordmax) fv' <- arbitrary :: Gen FunctionValues - (Positive tet_vol) <- arbitrary :: Gen (Positive Double) - return (Cube h' i' j' k' fv' tet_vol) + return (Cube h' i' j' k' fv') where coordmin = -268435456 -- -(2^29 / 2) coordmax = 268435456 -- +(2^29 / 2) @@ -53,7 +51,7 @@ instance Show Cube where -- | Returns an empty 'Cube'. empty_cube :: Cube -empty_cube = Cube 0 0 0 0 empty_values 0 +empty_cube = Cube 0 0 0 0 empty_values -- | The left-side boundary of the cube. See Sorokina and Zeilfelder, @@ -199,73 +197,74 @@ right_face c = Face.Face v0' v1' v2' v3' v3' = (center c) + (-delta, delta, -delta) -make_tetrahedron :: Cube -> Point -> Point -> Point -> Point -> Tetrahedron -make_tetrahedron c v0 v1 v2 v3 = - Tetrahedron (Cube.fv c) v0 v1 v2 v3 (tetrahedra_volume c) - - tetrahedron0 :: Cube -> Tetrahedron tetrahedron0 c = - make_tetrahedron c v0' v1' v2' v3' + Tetrahedron (Cube.fv c) v0' v1' v2' v3' vol where v0' = center c v1' = center (front_face c) v2' = Face.v0 (front_face c) v3' = Face.v1 (front_face c) + vol = 0 tetrahedron1 :: Cube -> Tetrahedron tetrahedron1 c = - make_tetrahedron c v0' v1' v2' v3' + Tetrahedron fv' v0' v1' v2' v3' vol where v0' = center c v1' = center (front_face c) v2' = Face.v1 (front_face c) v3' = Face.v2 (front_face c) fv' = rotate ccwx (Cube.fv c) + vol = 0 tetrahedron2 :: Cube -> Tetrahedron tetrahedron2 c = - make_tetrahedron c v0' v1' v2' v3' + Tetrahedron fv' v0' v1' v2' v3' vol where v0' = center c v1' = center (front_face c) v2' = Face.v2 (front_face c) v3' = Face.v3 (front_face c) fv' = rotate ccwx $ rotate ccwx $ Cube.fv c + vol = 0 tetrahedron3 :: Cube -> Tetrahedron tetrahedron3 c = - make_tetrahedron c v0' v1' v2' v3' + Tetrahedron fv' v0' v1' v2' v3' vol where v0' = center c v1' = center (front_face c) v2' = Face.v3 (front_face c) v3' = Face.v0 (front_face c) fv' = rotate cwx (Cube.fv c) + vol = 0 tetrahedron4 :: Cube -> Tetrahedron tetrahedron4 c = - make_tetrahedron c v0' v1' v2' v3' + Tetrahedron fv' v0' v1' v2' v3' vol where v0' = center c v1' = center (top_face c) v2' = Face.v0 (top_face c) v3' = Face.v1 (top_face c) fv' = rotate cwy (Cube.fv c) + vol = 0 tetrahedron5 :: Cube -> Tetrahedron tetrahedron5 c = - make_tetrahedron c v0' v1' v2' v3' + Tetrahedron fv' v0' v1' v2' v3' vol where v0' = center c v1' = center (top_face c) v2' = Face.v1 (top_face c) v3' = Face.v2 (top_face c) fv' = rotate cwy $ rotate cwz $ Tetrahedron.fv (tetrahedron0 c) + vol = 0 tetrahedron6 :: Cube -> Tetrahedron tetrahedron6 c = - make_tetrahedron c v0' v1' v2' v3' + Tetrahedron fv' v0' v1' v2' v3' vol where v0' = center c v1' = center (top_face c) @@ -274,30 +273,33 @@ tetrahedron6 c = fv' = rotate cwy $ rotate cwz $ rotate cwz $ Tetrahedron.fv (tetrahedron0 c) + vol = 0 tetrahedron7 :: Cube -> Tetrahedron tetrahedron7 c = - make_tetrahedron c v0' v1' v2' v3' + Tetrahedron fv' v0' v1' v2' v3' vol where v0' = center c v1' = center (top_face c) v2' = Face.v3 (top_face c) v3' = Face.v0 (top_face c) fv' = rotate cwy $ rotate ccwz $ Tetrahedron.fv (tetrahedron0 c) + vol = 0 tetrahedron8 :: Cube -> Tetrahedron tetrahedron8 c = - make_tetrahedron c v0' v1' v2' v3' + Tetrahedron fv' v0' v1' v2' v3' vol where v0' = center c v1' = center (back_face c) v2' = Face.v0 (back_face c) v3' = Face.v1 (back_face c) fv' = rotate cwy $ rotate cwy $ Tetrahedron.fv (tetrahedron0 c) + vol = 0 tetrahedron9 :: Cube -> Tetrahedron tetrahedron9 c = - make_tetrahedron c v0' v1' v2' v3' + Tetrahedron fv' v0' v1' v2' v3' vol where v0' = center c v1' = center (back_face c) @@ -306,10 +308,11 @@ tetrahedron9 c = fv' = rotate cwy $ rotate cwy $ rotate cwx $ Tetrahedron.fv (tetrahedron0 c) + vol = 0 tetrahedron10 :: Cube -> Tetrahedron tetrahedron10 c = - make_tetrahedron c v0' v1' v2' v3' + Tetrahedron fv' v0' v1' v2' v3' vol where v0' = center c v1' = center (back_face c) @@ -320,10 +323,11 @@ tetrahedron10 c = $ rotate cwx $ Tetrahedron.fv (tetrahedron0 c) + vol = 0 tetrahedron11 :: Cube -> Tetrahedron tetrahedron11 c = - make_tetrahedron c v0' v1' v2' v3' + Tetrahedron fv' v0' v1' v2' v3' vol where v0' = center c v1' = center (back_face c) @@ -332,33 +336,36 @@ tetrahedron11 c = fv' = rotate cwy $ rotate cwy $ rotate ccwx $ Tetrahedron.fv (tetrahedron0 c) + vol = 0 tetrahedron12 :: Cube -> Tetrahedron tetrahedron12 c = - make_tetrahedron c v0' v1' v2' v3' + Tetrahedron fv' v0' v1' v2' v3' vol where v0' = center c v1' = center (down_face c) v2' = Face.v0 (down_face c) v3' = Face.v1 (down_face c) fv' = rotate ccwy (Tetrahedron.fv (tetrahedron0 c)) + vol = 0 tetrahedron13 :: Cube -> Tetrahedron tetrahedron13 c = - make_tetrahedron c v0' v1' v2' v3' + Tetrahedron fv' v0' v1' v2' v3' vol where v0' = center c v1' = center (down_face c) v2' = Face.v1 (down_face c) v3' = Face.v2 (down_face c) fv' = rotate ccwy $ rotate ccwz $ Tetrahedron.fv (tetrahedron0 c) + vol = 0 tetrahedron14 :: Cube -> Tetrahedron tetrahedron14 c = - make_tetrahedron c v0' v1' v2' v3' + Tetrahedron fv' v0' v1' v2' v3' vol where v0' = center c v1' = center (down_face c) @@ -367,44 +374,48 @@ tetrahedron14 c = fv' = rotate ccwy $ rotate ccwz $ rotate ccwz $ Tetrahedron.fv (tetrahedron0 c) + vol = 0 tetrahedron15 :: Cube -> Tetrahedron tetrahedron15 c = - make_tetrahedron c v0' v1' v2' v3' + Tetrahedron fv' v0' v1' v2' v3' vol where v0' = center c v1' = center (down_face c) v2' = Face.v3 (down_face c) v3' = Face.v0 (down_face c) fv' = rotate ccwy $ rotate cwz $ Tetrahedron.fv (tetrahedron0 c) + vol = 0 tetrahedron16 :: Cube -> Tetrahedron tetrahedron16 c = - make_tetrahedron c v0' v1' v2' v3' + Tetrahedron fv' v0' v1' v2' v3' vol where v0' = center c v1' = center (right_face c) v2' = Face.v0 (right_face c) v3' = Face.v1 (right_face c) fv' = rotate ccwz (Tetrahedron.fv (tetrahedron0 c)) + vol = 0 tetrahedron17 :: Cube -> Tetrahedron tetrahedron17 c = - make_tetrahedron c v0' v1' v2' v3' + Tetrahedron fv' v0' v1' v2' v3' vol where v0' = center c v1' = center (right_face c) v2' = Face.v1 (right_face c) v3' = Face.v2 (right_face c) fv' = rotate ccwz $ rotate cwy $ Tetrahedron.fv (tetrahedron0 c) + vol = 0 tetrahedron18 :: Cube -> Tetrahedron tetrahedron18 c = - make_tetrahedron c v0' v1' v2' v3' + Tetrahedron fv' v0' v1' v2' v3' vol where v0' = center c v1' = center (right_face c) @@ -413,11 +424,12 @@ tetrahedron18 c = fv' = rotate ccwz $ rotate cwy $ rotate cwy $ Tetrahedron.fv (tetrahedron0 c) + vol = 0 tetrahedron19 :: Cube -> Tetrahedron tetrahedron19 c = - make_tetrahedron c v0' v1' v2' v3' + Tetrahedron fv' v0' v1' v2' v3' vol where v0' = center c v1' = center (right_face c) @@ -425,33 +437,36 @@ tetrahedron19 c = v3' = Face.v0 (right_face c) fv' = rotate ccwz $ rotate ccwy $ Tetrahedron.fv (tetrahedron0 c) + vol = 0 tetrahedron20 :: Cube -> Tetrahedron tetrahedron20 c = - make_tetrahedron c v0' v1' v2' v3' + Tetrahedron fv' v0' v1' v2' v3' vol where v0' = center c v1' = center (left_face c) v2' = Face.v0 (left_face c) v3' = Face.v1 (left_face c) fv' = rotate cwz (Tetrahedron.fv (tetrahedron0 c)) + vol = 0 tetrahedron21 :: Cube -> Tetrahedron tetrahedron21 c = - make_tetrahedron c v0' v1' v2' v3' + Tetrahedron fv' v0' v1' v2' v3' vol where v0' = center c v1' = center (left_face c) v2' = Face.v1 (left_face c) v3' = Face.v2 (left_face c) fv' = rotate cwz $ rotate ccwy $ Tetrahedron.fv (tetrahedron0 c) + vol = 0 tetrahedron22 :: Cube -> Tetrahedron tetrahedron22 c = - make_tetrahedron c v0' v1' v2' v3' + Tetrahedron fv' v0' v1' v2' v3' vol where v0' = center c v1' = center (left_face c) @@ -460,11 +475,12 @@ tetrahedron22 c = fv' = rotate cwz $ rotate ccwy $ rotate ccwy $ Tetrahedron.fv (tetrahedron0 c) + vol = 0 tetrahedron23 :: Cube -> Tetrahedron tetrahedron23 c = - make_tetrahedron c v0' v1' v2' v3' + Tetrahedron fv' v0' v1' v2' v3' vol where v0' = center c v1' = center (left_face c) @@ -472,6 +488,7 @@ tetrahedron23 c = v3' = Face.v0 (left_face c) fv' = rotate cwz $ rotate cwy $ Tetrahedron.fv (tetrahedron0 c) + vol = 0 tetrahedra :: Cube -> [Tetrahedron]