Safe Haskell | Safe |
---|---|
Language | Haskell98 |
Synopsis
- data Octree a
- type Vector3 = V3 Double
- dist :: V3 Double -> V3 Double -> Double
- fromList :: [(V3 Double, a)] -> Octree a
- toList :: Octree t -> [(V3 Double, t)]
- lookup :: Octree a -> V3 Double -> Maybe (V3 Double, a)
- insert :: (V3 Double, a) -> Octree a -> Octree a
- delete :: Eq a => (V3 Double, a) -> Octree a -> Octree a
- deleteBy :: ((V3 Double, a) -> (V3 Double, a) -> Bool) -> (V3 Double, a) -> Octree a -> Octree a
- nearest :: Octree a -> V3 Double -> Maybe (V3 Double, a)
- depth :: Octree a -> Int
- size :: Octree a -> Int
- withinRange :: Octree a -> Double -> V3 Double -> [(V3 Double, a)]
Documentation
Datatype for nodes within Octree.
Instances
fromList :: [(V3 Double, a)] -> Octree a Source #
Creates an Octree from a list of (index, payload) tuples.
toList :: Octree t -> [(V3 Double, t)] Source #
Creates an Octree from list, trying to keep split points near centers | of mass for each subtree.
lookup :: Octree a -> V3 Double -> Maybe (V3 Double, a) Source #
Finds a given point, if it is in the tree.
insert :: (V3 Double, 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 => (V3 Double, 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 :: ((V3 Double, a) -> (V3 Double, a) -> Bool) -> (V3 Double, 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.