Files
loop/src/ShapePicture.hs
T

44 lines
864 B
Haskell

{-# LANGUAGE TupleSections #-}
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)
-- should all this be inlined/inlinable?
noPic :: Shape -> SPic
noPic = (,mempty)
noShape :: Picture -> SPic
noShape = (mempty,)
_spShape :: SPic -> Shape
_spShape = fst
_spPicture :: SPic -> Picture
_spPicture = snd
emptyBlank :: SPic
emptyBlank = mempty
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)