pktree-0.2: Implementation of the PKTree spatial index data structure

Safe HaskellSafe-Infered

Data.PKTree

Description

Implementation of the PKTree spatial index data structure

The reccomended way to import this module is:

 import qualified Data.PKTree as PKTree
 pkInsert = insert K [rx,ry,..]

Synopsis

Documentation

type Point = [Float]Source

An n-dimensional point

type Rectangle = (Point, Point)Source

An n-dimensional hyperrectangle

type PKTree a = Tree (Node a)Source

A PKTree

data Node a Source

Inner nodes have rectangles, leaves are points and data

Constructors

Inner Rectangle 
Leaf Point a 

Instances

Eq a => Eq (Node a) 
Read a => Read (Node a) 
Show a => Show (Node a) 

cell :: Rectangle -> PKTree aSource

Contruct a tree with no children

pointCell :: Point -> a -> PKTree aSource

Construct a leaf node representing a point

rect :: PKTree a -> RectangleSource

Extract the rectangle from a node

insertSource

Arguments

:: Eq a 
=> Int

K, minimum number of nodes in subdivision

-> [Int]

r, number of divisions in each dimension

-> PKTree a

Root of PKTree

-> Point

Point to insert

-> a

Data that goes with point

-> PKTree a 

Insert a point into a PKTree

radiusSearchSource

Arguments

:: Point

Centre of hypercircle

-> Float

Radius of hypercircle

-> PKTree a

Tree to search in

-> [(Point, a)] 

Search for points in some hypercircle

cubeSearchSource

Arguments

:: Rectangle

Hypercube to use as bounds

-> Bool

Open hypercube?

-> PKTree a

Tree to search in

-> [(Point, a)] 

Search for points in some hypercube