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
- delete :: Eq a => (Vector3, a) -> Octree a -> Octree a
- deleteBy :: ((Vector3, a) -> (Vector3, a) -> Bool) -> (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.

delete :: Eq a => (Vector3, a) -> Octree a -> Octree a Source #

Deletes a point from an Octree. | NOTE: If there are duplicate points, it only deletes one of them.

deleteBy :: ((Vector3, a) -> (Vector3, a) -> Bool) -> (Vector3, a) -> Octree a -> Octree a Source #

Deletes a point from an Octree with the provided equality check. | NOTE: If there are duplicate points, it only deletes one of them.