/// <summary> /// /// </summary> /// <param name="node"></param> /// <param name="addInterval"></param> /// <returns></returns> public static Node CreateExpanded(Node node, Interval addInterval) { Interval expandInt = new Interval(addInterval); if (node != null) { expandInt.ExpandToInclude(node._interval); } Node largerNode = CreateNode(expandInt); if (node != null) { largerNode.Insert(node); } return(largerNode); }
/// <summary> /// /// </summary> /// <param name="node"></param> public virtual void Insert(Node node) { Assert.IsTrue(_interval == null || _interval.Contains(node.Interval)); int index = GetSubnodeIndex(node._interval, _centre); if (node._level == _level - 1) { Nodes[index] = node; } else { // the node is not a direct child, so make a new child node to contain it // and recursively insert the node Node childNode = CreateSubnode(index); childNode.Insert(node); Nodes[index] = childNode; } }