Add wall placement obstructions, start to generalise pictures
This commit is contained in:
+13
-8
@@ -58,22 +58,27 @@ polygonWire :: [Point2] -> Picture
|
||||
{-# INLINE polygonWire #-}
|
||||
polygonWire ps = line (ps ++ [head ps])
|
||||
|
||||
picFormat :: [Verx] -> Picture
|
||||
picFormat = S.each
|
||||
|
||||
-- | Expects clockwise input.
|
||||
polygon :: [Point2] -> Picture
|
||||
{-# INLINE polygon #-}
|
||||
polygon = S.each . map f . polyToTris
|
||||
polygon = picFormat . map f . polyToTris
|
||||
where
|
||||
f (V2 x y) = Verx (V3 x y 0) black [] BottomLayer polyNum
|
||||
|
||||
|
||||
|
||||
polygonZ :: [Point2] -> Float -> Picture
|
||||
{-# INLINE polygonZ #-}
|
||||
polygonZ ps z = S.each . map (f . zeroZ) $ polyToTris ps
|
||||
polygonZ ps z = picFormat . map (f . zeroZ) $ polyToTris ps
|
||||
where
|
||||
f pos = Verx pos black [z] BottomLayer polyzNum
|
||||
|
||||
polygonCol :: [(Point2,RGBA)] -> Picture
|
||||
{-# INLINE polygonCol #-}
|
||||
polygonCol = S.each . polyToTris . map f
|
||||
polygonCol = picFormat . polyToTris . map f
|
||||
where
|
||||
f (V2 x y,col) = Verx (V3 x y 0) col [] BottomLayer polyNum
|
||||
|
||||
@@ -83,7 +88,7 @@ poly3 = poly3Col . map (, black)
|
||||
|
||||
poly3Col :: [(Point3,RGBA)] -> Picture
|
||||
{-# INLINE poly3Col #-}
|
||||
poly3Col = S.each . map f . polyToTris
|
||||
poly3Col = picFormat . map f . polyToTris
|
||||
where
|
||||
f (pos,col) = Verx pos col [] BottomLayer polyNum
|
||||
|
||||
@@ -122,7 +127,7 @@ bezierQuad cola colc ra rc a b c
|
||||
fc' = extrapolate cIn aIn bIn
|
||||
|
||||
bzhelp :: [(Point2, Point4, Point2, Point2)] -> Picture
|
||||
bzhelp = S.each . map f
|
||||
bzhelp = picFormat . map f
|
||||
where
|
||||
f (V2 x y,col,V2 a b,V2 c d) = Verx (V3 x y 0) col [a,b,c,d] BottomLayer bezNum
|
||||
|
||||
@@ -215,7 +220,7 @@ circleSolid = circleSolidCol white white
|
||||
|
||||
circleSolidCol :: Color -> Color -> Float -> Picture
|
||||
{-# INLINE circleSolidCol #-}
|
||||
circleSolidCol colC colE r = S.each $ map f
|
||||
circleSolidCol colC colE r = picFormat $ map f
|
||||
[(V3 (-r) r 0, colC)
|
||||
,(V3 (-r) (-r) 0, colE)
|
||||
,(V3 r (-r) 0, black)
|
||||
@@ -237,7 +242,7 @@ stackText = mconcat . zipWith (\y s -> translate 0 y $ centerText s) [0,100..]
|
||||
|
||||
text :: String -> Picture
|
||||
{-# INLINE text #-}
|
||||
text = S.each . map f . stringToList
|
||||
text = picFormat . map f . stringToList
|
||||
where
|
||||
f (pos,col,V2 a b) = Verx pos col [a,b] BottomLayer textNum
|
||||
|
||||
@@ -319,7 +324,7 @@ thickArc startA endA rad wdth
|
||||
|
||||
thickArcHelp :: Float -> Float -> Float -> Float -> Picture
|
||||
{-# INLINE thickArcHelp #-}
|
||||
thickArcHelp startA endA rad wdth = S.each $ map f
|
||||
thickArcHelp startA endA rad wdth = picFormat $ 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)
|
||||
|
||||
@@ -46,6 +46,7 @@ textNum = ShadNum 3
|
||||
arcNum = ShadNum 4
|
||||
ellNum = ShadNum 5
|
||||
type Picture = Stream (Of Verx) IO ()
|
||||
type Picture' = [Verx]
|
||||
flat2 :: V2 a -> [a]
|
||||
flat2 (V2 x y) = [x,y]
|
||||
flat3 :: V3 a -> [a]
|
||||
|
||||
Reference in New Issue
Block a user