| Portability | not portable |
|---|---|
| Stability | experimental |
| Maintainer | Birte Wagner, Sebastian Philipp (sebastian@spawnhost.de) |
| Safe Haskell | None |
Data.RTree
Description
R-Tree is a spartial data structure similar to Quadtrees or B-Trees.
An R-Tree is a balanced tree and optimized for lookups. This implemetation useses an R-Tree to privide a map to arbitrary values.
Some function names clash with Prelude names, therefore this module is usually
imported qualified, e.g.
import Data.RTree (RTree) import qualified Data.RTree as RT
this implemetation is incomplete at the moment. Feel free to send comments, patches or merge requests.
- data MBB
- mbb :: Double -> Double -> Double -> Double -> MBB
- data RTree a
- empty :: RTree a
- singleton :: MBB -> a -> RTree a
- insert :: MBB -> a -> RTree a -> RTree a
- union :: RTree a -> RTree a -> RTree a
- lookup :: MBB -> RTree a -> Maybe a
- lookupRange :: MBB -> RTree a -> [a]
- fromList :: [(MBB, a)] -> RTree a
- toList :: RTree a -> [(MBB, a)]
- delete :: MBB -> RTree a -> RTree a
- length :: RTree a -> Int
- null :: RTree a -> Bool
- keys :: RTree a -> [MBB]
- values :: RTree a -> [a]
Documentation
Arguments
| :: Double | x - coordinate of first point |
| -> Double | y - coordinate of first point |
| -> Double | x - coordinate of second point |
| -> Double | x - coordinate of second point |
| -> MBB |
created a minimal bounding box (or a rectangle) The first point must be smaller, than the second one. This is unchecked.
insert :: MBB -> a -> RTree a -> RTree aSource
inserts an element whith the given MBB and a value in a tree
lookupRange :: MBB -> RTree a -> [a]Source
returns all values, which are located in the given bounding box.
toList :: RTree a -> [(MBB, a)]Source
creates a list of pairs out of a tree
toList t = zip (keys t) (values t)