Improve level generation speed
This commit is contained in:
@@ -199,6 +199,17 @@ polyToTris (a:as) = go a as
|
||||
go _ _ = []
|
||||
polyToTris _ = []
|
||||
|
||||
polyToTris' :: [s] -> [s]
|
||||
{-# INLINE polyToTris' #-}
|
||||
polyToTris' [] = []
|
||||
polyToTris' (a:as) = prependTwo a as
|
||||
|
||||
prependTwo :: a -> [a] -> [a]
|
||||
prependTwo _ [] = []
|
||||
prependTwo _ [_] = []
|
||||
prependTwo sep (x:y:xs) = sep : x : y : prependTwo sep (y:xs)
|
||||
|
||||
|
||||
-- | Return n equidistant points on a circle with a radius of 600.
|
||||
nRays :: Int -> [Point2]
|
||||
nRays n = take n $ iterate (rotateV (2*pi/fromIntegral n)) (V2 600 0)
|
||||
|
||||
Reference in New Issue
Block a user