From: Michael Orlitzky Date: Mon, 7 Nov 2011 01:05:40 +0000 (-0500) Subject: Remove the coincident vertices guards from the Tetrahedron volume function. X-Git-Tag: 0.0.1~69 X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=c02ac1bf9295e4ead58e9294af7f883a6fdcf119;p=spline3.git Remove the coincident vertices guards from the Tetrahedron volume function. --- diff --git a/doc/TODO b/doc/TODO index 9445181..14fb726 100644 --- a/doc/TODO +++ b/doc/TODO @@ -2,7 +2,4 @@ * Document everything. -* Test whether or not dropping the guards from the Tetrahedron.volume - function speeds things up (and still produces a correct result). - * Re-run hpc and remove any dead code. diff --git a/src/Tetrahedron.hs b/src/Tetrahedron.hs index 7595729..2a4227a 100644 --- a/src/Tetrahedron.hs +++ b/src/Tetrahedron.hs @@ -313,20 +313,8 @@ det p0 p1 p2 p3 = -- page 436. {-# INLINE volume #-} volume :: Tetrahedron -> Double -volume t - | v0' == v1' = 0 - | v0' == v2' = 0 - | v0' == v3' = 0 - | v1' == v2' = 0 - | v1' == v3' = 0 - | v2' == v3' = 0 - | otherwise = (1/6)*(det v0' v1' v2' v3') - where - v0' = v0 t - v1' = v1 t - v2' = v2 t - v3' = v3 t - +volume (Tetrahedron _ v0' v1' v2' v3' _) = + (1/6)*(det v0' v1' v2' v3') -- | The barycentric coordinates of a point with respect to v0. {-# INLINE b0 #-}