Safe Haskell | Safe |
---|---|
Language | Haskell98 |
Grid shapes.
Synopsis
- type Coord = (Int, Int)
- type Size = (Int, Int)
- data Square = Square
- data Dir
- data Edge a = E a Dir
- data Dir'
- data Edge' a = E' a Dir'
- class Dual2D a where
- type Key k = (AffineSpace k, Diff k ~ (Int, Int), Ord k, FromCoord k)
- type Dual' k = (Key k, Dual2D k, Key (Dual k), Dual2D (Dual k), Dual (Dual k) ~ k)
- data C = C !Int !Int
- data N = N !Int !Int
- class FromCoord a where
- class ToCoord a where
- edge :: (AffineSpace a, Diff a ~ (Int, Int)) => a -> a -> Edge a
- edge' :: (AffineSpace a, Diff a ~ (Int, Int)) => a -> a -> Edge' a
- edgeBetween :: Dual' k => k -> k -> Edge (Dual k)
- edgeBetween' :: Dual' k => k -> k -> Edge' (Dual k)
- orient :: Edge a -> Edge' a
- ends' :: (AffineSpace a, Diff a ~ (Int, Int)) => Edge' a -> (a, a)
- revEdge :: (AffineSpace a, Diff a ~ (Int, Int)) => Edge' a -> Edge' a
- edges :: (Dual' k, Foldable f) => f k -> (k -> Bool) -> ([Edge' (Dual k)], [Edge (Dual k)])
- edgesM :: Dual' k => Map k a -> ([Edge' (Dual k)], [Edge (Dual k)])
- ends :: (AffineSpace a, Diff a ~ (Int, Int)) => Edge a -> (a, a)
- edgeSize :: [Edge N] -> Size
- unorient :: (AffineSpace a, Diff a ~ (Int, Int)) => Edge' a -> Edge a
- dualE :: Dual' a => Edge a -> Edge (Dual a)
- vertexNeighbours :: C -> [C]
- edgeNeighbours :: C -> [C]
- rows :: Map C a -> [[a]]
Documentation
A standard square grid, with cells and vertices indexed by pairs of integers in mathematical coordinates. The bottom-left corner is vertex (0, 0), the bottom-left cell is cell (0, 0).
Edge direction in a square grid, vertical or horizontal.
An edge in a square grid, going up or right from the given cell centre.
Oriented edge direction in a square grid.
An oriented edge in a square grid.
edges :: (Dual' k, Foldable f) => f k -> (k -> Bool) -> ([Edge' (Dual k)], [Edge (Dual k)]) Source #
edges
computes the outer and inner edges of a set of cells.
The set is given via fold and membership predicate, the result
is a pair (outer, inner)
of lists of edges, where the outer
edges are oriented such that the outside is to the left.
vertexNeighbours :: C -> [C] Source #
edgeNeighbours :: C -> [C] Source #