diff --git a/src/Dodge/DownscaleSize.hs b/src/Dodge/DownscaleSize.hs new file mode 100644 index 000000000..69185e6e9 --- /dev/null +++ b/src/Dodge/DownscaleSize.hs @@ -0,0 +1,5 @@ +module Dodge.DownscaleSize where + +downSize :: Int +{-# INLINE downSize #-} +downSize = 8 diff --git a/src/Geometry/Triangulate.hs b/src/Geometry/Triangulate.hs new file mode 100644 index 000000000..63dadc77e --- /dev/null +++ b/src/Geometry/Triangulate.hs @@ -0,0 +1,20 @@ +{-# LANGUAGE BangPatterns #-} + +module Geometry.Triangulate where + +import Data.List + +polyToTris :: [s] -> [s] +{-# INLINEABLE polyToTris #-} +polyToTris (x : xs) = foldl' (f x) [] $ zip xs $ tail xs + where + f a ls (b, c) = a : b : c : ls +polyToTris _ = [] + +-- kept as an example benchmark +polyToTris'' :: [s] -> [s] +polyToTris'' (a : as) = go a as + where + go !x (y : z : ys) = x : y : z : go x (z : ys) + go _ _ = [] +polyToTris'' _ = []