/// <summary>
    ///   Translate an octree node.
    /// </summary>
    /// <param name="root"></param>
    /// <param name="octree"></param>
    public void TranslateTree(VoxelLocation root, IOctreeVoxelMesh octree)
    {
      VoxelLocation nextRoot = new VoxelLocation();
      for (int x = 0; x < 2; ++x)
      {
        for (int y = 0; y < 2; ++y)
        {
          for (int z = 0; z < 2; ++z)
          {
            IVoxelMesh child = octree.GetChild(x, y, z);
            if (child != null)
            {
              nextRoot.Set(root).Add(
                x * octree.Width / 2,
                y * octree.Height / 2,
                z * octree.Depth / 2
              );

              if (child is IOctreeVoxelMesh)
              {
                this.TranslateTree(nextRoot, (IOctreeVoxelMesh)child);
              }
              else
              {
                this.TranslateLeaf(nextRoot, child);
              }
            }
          }
        }
      }
    }
    /// <summary>
    ///   Debug a tree node.
    /// </summary>
    /// <param name="root"></param>
    /// <param name="octree"></param>
    public void DebugTree(VoxelLocation root, IOctreeVoxelMesh octree, int minDeep, int maxDeep)
    {
      if (maxDeep <= 0) return;

      if (minDeep <= 0)
      {
        this.DrawCube(root, octree);
      }

      VoxelLocation nextRoot = new VoxelLocation();
      for (int i = 0; i < 2; ++i)
      {
        for (int j = 0; j < 2; ++j)
        {
          for (int k = 0; k < 2; ++k)
          {
            IVoxelMesh child = octree.GetChild(i, j, k);
            if (child != null)
            {
              nextRoot.X = root.X + i * octree.Width / 2;
              nextRoot.Y = root.Y + j * octree.Height / 2;
              nextRoot.Z = root.Z + k * octree.Depth / 2;

              if (child is IOctreeVoxelMesh)
              {
                this.DebugTree(nextRoot, (IOctreeVoxelMesh) child, minDeep - 1, maxDeep - 1);
              }
              else
              {
                this.DebugLeaf(nextRoot, child, minDeep - 1, maxDeep - 1);
              }
            }
          }
        }
      }
    }
 /// <summary>
 ///   Create a copy of an existing class.
 /// </summary>
 /// <param name="toCopy"></param>
 public WalkerOctreeState(WalkerOctreeState toCopy)
 {
   this._node = toCopy._node;
   this._cursor = toCopy._cursor;
   this._location = new VoxelLocation(toCopy._location);
 }
 /// <summary>
 ///   Create a new walker state.
 /// </summary>
 /// <param name="node"></param>
 public WalkerOctreeState(IOctreeVoxelMesh node)
 {
   this._node = node;
   this._cursor = -1;
   this._location = VoxelLocation.Zero;
 }