public Node(Bspt bspt, int level, Leaf leafLeft) { this.bspt = bspt; if (level == bspt.treeDepth) { bspt.treeDepth = level + 1; if (bspt.treeDepth >= Bspt.MAX_TREE_DEPTH) { Console.WriteLine("BSPT tree depth too great:" + bspt.treeDepth.ToString()); } } if (leafLeft.count != Bspt.leafCountMax) { throw new NullReferenceException(); } dim = level % bspt.dimMax; leafLeft.sort(dim); Leaf leafRight = new Leaf(bspt, leafLeft, Bspt.leafCountMax / 2); minLeft = leafLeft.tuples[0].getDimensionValue(dim); maxLeft = leafLeft.tuples[leafLeft.count - 1].getDimensionValue(dim); minRight = leafRight.tuples[0].getDimensionValue(dim); maxRight = leafRight.tuples[leafRight.count - 1].getDimensionValue(dim); eleLeft = leafLeft; eleRight = leafRight; count = Bspt.leafCountMax; }
public void addTuple(int bsptIndex, Tuple tuple) { if (bsptIndex >= bspts.Length) { Bspt[] t = new Bspt[bsptIndex + 1]; Array.Copy(bspts, 0, t, 0, bspts.Length); bspts = t; } Bspt bspt = bspts[bsptIndex]; if (bspt == null) bspt = bspts[bsptIndex] = new Bspt(dimMax); bspt.addTuple(tuple); }
public void addTuple(int bsptIndex, Tuple tuple) { if (bsptIndex >= bspts.Length) { Bspt[] t = new Bspt[bsptIndex + 1]; Array.Copy(bspts, 0, t, 0, bspts.Length); bspts = t; } Bspt bspt = bspts[bsptIndex]; if (bspt == null) { bspt = bspts[bsptIndex] = new Bspt(dimMax); } bspt.addTuple(tuple); }
public Node(Bspt bspt, int level, Leaf leafLeft) { this.bspt = bspt; if (level == bspt.treeDepth) { bspt.treeDepth = level + 1; if (bspt.treeDepth >= Bspt.MAX_TREE_DEPTH) Console.WriteLine("BSPT tree depth too great:" + bspt.treeDepth.ToString()); } if (leafLeft.count != Bspt.leafCountMax) throw new NullReferenceException(); dim = level % bspt.dimMax; leafLeft.sort(dim); Leaf leafRight = new Leaf(bspt, leafLeft, Bspt.leafCountMax / 2); minLeft = leafLeft.tuples[0].getDimensionValue(dim); maxLeft = leafLeft.tuples[leafLeft.count - 1].getDimensionValue(dim); minRight = leafRight.tuples[0].getDimensionValue(dim); maxRight = leafRight.tuples[leafRight.count - 1].getDimensionValue(dim); eleLeft = leafLeft; eleRight = leafRight; count = Bspt.leafCountMax; }