advance(it, state)

Moves state ahead to point at either the next valid position or one-off-end.



Compute the bounding cube/square for a Array of Point. The return values are the center of the bounding box and the half size of the cube.


Predicate used for iteration over an Octree. Returns true if two boxes specified by their centers and halfsizes overlap. More carefull investigation of the objects within is required to assess collision. False positives are possible.

boxesoverlap(c1, hs1, c2, hs2)

childcentersize(center, halfsize, sector) -> center, halfsize

Computes the center and halfsize of the child of the input box that resides in octant sector

childsector(point, center) -> sector

Computes the sector w.r.t. center that contains point. Sector is an Int that encodes the position of point along each axis in its bit representation

find(octree, pos, tolerance=sqrt(eps(eltype(pos))))

Return an array containing the indices of values at pos (up to a tolerance)

fitsinbox(pos, radius, center, halfsize) -> true/fasle

Finds out if the object with position (pos) and (raduis) fits inside the box. It uses the box dimension (centre, and halfsize(w/2)) to do the comparsion


itsinbox(Opjc, Objrad, boxc, boxhf, ratio) -> true/fasle

Finds out if the object with center position (Opjc) and (Objrad) fits inside the box. It uses the box dimension (boxc, and boxhf(w/2)) to do the comparsion ratio is relative to box half width, so if you want to be just within the box then ratio =1, if the boundaries of the object is slightly bigger and you still want to include them make ratio bigger ex:1.2


insert!(tree, box, center, halfsize, point, radius, id)

tree: the tree in which to insert box: the box in which to try insertion center: center of the box halfsize: 0.5 times the length of the box side point: the point at which to insert radius: the radius of the item to insert id: a unique id that identifies the inserted item uniquely

searchtree(pred, tree, bb)

Return an iterator that returns indices stores in tree that correspond to objects for which the supplied predicate holds.

pred takes an integer an returns true is the corresponding object stores in tree collides with the target object. bb is a bounding box containing the target. This bounding box is used for effiently excluding entire branches of the tree.