From c02ac1bf9295e4ead58e9294af7f883a6fdcf119 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sun, 6 Nov 2011 20:05:40 -0500 Subject: [PATCH] Remove the coincident vertices guards from the Tetrahedron volume function. --- doc/TODO | 3 --- src/Tetrahedron.hs | 16 ++-------------- 2 files changed, 2 insertions(+), 17 deletions(-) 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 #-} -- 2.43.2