/// <summary> /// Create empty kd-tree /// </summary> /// <param name="dimensions"></param> /// <param name="policy"></param> public KdTree(int dimensions, Subdivision.ISubdivisionPolicy policy) { _subdiv_policy = policy; _root = new KdNode <T>(); this.InitializeNode(_root, dimensions); _cls = new Searches.ClosestLeafSearch <T>(_root); _count = 0; }
/// <summary> /// Instance a new kd-tree with the given collection of points and a subdivision policy. /// </summary> public KdTree(IEnumerable <T> vecs, Subdivision.ISubdivisionPolicy policy) { _subdiv_policy = policy; _root = new KdNode <T>(); this.InitializeNode(_root, vecs); _cls = new Searches.ClosestLeafSearch <T>(_root); _count = _root.Vectors.Count; this.TrySplit(_root); }
/// <summary> /// Initialize with the kd-tree node to start search at. /// </summary> public ExactSearch(KdNode <T> tree) : base(tree) { _cls = new ClosestLeafSearch <T>(tree); }