Various refactoring
This commit is contained in:
+9
-3
@@ -191,12 +191,18 @@ doublePair (x,y) = [(x,y),(y,x)]
|
||||
doubleV2 :: V2 a -> [V2 a]
|
||||
doubleV2 (V2 x y) = [V2 x y,V2 y x]
|
||||
-- split a list into triples, forms triangles from a polygon
|
||||
polyToTris :: [s] -> [s]
|
||||
{-# INLINE polyToTris #-}
|
||||
polyToTris (a:as) = go a as
|
||||
polyToTris'' :: [s] -> [s]
|
||||
polyToTris'' (a:as) = go a as
|
||||
where
|
||||
go !x (y:z:ys) = x : y : z : go x (z:ys)
|
||||
go _ _ = []
|
||||
polyToTris'' _ = []
|
||||
|
||||
polyToTris :: [s] -> [s]
|
||||
{-# INLINABLE polyToTris #-}
|
||||
polyToTris (x:xs) = foldr (f x) [] $ zip xs $ tail xs
|
||||
where
|
||||
f a (b,c) ls = a:b:c:ls
|
||||
polyToTris _ = []
|
||||
|
||||
polyToTris' :: [s] -> [s]
|
||||
|
||||
Reference in New Issue
Block a user