point-octree-0.5.5.3: Point octree, with bounding boxes

Safe HaskellSafe
LanguageHaskell98

Data.Octree

Synopsis

Documentation

data Octree a Source #

Datatype for nodes within Octree.

Instances

Functor Octree Source # 

Methods

fmap :: (a -> b) -> Octree a -> Octree b #

(<$) :: a -> Octree b -> Octree a #

Foldable Octree Source # 

Methods

fold :: Monoid m => Octree m -> m #

foldMap :: Monoid m => (a -> m) -> Octree a -> m #

foldr :: (a -> b -> b) -> b -> Octree a -> b #

foldr' :: (a -> b -> b) -> b -> Octree a -> b #

foldl :: (b -> a -> b) -> b -> Octree a -> b #

foldl' :: (b -> a -> b) -> b -> Octree a -> b #

foldr1 :: (a -> a -> a) -> Octree a -> a #

foldl1 :: (a -> a -> a) -> Octree a -> a #

toList :: Octree a -> [a] #

null :: Octree a -> Bool #

length :: Octree a -> Int #

elem :: Eq a => a -> Octree a -> Bool #

maximum :: Ord a => Octree a -> a #

minimum :: Ord a => Octree a -> a #

sum :: Num a => Octree a -> a #

product :: Num a => Octree a -> a #

Traversable Octree Source # 

Methods

traverse :: Applicative f => (a -> f b) -> Octree a -> f (Octree b) #

sequenceA :: Applicative f => Octree (f a) -> f (Octree a) #

mapM :: Monad m => (a -> m b) -> Octree a -> m (Octree b) #

sequence :: Monad m => Octree (m a) -> m (Octree a) #

Show a => Show (Octree a) Source # 

Methods

showsPrec :: Int -> Octree a -> ShowS #

show :: Octree a -> String #

showList :: [Octree a] -> ShowS #

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.