Class Quadtree<TItem>
- Namespace
- Elegy.Common.SpatialCollections
- Assembly
- Elegy.Common.dll
A quadtree. Dunno what you'd use it for, vegetation maybe.
public class Quadtree<TItem> : STree<Rect2, TItem>
Type Parameters
TItem
- Inheritance
-
Quadtree<TItem>
- Inherited Members
Constructors
Quadtree(Rect2, IReadOnlyList<TItem>, IsInBoundFn, ShouldSubdivideFn, bool)
Constructs a quadtree.
public Quadtree(Rect2 rootBound, IReadOnlyList<TItem> items, STree<Rect2, TItem>.IsInBoundFn isInBoundMethod, STree<Rect2, TItem>.ShouldSubdivideFn shouldSubdivideMethod, bool onlyFirstIntersection = false)
Parameters
rootBoundRect2The bounding box of the tree's root.
itemsIReadOnlyList<TItem>A list of items of the tree. Can be empty for a start, as the tree is only constructed later.
isInBoundMethodSTree<Rect2, TItem>.IsInBoundFnA method that checks whether or not an AABB of an octree node intersects with an item. Look at IsInBoundVector2().
shouldSubdivideMethodSTree<Rect2, TItem>.ShouldSubdivideFnA method that says whether or not a given node should subdivide. Look at ShouldSubdivideThreshold<TBound, TItem>(int).
onlyFirstIntersectionboolWhen collecting intersections, one (
true) or multiple (false) children will receive a reference to a given item. If you have geometric objects that happen to be inside multiple nodes, this is pretty relevant.