Add new files
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user