Small optimisations

This commit is contained in:
jgk
2021-07-22 13:27:23 +02:00
parent 315cf780bf
commit 5d2dde6f35
5 changed files with 42 additions and 27 deletions
+4 -1
View File
@@ -251,7 +251,10 @@ anyPolyssIntersect x y = or $ polysIntersect <$> x <*> y
-- split a list into triples, forms triangles from a polygon
polyToTris :: [s] -> [s]
{-# INLINE polyToTris #-}
polyToTris (a:b:c:as) = a : intercalate [a] (zipWith (\x y->[x,y]) (b:c:as) (c:as))
polyToTris (a:as) = f a as
where
f x (y:z:ys) = x : y : z : f x (z:ys)
f _ _ = []
polyToTris _ = []
-- | Return n equidistant points on a circle with a radius of 600.