-- 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.5.4.3

module Data.Octree

-- | Datatype for nodes within Octree.
data Octree a
data Vector3 :: *
Vector3 :: {-# UNPACK #-} ~Scalar -> {-# UNPACK #-} ~Scalar -> {-# UNPACK #-} ~Scalar -> Vector3
[v3x] :: Vector3 -> {-# UNPACK #-} ~Scalar
[v3y] :: Vector3 -> {-# UNPACK #-} ~Scalar
[v3z] :: Vector3 -> {-# UNPACK #-} ~Scalar

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

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

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

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

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

-- | Finds nearest neighbour for a given point.
nearest :: Octree a -> Vector3 -> Maybe (Vector3, 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 -> Scalar -> Vector3 -> [(Vector3, a)]
