Safe Haskell | Safe |
---|---|

Language | Haskell98 |

- data Octree a
- data Vector3 :: * = Vector3 {}
- dist :: Vector3 -> Vector3 -> Double
- fromList :: [(Vector3, a)] -> Octree a
- toList :: Octree t -> [(Vector3, t)]
- lookup :: Octree a -> Vector3 -> Maybe (Vector3, a)
- insert :: (Vector3, a) -> Octree a -> Octree a
- nearest :: Octree a -> Vector3 -> Maybe (Vector3, a)
- depth :: Octree a -> Int
- size :: Octree a -> Int
- withinRange :: Octree a -> Scalar -> Vector3 -> [(Vector3, a)]

# Documentation

Datatype for nodes within Octree.

fromList :: [(Vector3, a)] -> Octree a Source #

Creates an Octree from a list of (index, payload) tuples.

toList :: Octree t -> [(Vector3, t)] Source #

Creates an Octree from list, trying to keep split points near centers of mass for each subtree.

lookup :: Octree a -> Vector3 -> Maybe (Vector3, a) Source #

Finds a given point, if it is in the tree.

insert :: (Vector3, a) -> Octree a -> Octree a Source #

Inserts a point into an Octree. NOTE: insert accepts duplicate points, but lookup would not find them. Use withinRange in such case.