Auto generate dot file with base item combinations

This commit is contained in:
2022-07-05 12:05:41 +01:00
parent 22ac8feb37
commit cd3463d3d8
8 changed files with 48 additions and 31 deletions
+18 -10
View File
@@ -1,15 +1,15 @@
{-# LANGUAGE TupleSections #-}
module ShapePicture
( emptyBlank
, translateSP
( --emptyBlank
translateSP
, translateSPf
, translateSPz
, rotateSP
, SPic
, noPic
, noShape
, _spShape
, _spPicture
-- , _spShape
-- , _spPicture
, mirrorSPyz
, mirrorSPxz
) where
@@ -25,37 +25,45 @@ type SPic = (Shape, Picture)
-- should all this be inlined/inlinable?
noPic :: Shape -> SPic
{-# INLINE noPic #-}
noPic = (,mempty)
noShape :: Picture -> SPic
{-# INLINE noShape #-}
noShape = (mempty,)
_spShape :: SPic -> Shape
_spShape = fst
_spPicture :: SPic -> Picture
_spPicture = snd
--_spShape :: SPic -> Shape
--_spShape = fst
--_spPicture :: SPic -> Picture
--_spPicture = snd
emptyBlank :: SPic
emptyBlank = mempty
--emptyBlank :: SPic
--emptyBlank = mempty
translateSPf :: Float -> Float -> SPic -> SPic
{-# INLINE translateSPf #-}
translateSPf x y = bimap (translateSH (V3 x y 0)) (translate x y)
translateSPz :: Float -> SPic -> SPic
{-# INLINE translateSPz #-}
translateSPz z = bimap (translateSH (V3 0 0 z)) (translate3 (V3 0 0 z))
translateSP :: Point3 -> SPic -> SPic
{-# INLINE translateSP #-}
translateSP v = bimap (translateSH v) (translate3 v)
rotateSP :: Float -> SPic -> SPic
{-# INLINE rotateSP #-}
rotateSP a = bimap (rotateSH a) (rotate a)
mirrorSPxz :: SPic -> SPic
{-# INLINE mirrorSPxz #-}
mirrorSPxz = bimap (S.map (over shVs reverse) . overPosSH flipy) mirrorxz
where
flipy (V3 x y z) = V3 x (negate y) z
mirrorSPyz :: SPic -> SPic
{-# INLINE mirrorSPyz #-}
mirrorSPyz = bimap (S.map (over shVs reverse) . overPosSH flipx) mirroryz
where
flipx (V3 x y z) = V3 (negate x) y z