Show / Hide Table of Contents

Class KDTree<T>

A KDTree class represents the root of a variable-dimension KD-Tree.

Inheritance
System.Object
KDNode<T>
KDTree<T>
Inherited Members
KDNode<T>.iDimensions
KDNode<T>.iBucketCapacity
KDNode<T>.tPoints
KDNode<T>.tData
KDNode<T>.pLeft
KDNode<T>.pRight
KDNode<T>.iSplitDimension
KDNode<T>.fSplitValue
KDNode<T>.tMinBound
KDNode<T>.tMaxBound
KDNode<T>.bSinglePoint
KDNode<T>.Size
KDNode<T>.IsLeaf
KDNode<T>.AddPoint(Double[], T)
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ToString()
System.Object.ReferenceEquals(System.Object, System.Object)
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.

Back to top © 2017 Mapbox