This commit is contained in:
2023-03-24 00:14:35 +00:00
parent 2bba3f7268
commit 8f727c70cf
2 changed files with 25 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
module Dodge.DownscaleSize where
downSize :: Int
{-# INLINE downSize #-}
downSize = 8
+20
View File
@@ -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'' _ = []