Do layer checking in picture tree
This commit is contained in:
@@ -36,6 +36,17 @@ instance Functor LTree where
|
||||
fmap f (LBranches ts) = LBranches $ (fmap (fmap f)) ts
|
||||
fmap f (LLeaf x) = LLeaf (f x)
|
||||
|
||||
data RTree a b
|
||||
= RBranches a [RTree a b]
|
||||
| RLeaf b
|
||||
instance Foldable (RTree a) where
|
||||
foldMap g (RBranches _ ts) = mconcat $ map (foldMap g) ts
|
||||
foldMap g (RLeaf x) = g x
|
||||
{-# INLINE foldMap #-}
|
||||
instance Functor (RTree a) where
|
||||
fmap f (RBranches i ts) = RBranches i $ (fmap (fmap f)) ts
|
||||
fmap f (RLeaf x) = RLeaf (f x)
|
||||
|
||||
|
||||
flat2 (x,y) = [x,y]
|
||||
flat3 (x,y,z) = [x,y,z]
|
||||
@@ -67,6 +78,7 @@ data Picture
|
||||
| Color RGBA Picture
|
||||
| Pictures [Picture]
|
||||
| OverPic (Point3 -> Point3) (Float -> Float) (Point4 -> Point4) Picture
|
||||
| OnLayer Int Picture
|
||||
|
||||
|
||||
blank :: Picture
|
||||
|
||||
Reference in New Issue
Block a user