HGE2D-0.1.8.0: 2D game engine written in Haskell

Safe HaskellNone
LanguageHaskell2010

HGE2D.QuadTree

Synopsis

Documentation

data Positioned a => QuadTree a Source #

A QuadTree for faster search queries

data QuadDir Source #

Posibble directions within a branch (negative x && negative y | negative x && positive y ...)

Constructors

NN 
NP 
PN 
PP 

buildQuadTree :: Positioned a => BoundingBox -> [a] -> QuadTree a Source #

Builds a QuadTree from a list of elements with positions The BoundingBox should be the BoundingBox of the elements

calcQuadDir :: Positioned a => a -> BoundingBox -> QuadDir Source #

Helper function to decide into which sub-node a position belongs

nearestQuad :: (Positioned a, Positioned b) => a -> QuadTree b -> Maybe b Source #

Finds the nearest within the tree to the search position (if there is any)

quadTreeToList :: Positioned a => QuadTree a -> [a] Source #

Puts the elements of a QuadTree into a list