Class KDTree<T>
A KDTree class represents the root of a variable-dimension KD-Tree.
Inherited Members
Namespace:KDTree
Assembly:cs.temp.dll.dll
Syntax
public class KDTree<T> : KDNode<T>
Type Parameters
Name | Description |
---|---|
T | The generic data type we want this tree to contain. |
Remarks
This is based on this: https://bitbucket.org/rednaxela/knn-benchmark/src/tip/ags/utils/dataStructures/trees/thirdGenKD/
Constructors
KDTree(Int32)
Create a new KD-Tree given a number of dimensions.
Declaration
public KDTree(int iDimensions)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | iDimensions | The number of data sorting dimensions. i.e. 3 for a 3D point. |
KDTree(Int32, Int32)
Create a new KD-Tree given a number of dimensions and initial bucket capacity.
Declaration
public KDTree(int iDimensions, int iBucketCapacity)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | iDimensions | The number of data sorting dimensions. i.e. 3 for a 3D point. |
System.Int32 | iBucketCapacity | The default number of items that can be stored in each node. |
Methods
NearestNeighbors(Double[], DistanceFunctions, Int32, Double)
Get the nearest neighbours to a point in the kd tree using a user defined distance function.
Declaration
public NearestNeighbour<T> NearestNeighbors(double[] tSearchPoint, DistanceFunctions kDistanceFunction, int iMaxReturned, double fDistance)
Parameters
Type | Name | Description |
---|---|---|
System.Double[] | tSearchPoint | The point of interest. |
DistanceFunctions | kDistanceFunction | The distance function to use. |
System.Int32 | iMaxReturned | The maximum number of points which can be returned by the iterator. |
System.Double | fDistance | A threshold distance to apply. Optional. Negative values mean that it is not applied. |
Returns
Type | Description |
---|---|
NearestNeighbour<T> | A new nearest neighbour iterator with the given parameters. |
NearestNeighbors(Double[], Int32, Double)
Get the nearest neighbours to a point in the kd tree using a square euclidean distance function.
Declaration
public NearestNeighbour<T> NearestNeighbors(double[] tSearchPoint, int iMaxReturned, double fDistance = -1)
Parameters
Type | Name | Description |
---|---|---|
System.Double[] | tSearchPoint | The point of interest. |
System.Int32 | iMaxReturned | The maximum number of points which can be returned by the iterator. |
System.Double | fDistance | A threshold distance to apply. Optional. Negative values mean that it is not applied. |
Returns
Type | Description |
---|---|
NearestNeighbour<T> | A new nearest neighbour iterator with the given parameters. |