Various refactoring

This commit is contained in:
jgk
2021-08-17 19:08:18 +02:00
parent 807bc908d1
commit 9bdb9a227f
18 changed files with 313 additions and 191 deletions
+16 -4
View File
@@ -23,6 +23,8 @@ module Picture
, lineCol
, text
, pictures
, concatMapPic
, appendPic
, tranRot
, translate
, rotate
@@ -65,6 +67,8 @@ import Picture.Data
--import qualified Data.DList as DL
--import Graphics.Rendering.OpenGL (lineWidth, ($=))
--import Control.Lens
--import Data.Foldable
--import qualified Data.Vector.Fusion.Stream.Monadic as VS
blank :: Picture
{-# INLINE blank #-}
@@ -197,8 +201,16 @@ rotate :: Float -> Picture -> Picture
{-# INLINE rotate #-}
rotate = map . overPos . rotate3
pictures :: [Picture] -> Picture
{-# INLINE pictures #-}
concatMapPic :: Foldable t => (a -> Picture) -> t a -> Picture
{-# INLINE concatMapPic #-}
concatMapPic = concatMap
appendPic :: Picture -> Picture -> Picture
{-# INLINE appendPic #-}
appendPic = (++)
pictures :: Foldable t => t Picture -> Picture
{-# INLINABLE pictures #-}
pictures = concat
makeArc :: Float -> Point2 -> [Point2]
@@ -297,9 +309,9 @@ thickArc startA endA rad wdth
r = rad + 0.5 * wdth
w = 1 - wdth / r
thickArcHelp :: Float -> Float -> Float -> Float -> [Verx]
thickArcHelp :: Float -> Float -> Float -> Float -> Picture
{-# INLINE thickArcHelp #-}
thickArcHelp startA endA rad wdth = map f
thickArcHelp startA endA rad wdth = map f
[ (V3 0 0 0,black,V3 0 0 wdth)
,(V3 xa ya 0,black,V3 1 0 wdth)
,(V3 xb yb 0,black,V3 1 1 wdth)