Class STreeNode<TBound, TItem>
- Namespace
- Elegy.Common.SpatialCollections
- Assembly
- Elegy.Common.dll
N-dimensional tree node, stores a list of TItem
s
from its parent tree that intersect with its TBound
.
public class STreeNode<TBound, TItem> where TBound : struct
Type Parameters
- Inheritance
-
STreeNode<TBound, TItem>
- Inherited Members
Constructors
STreeNode(TBound, int)
The constructor of this tree node.
public STreeNode(TBound bound, int dimensions)
Parameters
bound
TBoundThe bounding volume to bind a subset of items to.
dimensions
intDimensionality of the tree. (2 or 3 usually)
Properties
Bound
The bounding volume of this node.
public TBound Bound { get; }
Property Value
- TBound
Children
This node's children.
public STreeNode<TBound, TItem>[] Children { get; }
Property Value
- STreeNode<TBound, TItem>[]
Combinations
How many child nodes there can be.
public int Combinations { get; }
Property Value
Dimensions
The dimensionality of this node.
public int Dimensions { get; }
Property Value
ItemIndices
The items of this node.
public IReadOnlyList<int> ItemIndices { get; }
Property Value
NumItems
Number of items currently linked to this node.
public int NumItems { get; }
Property Value
Methods
Add(int, bool)
Adds an item to the node. The unique
parameter can
affect performance and is needless if your indices are guaranteed to be unique.
public void Add(int itemIndex, bool unique = false)
Parameters
CreateChildren(List<STreeNode<TBound, TItem>>, GetChildVolumeFn)
Creates children for this node, not recursive though!
public void CreateChildren(List<STreeNode<TBound, TItem>> treeNodes, STree<TBound, TItem>.GetChildVolumeFn boundSubdivisionMethod)
Parameters
treeNodes
List<STreeNode<TBound, TItem>>boundSubdivisionMethod
STree<TBound, TItem>.GetChildVolumeFn
ForEachChildNode(Action<STreeNode<TBound, TItem>>)
Executes the method
for each child node.
public void ForEachChildNode(Action<STreeNode<TBound, TItem>> method)
Parameters
ForEachItem(IReadOnlyList<TItem>, Action<TItem>)
Executes the method
for each item.
public void ForEachItem(IReadOnlyList<TItem> treeItems, Action<TItem> method)
Parameters
treeItems
IReadOnlyList<TItem>method
Action<TItem>
IsEmpty()
Returns whether this node is empty.
public bool IsEmpty()
Returns
IsLeaf()
Returns whether this node is a leaf or not.
public bool IsLeaf()