From: Michael Orlitzky Date: Fri, 2 Sep 2011 14:47:06 +0000 (-0400) Subject: Begin writing the precomputed_volume feature again. X-Git-Tag: 0.0.1~177 X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=2da1ed2fd5929baa129812632068540a3c38a253;p=spline3.git Begin writing the precomputed_volume feature again. --- diff --git a/src/Cube.hs b/src/Cube.hs index 0122aea..1e83a3e 100644 --- a/src/Cube.hs +++ b/src/Cube.hs @@ -199,66 +199,72 @@ right_face c = Face.Face v0' v1' v2' v3' tetrahedron0 :: Cube -> Tetrahedron tetrahedron0 c = - Tetrahedron (Cube.fv 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 = - Tetrahedron fv' 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 = - Tetrahedron fv' 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 = - Tetrahedron fv' 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 = - Tetrahedron fv' 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 = - Tetrahedron fv' 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 = - Tetrahedron fv' v0' v1' v2' v3' + Tetrahedron fv' v0' v1' v2' v3' vol where v0' = center c v1' = center (top_face c) @@ -267,30 +273,33 @@ tetrahedron6 c = fv' = rotate cwy $ rotate cwz $ rotate cwz $ Tetrahedron.fv (tetrahedron0 c) + vol = 0 tetrahedron7 :: Cube -> Tetrahedron tetrahedron7 c = - Tetrahedron fv' 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 = - Tetrahedron fv' 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 = - Tetrahedron fv' v0' v1' v2' v3' + Tetrahedron fv' v0' v1' v2' v3' vol where v0' = center c v1' = center (back_face c) @@ -299,10 +308,11 @@ tetrahedron9 c = fv' = rotate cwy $ rotate cwy $ rotate cwx $ Tetrahedron.fv (tetrahedron0 c) + vol = 0 tetrahedron10 :: Cube -> Tetrahedron tetrahedron10 c = - Tetrahedron fv' v0' v1' v2' v3' + Tetrahedron fv' v0' v1' v2' v3' vol where v0' = center c v1' = center (back_face c) @@ -313,10 +323,11 @@ tetrahedron10 c = $ rotate cwx $ Tetrahedron.fv (tetrahedron0 c) + vol = 0 tetrahedron11 :: Cube -> Tetrahedron tetrahedron11 c = - Tetrahedron fv' v0' v1' v2' v3' + Tetrahedron fv' v0' v1' v2' v3' vol where v0' = center c v1' = center (back_face c) @@ -325,33 +336,36 @@ tetrahedron11 c = fv' = rotate cwy $ rotate cwy $ rotate ccwx $ Tetrahedron.fv (tetrahedron0 c) + vol = 0 tetrahedron12 :: Cube -> Tetrahedron tetrahedron12 c = - Tetrahedron fv' 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 = - Tetrahedron fv' 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 = - Tetrahedron fv' v0' v1' v2' v3' + Tetrahedron fv' v0' v1' v2' v3' vol where v0' = center c v1' = center (down_face c) @@ -360,44 +374,48 @@ tetrahedron14 c = fv' = rotate ccwy $ rotate ccwz $ rotate ccwz $ Tetrahedron.fv (tetrahedron0 c) + vol = 0 tetrahedron15 :: Cube -> Tetrahedron tetrahedron15 c = - Tetrahedron fv' 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 = - Tetrahedron fv' 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 = - Tetrahedron fv' 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 = - Tetrahedron fv' v0' v1' v2' v3' + Tetrahedron fv' v0' v1' v2' v3' vol where v0' = center c v1' = center (right_face c) @@ -406,11 +424,12 @@ tetrahedron18 c = fv' = rotate ccwz $ rotate cwy $ rotate cwy $ Tetrahedron.fv (tetrahedron0 c) + vol = 0 tetrahedron19 :: Cube -> Tetrahedron tetrahedron19 c = - Tetrahedron fv' v0' v1' v2' v3' + Tetrahedron fv' v0' v1' v2' v3' vol where v0' = center c v1' = center (right_face c) @@ -418,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 = - Tetrahedron fv' 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 = - Tetrahedron fv' 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 = - Tetrahedron fv' v0' v1' v2' v3' + Tetrahedron fv' v0' v1' v2' v3' vol where v0' = center c v1' = center (left_face c) @@ -453,11 +475,12 @@ tetrahedron22 c = fv' = rotate cwz $ rotate ccwy $ rotate ccwy $ Tetrahedron.fv (tetrahedron0 c) + vol = 0 tetrahedron23 :: Cube -> Tetrahedron tetrahedron23 c = - Tetrahedron fv' v0' v1' v2' v3' + Tetrahedron fv' v0' v1' v2' v3' vol where v0' = center c v1' = center (left_face c) @@ -465,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] diff --git a/src/Tetrahedron.hs b/src/Tetrahedron.hs index 95233e0..eef1656 100644 --- a/src/Tetrahedron.hs +++ b/src/Tetrahedron.hs @@ -17,7 +17,8 @@ data Tetrahedron = Tetrahedron { fv :: FunctionValues, v0 :: Point, v1 :: Point, v2 :: Point, - v3 :: Point } + v3 :: Point, + precomputed_volume :: Double } deriving (Eq) @@ -28,7 +29,8 @@ instance Arbitrary Tetrahedron where 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) + rnd_vol <- arbitrary :: Gen Double + return (Tetrahedron rnd_fv rnd_v0 rnd_v1 rnd_v2 rnd_v3 rnd_vol) instance Show Tetrahedron where