public Node( Node original ) { //location = original.location; level = original.level; data = original.data; if ( original.IsLeaf() ) BecomeLeaf(); else BecomeBranch(); }
private void PaintWalker( Node node, int x, int y ) { Pen pen; //paintgraphics.DrawRectangle( pen, x*20 + (5-node.Level), y*20 + (5-node.Level), 20*(1<<node.Level)-(5-node.Level)*2, 20*(1<<node.Level)-(5-node.Level)*2 ); if ( node.IsLeaf() ) { PaintNode( node, x, y ); pen = Pens.Red; } else { pen = Pens.Blue; PaintNode( node.BottomRightChild, x+1, y+1 ); PaintNode( node.BottomLeftChild, x, y+1 ); PaintNode( node.TopRightChild, x+1, y ); PaintNode( node.TopLeftChild, x, y ); } paintgraphics.DrawRectangle( pen, x*20 + 1, y*20 + 1, 20*(1<<node.Level)-2, 20*(1<<node.Level)-2 ); }
private void PopulateNode( Node node, Pixel[] leafs, ref int index ) { if ( !node.IsLeaf() ) { PopulateNode( node.BottomRightChild, leafs, ref index ); PopulateNode( node.BottomLeftChild, leafs, ref index ); PopulateNode( node.TopRightChild, leafs, ref index ); PopulateNode( node.TopLeftChild, leafs, ref index ); } else { node.Data = leafs[index++]; } }
private void BottomRightWalker( Node node, int x, int y ) { if ( node.IsLeaf() ) shadow[Lightmap.BlockSize,Lightmap.BlockSize] = node.Data.Color; else shadow[Lightmap.BlockSize,Lightmap.BlockSize] = node.TopLeftChild.Data.Color; }