43 lines
817 B
Haskell
43 lines
817 B
Haskell
module ShapePicture
|
|
( emptyBlank
|
|
, translateSPf
|
|
, translateSPz
|
|
, rotateSP
|
|
, SPic
|
|
, noPic
|
|
, noShape
|
|
, _spShape
|
|
, _spPicture
|
|
)
|
|
where
|
|
import Shape
|
|
import Picture
|
|
import Geometry
|
|
|
|
import Data.Bifunctor
|
|
|
|
type SPic = (Shape, Picture)
|
|
|
|
noPic :: Shape -> SPic
|
|
noPic sh = (sh,mempty)
|
|
|
|
noShape :: Picture -> SPic
|
|
noShape pic = (mempty,pic)
|
|
|
|
_spShape :: SPic -> Shape
|
|
_spShape = fst
|
|
_spPicture :: SPic -> Picture
|
|
_spPicture = snd
|
|
|
|
emptyBlank :: SPic
|
|
emptyBlank = (emptySH,blank)
|
|
|
|
translateSPf :: Float -> Float -> SPic -> SPic
|
|
translateSPf x y = bimap (translateSH (V3 x y 0)) (translate x y)
|
|
|
|
translateSPz :: Float -> SPic -> SPic
|
|
translateSPz z = bimap (translateSH (V3 0 0 z)) (translate3 (V3 0 0 z))
|
|
|
|
rotateSP :: Float -> SPic -> SPic
|
|
rotateSP a = bimap (rotateSH a) (rotate a)
|