(->bounds x y width height)
Returns a map representing a bounding box
Returns a map representing a bounding box
(->quadtree bounds max-objects max-levels level objects nodes)
Returns a map representing a quadtree
Returns a map representing a quadtree
(get-quadrant quadtree bounds-obj)
Determine the quadrant bounds-obj
belongs to in quadtree
Determine the quadrant `bounds-obj` belongs to in `quadtree`
(insert quadtree bounds-obj)
Insert bounds-obj
into the node, returning a freshly grown quadtree.
If the node exceeds the capacity, it will split and add all objects to
their corresponding subnodes.
Insert `bounds-obj` into the node, returning a freshly grown quadtree. If the node exceeds the capacity, it will split and add all objects to their corresponding subnodes.
(insert-all quadtree bounds-objs)
Takes a quadtree
and inserts all bounds objects from the
bounds-objs vector.
Takes a `quadtree` and inserts all bounds objects from the bounds-objs vector.
(intersects? obj-a obj-b)
Takes two object bounds and returns true if they intersect.
Takes two object bounds and returns true if they intersect.
(point? {:keys [x y width height]})
Returns true if this object is a point in space as in it has no width or height
Returns true if this object is a point in space as in it has no width or height
(retrieve quadtree bounds-obj)
Retrieves a vector of all the bounds objects that could collide with
bounds-obj
in quadtree
.
Retrieves a vector of all the bounds objects that could collide with `bounds-obj` in `quadtree`.
(retrieve-intersections quadtree bounds-obj)
Returns all a vector of all the objects that collide/intersect
with bounds-obj
in the quadtree
.
Returns all a vector of all the objects that collide/intersect with `bounds-obj` in the `quadtree`.
(retrieve-points quadtree bounds-obj)
Returns a vector of all the points that collide/intersect
with bounds-obj
in the quadtree
.
Returns a vector of all the points that collide/intersect with `bounds-obj` in the `quadtree`.
(split quadtree)
Splits a quadtree
created with ->quadtree
into
4 sub-nodes returns quadtree
if this quadtree already
has four nodes. Returns nil if you passed the wrong type
or doesn't have the required keywords.
Splits a `quadtree` created with `->quadtree` into 4 sub-nodes returns `quadtree` if this quadtree already has four nodes. Returns nil if you passed the wrong type or doesn't have the required keywords.
(total-nodes quadtree)
Returns the total number of sub-trees in quadtree
. Valid
sub-trees have a vector as their value to the parent's :nodes
keyword.
Returns the total number of sub-trees in `quadtree`. Valid sub-trees have a vector as their value to the parent's :nodes keyword.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close