index.js
function (node, m, M, compare) {

        node.children.sort(compare);

        var toBBox = this.toBBox,
            leftBBox = distBBox(node, 0, m, toBBox),
            rightBBox = distBBox(node, M - m, M, toBBox),
            margin = bboxMargin(leftBBox) + bboxMargin(rightBBox),
            i, child;

        for (i = m; i < M - m; i++) {
            child = node.children[i];
            extend(leftBBox, node.leaf ? toBBox(child) : child);
            margin += bboxMargin(leftBBox);
        }

        for (i = M - m - 1; i >= m; i--) {
            child = node.children[i];
            extend(rightBBox, node.leaf ? toBBox(child) : child);
            margin += bboxMargin(rightBBox);
        }

        return margin;
    }
function (node, m, M, compare) {

        node.children.sort(compare);

        var toBBox = this.toBBox,
            leftBBox = distBBox(node, 0, m, toBBox),
            rightBBox = distBBox(node, M - m, M, toBBox),
            margin = bboxMargin(leftBBox) + bboxMargin(rightBBox),
            i, child;

        for (i = m; i < M - m; i++) {
            child = node.children[i];
            extend(leftBBox, node.leaf ? toBBox(child) : child);
            margin += bboxMargin(leftBBox);
        }

        for (i = M - m - 1; i >= m; i--) {
            child = node.children[i];
            extend(rightBBox, node.leaf ? toBBox(child) : child);
            margin += bboxMargin(rightBBox);
        }

        return margin;
    }
function ( node , m , M , compare ) { node . children . sort ( compare ) ; var toBBox = this . toBBox , leftBBox = distBBox ( node , 0 , m , toBBox ) , rightBBox = distBBox ( node , M - m , M , toBBox ) , margin = bboxMargin ( leftBBox ) + bboxMargin ( rightBBox ) , i , child ; for ( i = m ; i < M - m ; i ++ ) { child = node . children [ i ] ; extend ( leftBBox , node . leaf ? toBBox ( child ) : child ) ; margin += bboxMargin ( leftBBox ) ; } for ( i = M - m - 1 ; i >= m ; i -- ) { child = node . children [ i ] ; extend ( rightBBox , node . leaf ? toBBox ( child ) : child ) ; margin += bboxMargin ( rightBBox ) ; } return margin ; }
total margin of all possible split distributions where each node is at least m full
total margin of all possible split distributions where each node is at least m full