From cf7ad91b3a45ea05a8459b9461cdc99210183a20 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 26 Oct 2011 08:49:22 -0400 Subject: [PATCH] Inline Tetrahedron functions volume, b0, b1, b2, and b3 (Ben Lippmeier). --- src/Tetrahedron.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Tetrahedron.hs b/src/Tetrahedron.hs index f1614f9..a9e6c2c 100644 --- a/src/Tetrahedron.hs +++ b/src/Tetrahedron.hs @@ -308,6 +308,7 @@ det p0 p1 p2 p3 = -- | Computed using the formula from Lai & Schumaker, Definition 15.4, -- page 436. +{-# INLINE volume #-} volume :: Tetrahedron -> Double volume t | v0' == v1' = 0 @@ -325,6 +326,7 @@ volume t -- | The barycentric coordinates of a point with respect to v0. +{-# INLINE b0 #-} b0 :: Tetrahedron -> (RealFunction Point) b0 t point = (volume inner_tetrahedron) / (precomputed_volume t) where @@ -332,6 +334,7 @@ b0 t point = (volume inner_tetrahedron) / (precomputed_volume t) -- | The barycentric coordinates of a point with respect to v1. +{-# INLINE b1 #-} b1 :: Tetrahedron -> (RealFunction Point) b1 t point = (volume inner_tetrahedron) / (precomputed_volume t) where @@ -339,6 +342,7 @@ b1 t point = (volume inner_tetrahedron) / (precomputed_volume t) -- | The barycentric coordinates of a point with respect to v2. +{-# INLINE b2 #-} b2 :: Tetrahedron -> (RealFunction Point) b2 t point = (volume inner_tetrahedron) / (precomputed_volume t) where @@ -346,6 +350,7 @@ b2 t point = (volume inner_tetrahedron) / (precomputed_volume t) -- | The barycentric coordinates of a point with respect to v3. +{-# INLINE b3 #-} b3 :: Tetrahedron -> (RealFunction Point) b3 t point = (volume inner_tetrahedron) / (precomputed_volume t) where -- 2.43.2