ckrbd.js
//a visit, for closest dot precursor to Voronoi.
a visit, for closest dot precursor to Voronoi.
a visit for closest dot precursor to Voronoi .
function taprootClosest(i,j,topLevel){
    var dotKs = [];
    cellChildren(i,j).forEach(cell => {
        if (image[cell.i][cell.j]) addKTo(image[cell.i][cell.j],dotKs); 
    });
    var firstLev = dotKs.length?0:1000;
    for (let lev = 1;lev<=topLevel;lev++) {
        children(i,j,lev).forEach(child => {
            let k = pyr[child.i][child.j];
            if (k) {
                if (closestDisplay==8) drawBetween(i,j,dots[k].i,dots[k].j,randomRGBString(i*pyrWidth+j));
                addKTo(k,dotKs);
            }
        });
        if (lev == firstLev + 1) break; 
    }
    if (dotKs.length) {
        pyr[i][j] = minD2(i,j,dotKs).k;
        if (closestDisplay == 1) { 
            let d = dots[pyr[i][j]];
            drawBetween(i,j,d.i,d.j,randomRGBString(i*pyrWidth+j)); 
        }
        return 1;
    } else return 0;
}
function taprootClosest ( i , j , topLevel ) { var dotKs = [ ] ; cellChildren ( i , j ) . forEach ( cell => { if ( image [ cell . i ] [ cell . j ] ) addKTo ( image [ cell . i ] [ cell . j ] , dotKs ) ; } ) ; var firstLev = dotKs . length ? 0 : 1000 ; for ( let lev = 1 ; lev <= topLevel ; lev ++ ) { children ( i , j , lev ) . forEach ( child => { let k = pyr [ child . i ] [ child . j ] ; if ( k ) { if ( closestDisplay == 8 ) drawBetween ( i , j , dots [ k ] . i , dots [ k ] . j , randomRGBString ( i * pyrWidth + j ) ) ; addKTo ( k , dotKs ) ; } } ) ; if ( lev == firstLev + 1 ) break ; } if ( dotKs . length ) { pyr [ i ] [ j ] = minD2 ( i , j , dotKs ) . k ; if ( closestDisplay == 1 ) { let d = dots [ pyr [ i ] [ j ] ] ; drawBetween ( i , j , d . i , d . j , randomRGBString ( i * pyrWidth + j ) ) ; } return 1 ; } else return 0 ; }
a visit, for closest dot precursor to Voronoi.
a visit for closest dot precursor to Voronoi .
//Level 0 gets special treatment because sources are all in image, not pyr //all image dot ks > 0 are different, unblocked. // firstLev is first level where something is found, // do one more level (if possible) thus adding in the closest dot in any of all 8 directions. // have added in closest in each of 8 directions examined