Minor cleanups

This commit is contained in:
2022-02-10 10:50:29 +00:00
parent 0a860e6f68
commit 700ab8d930
8 changed files with 26 additions and 36 deletions
+5 -5
View File
@@ -54,7 +54,7 @@ polygonWire ps = line (ps ++ [head ps])
polygon :: [Point2] -> Picture
{-# INLINE polygon #-}
polygon ps = map f $ polyToTris ps
polygon = map f . polyToTris
where
f (V2 x y) = Verx (V3 x y 0) black [] 0 polyNum
@@ -66,7 +66,7 @@ polygonZ ps z = map (f . zeroZ) $ polyToTris ps
polygonCol :: [(Point2,RGBA)] -> Picture
{-# INLINE polygonCol #-}
polygonCol vs = polyToTris $ map f vs
polygonCol = polyToTris . map f
where
f (V2 x y,col) = Verx (V3 x y 0) col [] 0 polyNum
@@ -76,7 +76,7 @@ poly3 = poly3Col . map (, black)
poly3Col :: [(Point3,RGBA)] -> Picture
{-# INLINE poly3Col #-}
poly3Col vs = map f $ polyToTris vs
poly3Col = map f . polyToTris
where
f (pos,col) = Verx pos col [] 0 polyNum
@@ -225,7 +225,7 @@ centerText s = translate (25 * (negate . fromIntegral $ length s)) 0 $ text s
text :: String -> Picture
{-# INLINE text #-}
text s = map f $ stringToList s
text = map f . stringToList
where
f (pos,col,V2 a b) = Verx pos col [a,b] 0 textNum
@@ -251,7 +251,7 @@ thickLine :: [Point2] -> Float -> Picture
{-# INLINE thickLine #-}
thickLine ps t = pictures $ f ps
where
f (x:y:ys)
f (x:y:ys)
| x == y = f (x:ys)
| otherwise = polygon [x +.+ n x y, x -.- n x y, y -.- n x y, y +.+ n x y] : f (y:ys)
f _ = []