Class KdTree<T>
Implements
System.Collections.Generic.IEnumerable
Assembly: cs.temp.dll.dll
Syntax
public class KdTree<T> : IEnumerable<T>, IEnumerable, IEnumerable where T : Component
Type Parameters
Constructors
KdTree(Boolean)
Declaration
public KdTree(bool just2D = false)
Parameters
Type |
Name |
Description |
Boolean |
just2D |
just use x/z
|
Fields
_count
Declaration
Field Value
_just2D
Declaration
Field Value
_last
Declaration
protected KdTree<T>.KdNode _last
Field Value
_LastUpdate
Declaration
protected float _LastUpdate
Field Value
_open
Declaration
protected KdTree<T>.KdNode[] _open
Field Value
_root
Declaration
protected KdTree<T>.KdNode _root
Field Value
Properties
AverageSearchDeep
Declaration
public float AverageSearchDeep { get; protected set; }
Property Value
AverageSearchLength
Declaration
public float AverageSearchLength { get; protected set; }
Property Value
Count
Declaration
public int Count { get; }
Property Value
IsReadOnly
Declaration
public bool IsReadOnly { get; }
Property Value
Item[Int32]
Declaration
public T this[int key] { get; }
Parameters
Type |
Name |
Description |
Int32 |
key |
|
Property Value
Methods
_distance(Vector3, Vector3)
Declaration
protected float _distance(Vector3 a, Vector3 b)
Parameters
Type |
Name |
Description |
Vector3 |
a |
|
Vector3 |
b |
|
Returns
_findClosest(Vector3, List<T>)
Declaration
protected T _findClosest(Vector3 position, List<T> traversed = null)
Parameters
Type |
Name |
Description |
Vector3 |
position |
|
List<T> |
traversed |
|
Returns
_getSplitValue(Int32, Vector3)
Declaration
protected float _getSplitValue(int level, Vector3 position)
Parameters
Type |
Name |
Description |
Int32 |
level |
|
Vector3 |
position |
|
Returns
Add(T)
Declaration
Parameters
Type |
Name |
Description |
T |
item |
item
|
AddAll(List<T>)
Declaration
public void AddAll(List<T> items)
Parameters
Type |
Name |
Description |
List<T> |
items |
items
|
Clear()
Declaration
CountAll(Predicate<T>)
count all objects that matches the given predicate
Declaration
public int CountAll(Predicate<T> match)
Parameters
Type |
Name |
Description |
Predicate<T> |
match |
lamda expression
|
Returns
Type |
Description |
Int32 |
matching object count
|
Find(Predicate<T>)
find first object that matches the given predicate
Declaration
public T Find(Predicate<T> match)
Parameters
Type |
Name |
Description |
Predicate<T> |
match |
lamda expression
|
Returns
FindAll(Predicate<T>)
find all objects that matches the given predicate
Declaration
public KdTree<T> FindAll(Predicate<T> match)
Parameters
Type |
Name |
Description |
Predicate<T> |
match |
lamda expression
|
Returns
FindClose(Vector3)
Find close objects to given position
Declaration
public IEnumerable<T> FindClose(Vector3 position)
Parameters
Type |
Name |
Description |
Vector3 |
position |
position
|
Returns
FindClosest(Vector3)
Find closest object to given position
Declaration
public T FindClosest(Vector3 position)
Parameters
Type |
Name |
Description |
Vector3 |
position |
position
|
Returns
Type |
Description |
T |
closest object
|
GetEnumerator()
Method to enable foreach-loops
Declaration
public IEnumerator<T> GetEnumerator()
Returns
RemoveAll(Predicate<T>)
remove all objects that matches the given predicate
Declaration
public void RemoveAll(Predicate<T> match)
Parameters
Type |
Name |
Description |
Predicate<T> |
match |
lamda expression
|
RemoveAt(Int32)
Remove at position i (position in list or loop)
Declaration
public void RemoveAt(int i)
Parameters
Type |
Name |
Description |
Int32 |
i |
|
ToList()
Declaration
Returns
Type |
Description |
List<T> |
list
|
UpdatePositions()
Update positions (if objects moved)
Declaration
public void UpdatePositions()
UpdatePositions(Single)
Update positions (if objects moved)
Declaration
public void UpdatePositions(float rate)
Parameters
Type |
Name |
Description |
Single |
rate |
Updates per second
|
Implements
System.Collections.Generic.IEnumerable