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; }
private Node CreateSubnode( int index ) { // create a new subnode in the appropriate interval double min = 0.0; double max = 0.0; switch (index) { case 0: min = _interval.Min; max = _centre; break; case 1: min = _centre; max = _interval.Max; break; } Interval subInt = new Interval( min, max ); Node node = new Node (subInt, _level - 1); return node; }
public static Node CreateNode( Interval itemInterval ) { Key key = new Key( itemInterval ); //System.out.println("input: " + env + " binaryEnv: " + key.getEnvelope()); Node node = new Node( key.Interval, key.Level ); return node; }
void Insert( Node node ) { Debug.Assert( _interval == null || _interval.Contains( node.Interval ) ); int index = GetSubnodeIndex( node.Interval, _centre ); if ( node.Level == _level - 1 ) { _subnode[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 ); _subnode[index] = childNode; } }