Octree-0.5.2: Simple unbalanced Octree for storing data about 3D points

Safe HaskellSafe-Inferred




data Octree a Source

Datatype for nodes within Octree.


dist :: Vector3 -> Vector3 -> Double Source

distance between two vectors

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.

nearest :: Octree a -> Vector3 -> Maybe (Vector3, a) Source

Finds nearest neighbour for a given point.

withinRange :: Octree a -> Scalar -> Vector3 -> [(Vector3, a)] Source

Returns all points within Octree that are within a given distance from argument.