public KDTree(IEnumerable <KeyValuePair <TPoint, TValue> > points, IKDPointComparer <TPoint> comparer) : this(comparer) { if (points == null) { throw new ArgumentNullException(nameof(points)); } var pointsArray = points.ToArray(); if (pointsArray.Any(kvp => kvp.Key == null)) { throw new ArgumentNullException(nameof(points), "keys must be non-null"); } if (pointsArray.Length > 0) { this.EnsureInitialized(pointsArray[0].Key); this.root = this.BuildTree(pointsArray, 0, pointsArray.Length - 1, dimension: 0); this.Count = pointsArray.Length; } }
public PointAndValueComparer(IKDPointComparer <TPoint> comparer, int dimension) { this.comparer = comparer; this.dimension = dimension; }
public KDTree(IKDPointComparer <TPoint> comparer = null) { this.comparer = comparer; // todo null }