Commit before removing line shader

This commit is contained in:
jgk
2021-07-22 14:50:35 +02:00
parent 5d2dde6f35
commit f044593c24
+19 -2
View File
@@ -193,11 +193,13 @@ text = Text
line :: [Point2] -> Picture
{-# INLINE line #-}
line = Line
--line = Line
line = flip thickLine 1
lineCol :: [(Point2,RGBA)] -> Picture
{-# INLINE lineCol #-}
lineCol = LineCol
--lineCol = LineCol
lineCol = flip thickLineCol 1
thickLine :: [Point2] -> Float -> Picture
{-# INLINE thickLine #-}
@@ -209,6 +211,21 @@ thickLine ps t = pictures $ f ps
f _ = []
n a b = (t*0.5) *.* errorNormalizeV 42 (vNormal (a -.- b))
thickLineCol :: [(Point2,RGBA)] -> Float -> Picture
{-# INLINE thickLineCol #-}
thickLineCol ps t = pictures $ f ps
where
f ((x,c):(y,c'):ys)
| x == y = f ((x,c):ys)
| otherwise = polygonCol
[(x +.+ n x y,c)
,(x -.- n x y,c)
,(y -.- n x y,c')
,(y +.+ n x y,c')
] : f ((y,c'):ys)
f _ = []
n a b = (t*0.5) *.* errorNormalizeV 42 (vNormal (a -.- b))
thickCircle :: Float -> Float -> Picture
{-# INLINE thickCircle #-}
thickCircle = thickArc 0 (2*pi)