-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Simple unbalanced Octree for storing data about 3D points
--   
--   Octree data structure is relatively shallow data structure for space
--   partitioning.
@package Octree
@version 0.6.0.0

module Data.Octree

-- | Datatype for nodes within Octree.
data Octree a
type Vector3 = V3 Double

-- | distance between two vectors
dist :: V3 Double -> V3 Double -> Double

-- | Creates an Octree from a list of (index, payload) tuples.
fromList :: [(V3 Double, a)] -> Octree a

-- | Creates an Octree from list, trying to keep split points near centers
--   | of mass for each subtree.
toList :: Octree t -> [(V3 Double, t)]

-- | Finds a given point, if it is in the tree.
lookup :: Octree a -> V3 Double -> Maybe (V3 Double, a)

-- | Inserts a point into an Octree. | NOTE: insert accepts duplicate
--   points, but lookup would not find them - use withinRange in such case.
insert :: (V3 Double, a) -> Octree a -> Octree a

-- | Deletes a point from an Octree. | NOTE: If there are duplicate points,
--   it only deletes one of them.
delete :: (Eq a) => (V3 Double, a) -> Octree a -> Octree a

-- | Deletes a point from an Octree with the provided equality check. |
--   NOTE: If there are duplicate points, it only deletes one of them.
deleteBy :: ((V3 Double, a) -> (V3 Double, a) -> Bool) -> (V3 Double, a) -> Octree a -> Octree a

-- | Finds nearest neighbour for a given point.
nearest :: Octree a -> V3 Double -> Maybe (V3 Double, a)
depth :: Octree a -> Int
size :: Octree a -> Int

-- | Returns all points within Octree that are within a given distance from
--   argument.
withinRange :: Octree a -> Double -> V3 Double -> [(V3 Double, a)]
