Safe Haskell | None |
---|---|
Language | Haskell98 |
- data QuadTree a
- emptyTree :: QuadTree a
- emptyNode :: QuadTree a
- takeQuadOfTree :: Quad -> QuadTree a -> Maybe (QuadTree a)
- liftToQuad :: Quad -> (QuadTree a -> QuadTree a) -> QuadTree a -> QuadTree a
- insertByPath :: [Quad] -> a -> QuadTree a -> QuadTree a
- insertByCoord :: Extent -> Coord -> a -> QuadTree a -> Maybe (QuadTree a)
- lookupNodeByPath :: [Quad] -> QuadTree a -> Maybe (QuadTree a)
- lookupByPath :: [Quad] -> QuadTree a -> Maybe a
- lookupByCoord :: forall a. Extent -> Coord -> QuadTree a -> Maybe a
- flattenQuadTree :: forall a. Extent -> QuadTree a -> [(Coord, a)]
- flattenQuadTreeWithExtents :: forall a. Extent -> QuadTree a -> [(Extent, a)]
Documentation
The quad tree structure.
takeQuadOfTree :: Quad -> QuadTree a -> Maybe (QuadTree a) Source
Get a quadrant from a node.
If the tree does not have an outer node then Nothing
.
liftToQuad :: Quad -> (QuadTree a -> QuadTree a) -> QuadTree a -> QuadTree a Source
Apply a function to a quadrant of a node. If the tree does not have an outer node then return the original tree.
insertByPath :: [Quad] -> a -> QuadTree a -> QuadTree a Source
Insert a value into the tree at the position given by a path.
If the path intersects an existing TLeaf
then return the original tree.
insertByCoord :: Extent -> Coord -> a -> QuadTree a -> Maybe (QuadTree a) Source
Insert a value into the node containing this coordinate.
The node is created at maximum depth, corresponding to an unit Extent
.
lookupNodeByPath :: [Quad] -> QuadTree a -> Maybe (QuadTree a) Source
Lookup a node based on a path to it.
lookupByPath :: [Quad] -> QuadTree a -> Maybe a Source
Lookup an element based given a path to it.
:: Extent | Extent that covers the whole tree. |
-> Coord | Coordinate of the value of interest. |
-> QuadTree a | |
-> Maybe a |
Lookup a node if a tree given a coordinate which it contains.
Flatten a QuadTree into a list of its contained values, with coordinates.
flattenQuadTreeWithExtents Source
Flatten a QuadTree into a list of its contained values, with coordinates.