Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
- class Point p where
- compareDistance :: Point p => p -> p -> p -> Ordering
- data Point3d = Point3d {}
- data KdTree point
- fromList :: Point p => [p] -> KdTree p
- fromListWithDepth :: Point p => [p] -> Int -> KdTree p
- toList :: KdTree p -> [p]
- subtrees :: KdTree p -> [KdTree p]
- nearestNeighbor :: Point p => KdTree p -> p -> Maybe p
- nearNeighbors :: Point p => KdTree p -> Double -> p -> [p]
- isValid :: Point p => KdTree p -> Bool
- allSubtreesAreValid :: Point p => KdTree p -> Bool
- kNearestNeighbors :: (Eq p, Point p) => KdTree p -> Int -> p -> [p]
- remove :: (Eq p, Point p) => KdTree p -> p -> KdTree p
Documentation
compareDistance :: Point p => p -> p -> p -> Ordering Source #
compareDistance p a b compares the distances of a and b to p.
fromListWithDepth :: Point p => [p] -> Int -> KdTree p Source #
fromListWithDepth selects an axis based on depth so that the axis cycles through all valid values.
subtrees :: KdTree p -> [KdTree p] Source #
subtrees t returns a list containing t and all its subtrees, including the empty leaf nodes.
nearestNeighbor :: Point p => KdTree p -> p -> Maybe p Source #
nearestNeighbor tree p returns the nearest neighbor of p in tree.
nearNeighbors :: Point p => KdTree p -> Double -> p -> [p] Source #
nearNeighbors tree p returns all neighbors within distance r from p in tree.
isValid :: Point p => KdTree p -> Bool Source #
isValid tells whether the K-D tree property holds for a given tree. 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.
allSubtreesAreValid :: Point p => KdTree p -> Bool Source #
allSubtreesAreValid tells whether the K-D tree property holds for the given tree and all subtrees.