KdTree-0.1: KdTree, for efficient search in K-dimensional point clouds.

Data.Trees.KdTree

Synopsis

Documentation

class Point p whereSource

Methods

dimension :: p -> IntSource

dimension returns the number of coordinates of a point.

coord :: Int -> p -> DoubleSource

coord gets the k'th coordinate, starting from 0.

dist2 :: p -> p -> DoubleSource

dist2 returns the squared distance between two points.

Instances

compareDistance :: Point p => p -> p -> p -> OrderingSource

compareDistance p a b compares the distances of a and b to p.

data KdTree point Source

Constructors

KdNode 

Fields

kdLeft :: KdTree point
 
kdPoint :: point
 
kdRight :: KdTree point
 
kdAxis :: Int
 
KdEmpty 

Instances

Functor KdTree 
Foldable KdTree 
Eq point => Eq (KdTree point) 
Ord point => Ord (KdTree point) 
Show point => Show (KdTree point) 

fromList :: Point p => [p] -> KdTree pSource

toList :: KdTree p -> [p]Source

invariant :: Point p => KdTree p -> BoolSource

invariant tells whether the KD tree property holds for a given tree and all its subtrees. Specifically, it tests that all points in the left subtree lie to the left of the plane, p is on the plane, and all points in the right subtree lie to the right.