src/core/geometry/trees.js
function (plane, coplanarfrontnodes, coplanarbacknodes, frontnodes, backnodes) {
    if (this.children.length) {
      let queue = [this.children]
      let i
      let j
      let l
      let node
      let nodes
      for (i = 0; i < queue.length; i++) { // queue.length can increase, do not cache
        nodes = queue[i]
        for (j = 0, l = nodes.length; j < l; j++) { // ok to cache length
          node = nodes[j]
          if (node.children.length) {
            queue.push(node.children)
          } else {
            // no children. Split the polygon:
            node._splitByPlane(plane, coplanarfrontnodes, coplanarbacknodes, frontnodes, backnodes)
          }
        }
      }
    } else {
      this._splitByPlane(plane, coplanarfrontnodes, coplanarbacknodes, frontnodes, backnodes)
    }
  }
function (plane, coplanarfrontnodes, coplanarbacknodes, frontnodes, backnodes) {
    if (this.children.length) {
      let queue = [this.children]
      let i
      let j
      let l
      let node
      let nodes
      for (i = 0; i < queue.length; i++) { // queue.length can increase, do not cache
        nodes = queue[i]
        for (j = 0, l = nodes.length; j < l; j++) { // ok to cache length
          node = nodes[j]
          if (node.children.length) {
            queue.push(node.children)
          } else {
            // no children. Split the polygon:
            node._splitByPlane(plane, coplanarfrontnodes, coplanarbacknodes, frontnodes, backnodes)
          }
        }
      }
    } else {
      this._splitByPlane(plane, coplanarfrontnodes, coplanarbacknodes, frontnodes, backnodes)
    }
  }
function ( plane , coplanarfrontnodes , coplanarbacknodes , frontnodes , backnodes ) { if ( this . children . length ) { let queue = [ this . children ] let i let j let l let node let nodes for ( i = 0 ; i < queue . length ; i ++ ) { // queue.length can increase, do not cache nodes = queue [ i ] for ( j = 0 , l = nodes . length ; j < l ; j ++ ) { // ok to cache length node = nodes [ j ] if ( node . children . length ) { queue . push ( node . children ) } else { // no children. Split the polygon: node . _splitByPlane ( plane , coplanarfrontnodes , coplanarbacknodes , frontnodes , backnodes ) } } } } else { this . _splitByPlane ( plane , coplanarfrontnodes , coplanarbacknodes , frontnodes , backnodes ) } }
split the node by a plane; add the resulting nodes to the frontnodes and backnodes array If the plane doesn't intersect the polygon, the 'this' object is added to one of the arrays If the plane does intersect the polygon, two new child nodes are created for the front and back fragments, and added to both arrays.
split the node by a plane ; add the resulting nodes to the frontnodes and backnodes array If the plane doesn t intersect the polygon the this object is added to one of the arrays If the plane does intersect the polygon two new child nodes are created for the front and back fragments and added to both arrays .