-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | substitution tilings -- -- Substitution tilings. The term substitution, in connection with -- tilings, describes a simple but powerful method to produce tilings -- with many interesting properties. -- -- The main idea is to use a finite set of building blocks called -- prototiles, an expanding linear map (the inflation factor), and a rule -- how to dissect each scaled tile into copies of the original -- prototiles. -- -- For some examples of substitution tilings, and a glossary of -- terminology, see the tilings encyclopedia at -- http://tilings.math.uni-bielefeld.de/ @package tilings @version 0.1 -- | Substitution tiling API. module Data.Tiling.Class -- | Substitution tilings. Instances must obey the following laws: -- --
-- parent root == Nothing -- all (== Just t) . map parent . children $ t -- t `inside` exterior t -- t `encloses` interior t -- interior t `insideR` exterior t -- t `inside` r ==> t `overlaps` r -- t `encloses` r ==> t `overlaps` r -- t `overlaps` r ==> not (t `outside` r) -- t `encloses` r && n >= 0 ==> not $ any (`outside` r) (tile t r n) ---- -- Minimal complete definition: all except tile. class Tiling t root :: Tiling t => t children :: Tiling t => t -> [t] parent :: Tiling t => t -> Maybe t exterior :: Tiling t => t -> Rectangle interior :: Tiling t => t -> Rectangle inside :: Tiling t => t -> Rectangle -> Bool encloses :: Tiling t => t -> Rectangle -> Bool outside :: Tiling t => t -> Rectangle -> Bool overlaps :: Tiling t => t -> Rectangle -> Bool tile :: Tiling t => t -> Rectangle -> Int -> [t] -- | Default implementation for tile. tileDefault :: Tiling t => t -> Rectangle -> Int -> [t] -- | An axis-aligned rectangle with Rational coordinates. -- -- Invariant: -- --
-- westEdge r <= eastEdge r && southEdge r <= northEdge r ---- -- For substitution tilings that contain irrational lengths and/or scale -- factors, the intention is that the implementations of exterior -- and interior provide reasonably tight bounds, within a percent -- or two, say, while the data type maintains full precision internally -- (perhaps using algebraic field extensions over Rational). data Rectangle Rectangle :: !Rational -> !Rational -> !Rational -> !Rational -> Rectangle northEdge :: Rectangle -> !Rational southEdge :: Rectangle -> !Rational eastEdge :: Rectangle -> !Rational westEdge :: Rectangle -> !Rational -- | Create a valid rectangle, sorting the edges to meet the invariant. rectangle :: Rational -> Rational -> Rational -> Rational -> Rectangle -- | Check if a rectangle is inside another rectangle. The comparison is -- not strict, so that a rectangle is inside itself. insideR :: Rectangle -> Rectangle -> Bool -- | Check if a rectangle is disjoint from another rectangle. The -- comparison is strict, so that neighbouring rectangles that share an -- edge will not be outside each other. outsideR :: Rectangle -> Rectangle -> Bool -- | Check if a rectangle overlaps with another rectangle. The comparison -- is not strict, so that neighbouring rectangles that share an edge will -- overlap each other. overlapsR :: Rectangle -> Rectangle -> Bool instance Typeable Rectangle instance Eq Rectangle instance Ord Rectangle instance Read Rectangle instance Show Rectangle instance Data Rectangle -- | Simple substitution tiling with each square divided into four -- quadrants (with no rotation). module Data.Tiling.Quad -- | Which quadrant. data Quadrant NorthWest :: Quadrant NorthEast :: Quadrant SouthWest :: Quadrant SouthEast :: Quadrant isNorth :: Quadrant -> Bool isSouth :: Quadrant -> Bool isWest :: Quadrant -> Bool isEast :: Quadrant -> Bool -- | All quadrants. quadrants :: [Quadrant] -- | A square tile. data Quad Quad :: !Int -> !Integer -> !Integer -> Quad quadLevel :: Quad -> !Int quadWest :: Quad -> !Integer quadNorth :: Quad -> !Integer -- | The child tile at a given quadrant. quadChild :: Quadrant -> Quad -> Quad -- | The parent with quadrant information for the tile. Satisfies: -- --
-- quadParent (quadChild c q) == Just (c, q) --quadParent :: Quad -> Maybe (Quadrant, Quad) -- | The path from this tile to the root. Satisfies: -- --
-- foldr quadChild root (quadPath q) == q --quadPath :: Quad -> [Quadrant] -- | Suggested file system location for data pertaining to a Quad. quadFile :: Quad -> Maybe ([FilePath], FilePath) instance Typeable Quad instance Typeable Quadrant instance Read Quad instance Show Quad instance Eq Quad instance Ord Quad instance Data Quad instance Read Quadrant instance Show Quadrant instance Eq Quadrant instance Ord Quadrant instance Enum Quadrant instance Bounded Quadrant instance Data Quadrant instance Tiling Quad -- | Substitution tilings. The term substitution, in connection with -- tilings, describes a simple but powerful method to produce tilings -- with many interesting properties. -- -- The main idea is to use a finite set of building blocks called -- prototiles, an expanding linear map (the inflation factor), and a rule -- how to dissect each scaled tile into copies of the original -- prototiles. -- -- For some examples of substitution tilings, and a glossary of -- terminology, see the tilings encyclopedia at -- http://tilings.math.uni-bielefeld.de/ module Data.Tiling