Add file
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
module Dodge.DownscaleSize where
|
||||||
|
|
||||||
|
downSize :: Int
|
||||||
|
{-# INLINE downSize #-}
|
||||||
|
downSize = 8
|
||||||
@@ -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'' _ = []
|
||||||
Reference in New Issue
Block a user