public Tree4(int depth, Tree4Border border) { this.depth = depth; objs = new List <NetData>(SplitSize + 1); collisonInfo = new CollisonInfo(); this.border = border; }
/// <summary> /// 分裂节点 生成四个子节点 /// </summary> /// <returns>四个子节点边界</returns> public Tree4Border[] Split() { Tree4Border[] bs = new Tree4Border[4]; bs[(int)Pos.LeftUp] = new Tree4Border(new Fixed2(center.x - size / 2, size / 2 + center.y), size / 2); bs[(int)Pos.LeftDown] = new Tree4Border(new Fixed2(center.x - size / 2, center.y - size / 2), size / 2); bs[(int)Pos.RightUp] = new Tree4Border(new Fixed2(center.x + size / 2, center.y + size / 2), size / 2); bs[(int)Pos.RightDown] = new Tree4Border(new Fixed2(center.x + size / 2, center.y - size / 2), size / 2); return(bs); }
public Tree4() { objs = new List <NetData>(SplitSize + 1); //size = MaxSize; border = new Tree4Border(new Fixed2(0, 0), new Fixed(MaxSize)); brother = new Tree4Brother(); collisonInfo = new CollisonInfo(); depth = 0; }
/// <summary> /// 初始化节点信息 /// </summary> /// <param name="depth">当前深度</param> /// <param name="border">边界类对象</param> /// <param name="brother">邻居类对象</param> public Tree4Child(int depth, Tree4Border border, Tree4Brother brother) { trees = new Tree4[4]; Tree4Border[] borders = border.Split(); for (int i = 0; i < 4; i++) { trees[i] = new Tree4(depth, borders[i]); } trees[(int)Pos.LeftUp].brother = new Tree4Brother(brother.Left, RightUp, brother.Up, LeftDown); trees[(int)Pos.LeftDown].brother = new Tree4Brother(brother.Left, RightDown, LeftUp, brother.Down); trees[(int)Pos.RightUp].brother = new Tree4Brother(LeftUp, brother.Right, brother.Up, RightDown); trees[(int)Pos.RightDown].brother = new Tree4Brother(LeftDown, brother.Right, RightUp, brother.Down); }