Add new files

This commit is contained in:
2021-08-13 12:28:17 +02:00
parent 53555865f6
commit 5829c66527
21 changed files with 377 additions and 318 deletions
+29
View File
@@ -0,0 +1,29 @@
{-# LANGUAGE TemplateHaskell #-}
module PolyPic
where
--import Linear.V3
import Linear.V4
import Geometry
import Picture
import Control.Lens
data Vert = Vert
{_vtPos :: !(V2 Float)
,_vtCol :: !(V4 Float)
}
makeLenses ''Vert
type Pic2d = [Vert]
polygon2d :: [Point2] -> Pic2d
polygon2d = map f . polyToTris
where
f p = Vert p black
color2d :: RGBA -> Pic2d -> Pic2d
color2d = map . set vtCol
translate2d :: Float -> Float -> Pic2d -> Pic2d
translate2d x y = map $ over vtPos (+.+ V2 x y)