ckrbd.js
//a visit, for second part of Voronoi after closest dot.
a visit, for second part of Voronoi after closest dot.
a visit for second part of Voronoi after closest dot .
function taprootRedux(i,j,topLevel){
    var k = pyr[i][j];
    if (k){
        for (let lev = topLevel;lev>0;lev--) { 
            children(i,j,lev).forEach(child => {
                let ck = pyr[child.i][child.j]; 
                if (ck == 0) pyr[child.i][child.j] = k;
                else {
                    let d2K = d2(child.i,child.j,dots[k].i,dots[k].j);
                    let d2Ck = d2(child.i,child.j,dots[ck].i,dots[ck].j)
                    if (d2K < d2Ck) pyr[child.i][child.j] = k;
                }
            });
        }
        cellChildren(i,j).forEach(cell => {
            let ck = image[cell.i][cell.j];
            if (ck == 0) image[cell.i][cell.j] = k;
            else {
                let d2K = d2(cell.i,cell.j,dots[k].i,dots[k].j);
                let d2Ck = d2(cell.i,cell.j,dots[ck].i,dots[ck].j)
                if (d2K < d2Ck) image[cell.i][cell.j] = k;
            }
        });
        return 1;
    } else return 0;
}
function taprootRedux ( i , j , topLevel ) { var k = pyr [ i ] [ j ] ; if ( k ) { for ( let lev = topLevel ; lev > 0 ; lev -- ) { children ( i , j , lev ) . forEach ( child => { let ck = pyr [ child . i ] [ child . j ] ; if ( ck == 0 ) pyr [ child . i ] [ child . j ] = k ; else { let d2K = d2 ( child . i , child . j , dots [ k ] . i , dots [ k ] . j ) ; let d2Ck = d2 ( child . i , child . j , dots [ ck ] . i , dots [ ck ] . j ) if ( d2K < d2Ck ) pyr [ child . i ] [ child . j ] = k ; } } ) ; } cellChildren ( i , j ) . forEach ( cell => { let ck = image [ cell . i ] [ cell . j ] ; if ( ck == 0 ) image [ cell . i ] [ cell . j ] = k ; else { let d2K = d2 ( cell . i , cell . j , dots [ k ] . i , dots [ k ] . j ) ; let d2Ck = d2 ( cell . i , cell . j , dots [ ck ] . i , dots [ ck ] . j ) if ( d2K < d2Ck ) image [ cell . i ] [ cell . j ] = k ; } } ) ; return 1 ; } else return 0 ; }
a visit, for second part of Voronoi after closest dot.
a visit for second part of Voronoi after closest dot .
//go down (or up, doesn't matter) taproot, spreading info about k //by assumption of reduction, is 0 or a positive k //level 0 gets special treatment